Skip to content

Instantly share code, notes, and snippets.

View PatrickKalkman's full-sized avatar
🏠
Working from home

Patrick Kalkman PatrickKalkman

🏠
Working from home
View GitHub Profile
DuplexChannelFactory<imessagesenderwithcallback> duplexChannelFactory =
new DuplexChannelFactory<imessagesenderwithcallback>(this, binding, endpointAddress);
IMessageSenderWithCallBack duplexMessageSender = duplexChannelFactory.CreateChannel(endpointAddress);
duplexMessageSender.Subscribe();
duplexMessageSender.ShowMessage("message");
duplexMessageSender.Unsubscribe();
FROM node:12-alpine
RUN mkdir /home/node/app/ && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY --chown=node:node package*.json ./
USER node
const process = require('process');
var app = {};
process.on('SIGINT', function onSigint() {
app.shutdown();
});
process.on('SIGTERM', function onSigterm() {
app.shutdown();
# Add Tini
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
# Run your program under Tini
CMD ["node", "index.js"]
app.shutdown = function () {
server.close(function onServerClosed(err) {
if (err) {
log.error('An error occurred while closing the server: ' + err);
process.exitCode = 1;
}
});
process.exit();
};
@PatrickKalkman
PatrickKalkman / healthcheck.js
Created January 5, 2020 14:52
Healthcheck cmd
const http = require('http');
const config = require('./config');
const log = require('./log');
const constants = require('./constants');
const options = {
host: 'localhost',
port: config.httpPort,
timeout: 2000,
method: 'GET',
@PatrickKalkman
PatrickKalkman / config.js
Created January 5, 2020 16:19
Configuration structure for Node.js
/*
* Create and export configuration variables used by the API
*
*/
const constants = require('./constants');
// Container for all environments
const environments = {};
environments.production = {
// Container for all environments
const environments = {};
environments.production = {
httpPort: process.env.HTTP_PORT || 3000,
host: process.env.HOST || '0.0.0.0',
@PatrickKalkman
PatrickKalkman / Docker-Compose.yml
Created January 10, 2020 08:35
Docker Compose file for MongoDB
version: '2'
services:
workflowdb:
image: 'mongo:4.0.14'
container_name: 'workflow-db'
environment:
- MONGO_INITDB_ROOT_USERNAME=mveroot
- MONGO_INITDB_ROOT_PASSWORD=2020minivideoencoder!
- MONGO_INITDB_DATABASE=workflow-db
volumes:
@PatrickKalkman
PatrickKalkman / init-mongo.js
Created January 10, 2020 09:27
init mongo script for creating workflow engine user during startup of MongoDB
db.createUser({
user: 'mve-workflowengine',
pwd: 'mve-workflowengine-password',
roles: [
{
role: 'readWrite',
db: 'workflow-db',
},
],
});