Skip to content

Instantly share code, notes, and snippets.

let EventEmitter = require('events').EventEmitter
let notifier = new EventEmitter()
module.exports = notifier
/*
MICROSOFT SQL
*/
var sql = require(‘mssql’);
var notifier = require(‘./notifier.js’)
var config = {
user: “username”,
password: “Pass@word”,
server: ‘mssql’,
const { sql, getPool } = require(“./mssql.js”);
var notifier = require(‘./notifier.js’)
notifier.on(‘mssql_connected’, () => {
notifier.emit(‘start_process’);
})
notifier.on(‘mssql_connect_error’, () => {
console.log(‘Impossible to connect to mssql !’);
})
const mongoose = require('mongoose')
var notifier = require('./notifier.js')
mongoose.connection.on('connected', () => {
 notifier.emit('mongodb_connected');
});
mongoose.connection.on('error', () => {
 setTimeout(function () {
 notifier.emit('mongodb_connect');
 }, 1000)
});
// MSSQL init
const promise_mssql = new Promise((_resolve, _reject) => {
 notifier.on('mssql_connected', () => {
 _resolve();
 })
});
const { mongoose } = require("./mongodb.js");
// MongoDB init
const promise_mongodb = new Promise((_resolve, _reject) => {
FROM node
ARG PERSONAL_TOKEN=<personal-token>
ARG GITHUB_ACCOUNT=<username>
ARG REPOSITORY=<your_repository>
ARG DIRECTORY=<your application directory>
ARG BRANCH=master
RUN git clone -b $BRANCH https://$PERSONAL_TOKEN:[email protected]/$GITHUB_ACCOUNT/$REPOSITORY.git $DIRECTORY
docker build --no-cache -t application .
docker run -d application
FROM node
ARG PERSONAL_TOKEN
ARG GITHUB_ACCOUNT
ARG REPOSITORY
ARG DIRECTORY
ARG BRANCH
RUN git clone -b $BRANCH https://$PERSONAL_TOKEN:[email protected]/$GITHUB_ACCOUNT/$REPOSITORY.git $DIRECTORY
version : '2'
services:
main:
build:
context: ./application
args:
- BRANCH=<branch>
- DIRECTORY=<destination>
- REPOSITORY=<github repository>
docker-compose build --no-cache; docker-compose up -d