Refresh backend node_modules

This commit is contained in:
Nawaz Dhandala
2020-02-21 19:04:29 +01:00
parent 398f2dbc5f
commit 72bb4adbeb
7 changed files with 4032 additions and 558 deletions

4507
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,8 @@ try {
require('custom-env').env(process.env.NODE_ENV || 'development');
}
const path = require('path');
const http = require('http').createServer(app);
const io = require('socket.io')(http);
@@ -17,15 +19,13 @@ try {
const bodyParser = require('body-parser');
const cors = require('cors');
io.adapter(redisAdapter({
host: keys.redisURL || 'localhost',
port: process.env.REDIS_PORT || 6379
}));
global.io = io;
app.use(cors());
app.use(function (req, res, next) {
@@ -38,7 +38,7 @@ try {
res.header('Access-Control-Allow-Headers', 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept,Authorization');
next();
});
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
@@ -54,7 +54,8 @@ try {
app.use(express.static(path.join(__dirname, 'views')));
app.use(require('./backend/middlewares/auditLogs').log);
// Routes(API)
app.use('/server', require('./backend/api/server'));
app.use('/alert', require('./backend/api/alert'));
@@ -91,7 +92,7 @@ try {
app.use('/tutorial', require('./backend/api/tutorial'));
app.use('/audit-logs', require('./backend/api/auditLogs'));
app.set('port', process.env.PORT || 3002);
const server = http.listen(app.get('port'), function () {
// eslint-disable-next-line
console.log('Server Started on port ' + app.get('port'));
@@ -105,7 +106,7 @@ try {
serviceType: 'fyipe-api'
}));
});
app.use('/*', function (req, res) {
res.status(404).render('notFound.ejs', {});
});

View File

@@ -2,7 +2,7 @@ version: "3.7"
services:
mongo:
image: mongo:4.0
image: mongo:3.6
ports:
- "27017:27017"
volumes:

View File

@@ -4,26 +4,52 @@ const fs = require('fs');
const util = require('./util/db');
const scripts = require('./scripts');
async function run () {
async function run() {
// eslint-disable-next-line no-console
console.log('Connecting to MongoDB.');
const connection = await util.connectToDb();
global.db = connection.db();
// eslint-disable-next-line no-console
console.log('Connected to MongoDB.');
// eslint-disable-next-line no-console
console.log('START SCRIPT: Running script.');
await scripts.start();
// eslint-disable-next-line no-console
console.log('START SCRIPT: Completed');
fs.readdirSync('./scripts')
.filter(file => file !== 'start.js' && file !== 'end.js') // Exclude start and end scripts
.sort((a, b) => parseInt(a.split('.')[2]) > parseInt(b.split('.')[2]) ? 1 : 0)
.forEach(function (file) {
.forEach(async function (file) {
if (PKG_VERSION < file.split('.')[2]) {
require(`./scripts/${file}`)();
// eslint-disable-next-line no-console
console.log(file + ': Running script.');
await require(`./scripts/${file}`)();
// eslint-disable-next-line no-console
console.log(file + ': Completed. ');
}
});
// eslint-disable-next-line no-console
console.log('END SCRIPT: Running script.');
await scripts.end();
// eslint-disable-next-line no-console
console.log('END SCRIPT: Completed');
connection.close();
// eslint-disable-next-line no-console
console.log('Mongo connection closed.');
}
module.exports = run;

View File

@@ -658,7 +658,7 @@ spec:
env:
- name: MONGO_URL
value: "mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo-headless.default.svc.cluster.local:27017,mongo-1.mongo-headless.default.svc.cluster.local:27017,mongo-2.mongo-headless.default.svc.cluster.local:27017/fyipedb?replicaSet=fyipe"
restartPolicy: Always
restartPolicy: Never
imagePullSecrets:
- name: gitlabcredv2
---

View File

@@ -635,35 +635,25 @@ spec:
########-INIT-SCRIPT-##########
apiVersion: apps/v1
kind: Deployment
apiVersion: batch/v1
kind: Job
metadata:
name: init-script
labels:
app: init-script
spec:
selector:
matchLabels:
app: init-script
replicas: 1 #STRICTLY 1
template:
metadata:
labels:
app: init-script
spec:
containers:
- image: registry.gitlab.com/fyipe-project/init-script:master
name: init-script
imagePullPolicy: Always
env:
- name: MONGO_URL
value: "mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo-headless.default.svc.cluster.local:27017,mongo-1.mongo-headless.default.svc.cluster.local:27017,mongo-2.mongo-headless.default.svc.cluster.local:27017/fyipedb?replicaSet=fyipe"
restartPolicy: Always
- name: init-script
image: registry.gitlab.com/fyipe-project/init-script:master
imagePullPolicy: Always
env:
- name: MONGO_URL
value: "mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo-headless.default.svc.cluster.local:27017,mongo-1.mongo-headless.default.svc.cluster.local:27017,mongo-2.mongo-headless.default.svc.cluster.local:27017/fyipedb?replicaSet=fyipe"
restartPolicy: Never
imagePullSecrets:
- name: gitlabcredv2
---
###########################
####################################
############-MONGODB-###############

View File

@@ -653,7 +653,7 @@ spec:
env:
- name: MONGO_URL
value: "mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo-headless.default.svc.cluster.local:27017,mongo-1.mongo-headless.default.svc.cluster.local:27017,mongo-2.mongo-headless.default.svc.cluster.local:27017/fyipedb?replicaSet=fyipe"
restartPolicy: Always
restartPolicy: Never
imagePullSecrets:
- name: gitlabcredv2
---