Skip to content

Instantly share code, notes, and snippets.

View suru-dissanaike's full-sized avatar

Suru Dissanaike suru-dissanaike

View GitHub Profile
version: "3.3"
services:
traefik:
image: "traefik:v2.4"
container_name: "traefik"
command:
- "--log.level=DEBUG"
- "--api=true"
const mqtt = require('async-mqtt');
const MTPMQTTTopic = '/himinds/';
const HOST = "wss://test.mosquitto.org:8081"; // <-- change to your host and port 443
const optionsLocal = {
username: 'himinds',
password: 'TcV1YrduetnMmxx9'
};
const WebSocket = require('ws');
// in order to handle self-signed certificates we need to turn off the validation
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
const ws = new WebSocket('wss://localhost:8080');
ws.on('open', function open() {
ws.send('hello from client');
const fs = require('fs');
const WebSocket = require('ws');
const https = require('https');
const server = new https.createServer({
cert: fs.readFileSync('server.crt'),
key: fs.readFileSync('server.key')
});
const wss = new WebSocket.Server({server});
version: '3.5'
services:
mosquitto:
container_name: mosquitto_container
image: eclipse-mosquitto:1.6.10
volumes:
- ./config:/mosquitto/config/
ports:
- '8883:8883'
port 8883
cafile /mosquitto/config/certs/ca.crt
certfile /mosquitto/config/certs/server.crt
keyfile /mosquitto/config/certs/server.key
require_certificate true
use_identity_as_username true
{
"scripts": {
"test": "jest --coverage",
"jshint": "jshint --exclude ./node_modules,./coverage .",
"jscpd": "jscpd --ignore \"**/*.min.js,**/*.map\" --format \"javascript\" --threshold 0 database.js index.js mqttConf.js"
},
"jest": {
"collectCoverage": true,
"collectCoverageFrom": [
FROM node:12.13.0
# Create app directory
WORKDIR /usr/src/backend-mqtt-database-service
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
image: node:12.16
cache:
untracked: true
key: "$CI_COMMIT_REF_NAME"
paths:
- node_modules/
stages:
- install
- static-code-analysis
- dynamic-code-analysis
image: surudissanaike/himinds-env-sensor-ci:0.1
stages:
- build
- static-code-analysis
build:
stage: build
script:
- mos build