Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .vscode/launch.json

This file was deleted.

7 changes: 7 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:12-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "node", "web.js" ]
43 changes: 0 additions & 43 deletions app/app.js

This file was deleted.

11 changes: 0 additions & 11 deletions app/index.js

This file was deleted.

3 changes: 1 addition & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "Docker version of Mdata",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start-worker":"node mdata-worker.js",
"start-web":"node web.js"
"start":"node web.js"
},
"author": "",
"license": "ISC",
Expand Down
14 changes: 5 additions & 9 deletions app/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ client = redis.createClient({
});


const SFConnectionUtils = require('./utils/SFConnectionUtils.js');
const SFConnectionUtils = require('./worker/utils/SFConnectionUtils.js');

const PluginFactory = require('./plugins/PluginFactory.js');
const PluginFactory = require('./worker/plugins/PluginFactory.js');

var pluginFactory = new PluginFactory();

Expand Down Expand Up @@ -45,8 +45,6 @@ app.set('port', process.env.PORT || 3000);
//Middleware
app.use(session({secret: "w585hJqIfL0GWMUbD1WboOuvsjG9Urv1h8cEv8XyFZBPYV582WnLKapj1TboI5gp8sy3hDC53mbDXYDjLrIEvBbsz3MDKmzdLZCw"}));
app.use('/plugins/:id/execute',async function (req, res, next) {

console.log('OAuth Header:', req.get('Authorization'));
let oauthHdrValid = {};
if(!process.env.LOCAL){
oauthHdrValid = await validOauthHeader(req);
Expand All @@ -66,7 +64,7 @@ app.use('/plugins/:id/execute',async function (req, res, next) {
}
});

app.use(express.static('./app/public'));
app.use(express.static('./public'));

validOauthHeader = async function(req){
let authHdr = req.get('Authorization');
Expand Down Expand Up @@ -144,7 +142,6 @@ oauthCallback = function (request, response) {
// You can change loginUrl to connect to sandbox or prerelease env.
base_url: loginUrl
}, function (error, payload) {
console.log('Payload:' + JSON.stringify(payload));
if (payload) {
client.rpush('mdata_org_index', JSON.stringify(payload));
response.send('Authorization successful !!!');
Expand All @@ -167,6 +164,8 @@ mdataInit = function (request, response) {
});
return response.redirect(uri);
};


app.get('/plugins', listAllPlugins);
app.get('/plugins/:id', pluginDetail);
app.get('/plugins/:id/execute', runPlugin);
Expand All @@ -175,9 +174,6 @@ app.get('/oauth/callback', oauthCallback);

app.get("/mdata",mdataInit );




// Start listening for HTTP requests
var server = app.listen(app.get('port'), function() {
var host = server.address().address;
Expand Down
7 changes: 7 additions & 0 deletions app/worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:12-alpine
WORKDIR /usr/src/app/worker
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "node", "mdata-worker.js" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 8 additions & 3 deletions app/mdata-worker.js → app/worker/mdata-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ async function main(){
async function waitForRequest() {
client.brpop(['mdata_org_index', 1], async function (list, items) {
if (items && items.length === 2) {
logger.info('Received request to index org ... ');
await handleMdataIndexRequest(JSON.parse(items[1]));
setTimeout(waitForRequest, 3000);
try {
logger.info('Received request to index org ... ');
await handleMdataIndexRequest(JSON.parse(items[1]));
} catch(error) {
console.error(error);
} finally {
setTimeout(waitForRequest, 3000);
}
} else {
logger.info('No active request...');
setTimeout(waitForRequest, 3000);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions app/worker/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "mdata-worker",
"version": "1.0.0",
"description": "Docker version of Mdata",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start":"node mdata-worker.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"antlr4": "^4.7.1",
"await-async": "0.0.1",
"body-parser": "^1.18.3",
"dotenv": "^6.0.0",
"express": "^4.16.3",
"express-session": "^1.15.6",
"jsforce": "^1.8.5",
"lodash": "^4.17.10",
"neo4j-driver": "^1.6.2",
"node-rest-client": "^3.1.0",
"redis": "^2.8.0",
"salesforce-oauth2": "^0.2.0",
"sf-formula-ast": "0.0.1",
"sleepjs": "^3.0.1",
"unzip": "^0.1.11",
"unzip2": "^0.2.5",
"unzipper": "^0.10.5",
"winston": "^3.0.0",
"xml2js": "^0.4.19",
"natives": "^1.1.6"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file modified conf/neo4j.conf
100644 → 100755
Empty file.
70 changes: 28 additions & 42 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,28 @@
mdata-worker:
image: node:latest
volumes:
- ./app:/app
links:
- neo4j
- redis
working_dir: /app
command: node mdata-worker.js --inspect-brk=0.0.0.0 .
env_file: "mdata.env"
ports:
- "9229:9229"

mdata-web:
image: node:latest
volumes:
- ./app:/app
links:
- neo4j
- redis
- mdata-worker
working_dir: /app
command: node web.js
env_file: "mdata.env"
ports:
- "3000:3000"
redis:
image: redis
container_name: cache
expose:
- 6379
neo4j:
image: neo4j:3.5.12
environment:
- NEO4J_AUTH=neo4j/test
ports:
- "7474:7474"
- "7687:7687"
volumes:
- ./data:/data
- ./conf:/conf
- ./plugins:/plugins
version: '3'
services:
mdata-worker:
build: ./app/worker
env_file: "mdata.env"
ports:
- "9229:9229"
mdata-web:
build: ./app
env_file: "mdata.env"
ports:
- "3000:3000"
redis:
image: redis
container_name: cache
expose:
- 6379
neo4j:
image: neo4j:3.5.12
environment:
- NEO4J_AUTH=neo4j/test
ports:
- "7474:7474"
- "7687:7687"
volumes:
- ./data:/data
- ./conf:/conf
- ./plugins:/plugins
18 changes: 18 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
setup:
addons:
- plan: heroku-redis:hobby-dev
- plan: graphenedb:dev-free
config:
LOCAL: true
SKIP_JOB_CREATE: true
BOOTSTRAP_SLEEP_SECS: 15
SF_CLIENT_ID: 3MVG9WtWSKUDG.x6eKgRnQaY0devdNN4eIspkzn5bM7B4KpnqDMadEWWqFzlZBOzXYhCRnRfONx1n0ekc4wWe
SF_CLIENT_SECRET: BFDE194265A7FC3DBCFD0585FCA3EDA355D8895C913B42739F5FA8B304575874
SF_CALLBACK_URL: https://mdata-poc.herokuapp.com/oauth/callback
build:
docker:
web: app/Dockerfile
worker: app/worker/Dockerfile
run:
web: npm start
worker: npm start
Empty file modified plugins/README.txt
100644 → 100755
Empty file.
Empty file modified plugins/apoc-3.5.0.1.jar
100644 → 100755
Empty file.
Empty file modified plugins/graphAlgorithms-3.5.2.0.jar
100644 → 100755
Empty file.
9 changes: 0 additions & 9 deletions run_mdata.sh

This file was deleted.

4 changes: 0 additions & 4 deletions yarn.lock

This file was deleted.