This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
services: | |
traefik: | |
image: "traefik:v2.4" | |
container_name: "traefik" | |
command: | |
- "--log.level=DEBUG" | |
- "--api=true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.5' | |
services: | |
mosquitto: | |
container_name: mosquitto_container | |
image: eclipse-mosquitto:1.6.10 | |
volumes: | |
- ./config:/mosquitto/config/ | |
ports: | |
- '8883:8883' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ./ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: node:12.16 | |
cache: | |
untracked: true | |
key: "$CI_COMMIT_REF_NAME" | |
paths: | |
- node_modules/ | |
stages: | |
- install | |
- static-code-analysis | |
- dynamic-code-analysis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: surudissanaike/himinds-env-sensor-ci:0.1 | |
stages: | |
- build | |
- static-code-analysis | |
build: | |
stage: build | |
script: | |
- mos build |