No known key found for this signature in database
GPG Key ID: 86A4D290ED03FAB4
10 changed files with
114 additions and
31 deletions
-
docker-compose.yml
-
server/config/keys.js
-
server/connections/influx_conn.js
-
server/connections/mongo_conn.js
-
server/connections/redis_conn.js
-
server/docker-compose.yml
-
server/models/User.js
-
web/Dockerfile
-
web/index.js
-
web/package.json
|
|
@ -0,0 +1,71 @@ |
|
|
|
version: "3.9" |
|
|
|
services: |
|
|
|
redis: |
|
|
|
image: "redis" |
|
|
|
container_name: "redis" |
|
|
|
deploy: |
|
|
|
restart_policy: |
|
|
|
condition: on-failure |
|
|
|
delay: 5s |
|
|
|
max_attempts: 3 |
|
|
|
window: 120s |
|
|
|
networks: |
|
|
|
- backend |
|
|
|
influx: |
|
|
|
image: "influxdb" |
|
|
|
container_name: "influx" |
|
|
|
deploy: |
|
|
|
restart_policy: |
|
|
|
condition: on-failure |
|
|
|
delay: 5s |
|
|
|
max_attempts: 3 |
|
|
|
window: 120s |
|
|
|
networks: |
|
|
|
- backend |
|
|
|
mongo: |
|
|
|
image: "mongo" |
|
|
|
container_name: "mongo" |
|
|
|
deploy: |
|
|
|
restart_policy: |
|
|
|
condition: on-failure |
|
|
|
delay: 5s |
|
|
|
max_attempts: 3 |
|
|
|
window: 120s |
|
|
|
networks: |
|
|
|
- backend |
|
|
|
backend: |
|
|
|
build: ./server |
|
|
|
container_name: "backend" |
|
|
|
deploy: |
|
|
|
restart_policy: |
|
|
|
condition: on-failure |
|
|
|
delay: 5s |
|
|
|
max_attempts: 3 |
|
|
|
window: 120s |
|
|
|
ports: |
|
|
|
- "6000:6000" |
|
|
|
networks: |
|
|
|
- backend |
|
|
|
- frontend |
|
|
|
depends_on: |
|
|
|
- redis |
|
|
|
- influx |
|
|
|
- mongo |
|
|
|
frontend: |
|
|
|
build: ./web |
|
|
|
container_name: "frontend" |
|
|
|
deploy: |
|
|
|
restart_policy: |
|
|
|
condition: on-failure |
|
|
|
delay: 5s |
|
|
|
max_attempts: 3 |
|
|
|
window: 120s |
|
|
|
ports: |
|
|
|
- "6001:6001" |
|
|
|
networks: |
|
|
|
- frontend |
|
|
|
depends_on: |
|
|
|
- backend |
|
|
|
networks: |
|
|
|
backend: |
|
|
|
frontend: |
|
|
@ -1,10 +1,10 @@ |
|
|
|
module.exports = { |
|
|
|
influx_url: 'http://0.0.0.0', |
|
|
|
influx_uri: 'http://influx:8086', |
|
|
|
influx_token: '', |
|
|
|
influx_org: '', |
|
|
|
influx_bucket: '', |
|
|
|
redis_user: '', |
|
|
|
redis_password: '', |
|
|
|
redis_host: 'redis', |
|
|
|
redis_port: '6379' |
|
|
|
redis_uri: 'redis://redis:6379', |
|
|
|
mongo_uri: 'mongodb://mongo:27017/user' |
|
|
|
} |
|
|
@ -1,10 +1,10 @@ |
|
|
|
const {InfluxDB} = require('@influxdata/influxdb-client') |
|
|
|
const chalk = require('chalk') |
|
|
|
|
|
|
|
const {influx_url, influx_token, influx_org, influx_bucket} = require('../config/keys') |
|
|
|
const {influx_uri, influx_token, influx_org, influx_bucket} = require('../config/keys') |
|
|
|
|
|
|
|
const client = new InfluxDB({ |
|
|
|
url: influx_url, |
|
|
|
url: influx_uri, |
|
|
|
token: influx_token, |
|
|
|
}); |
|
|
|
|
|
|
@ -14,6 +14,7 @@ const write = client.getWriteApi( |
|
|
|
); |
|
|
|
|
|
|
|
const queryApi = client.getQueryApi(influx_org); |
|
|
|
|
|
|
|
console.log(chalk.greenBright.bold('Connected to influx!')) |
|
|
|
|
|
|
|
module.exports = {writeApi: write, queryApi} |
|
|
|
module.exports = {write, queryApi} |
|
|
@ -0,0 +1,12 @@ |
|
|
|
const mongoose = require('mongoose'); |
|
|
|
const chalk = require('chalk') |
|
|
|
const {mongo_uri} = require('../config/keys'); |
|
|
|
|
|
|
|
mongoose.Promise = global.Promise; |
|
|
|
mongoose.connect(mongo_uri, { |
|
|
|
useNewUrlParser: true, |
|
|
|
useUnifiedTopology: true, |
|
|
|
useFindAndModify: false, |
|
|
|
useCreateIndex: true |
|
|
|
}).then(() => console.log(chalk.greenBright.bold('Connected to mongo!'))); |
|
|
|
|
|
|
@ -1,9 +1,9 @@ |
|
|
|
const redis = require('redis'); |
|
|
|
const chalk = require('chalk'); |
|
|
|
|
|
|
|
const {redis_host, redis_port} = require('../config/keys') |
|
|
|
const {redis_uri} = require('../config/keys') |
|
|
|
|
|
|
|
const pub = redis.createClient(`redis://${redis_host}:${redis_port}`); |
|
|
|
const pub = redis.createClient(redis_uri); |
|
|
|
const sub = pub.duplicate(); |
|
|
|
|
|
|
|
pub.on('error', (error) => { |
|
|
|
|
|
@ -1,23 +0,0 @@ |
|
|
|
version: "3.9" |
|
|
|
services: |
|
|
|
redis: |
|
|
|
image: "redis:alpine" |
|
|
|
networks: |
|
|
|
- backend |
|
|
|
influx: |
|
|
|
image: "influxdb:alpine" |
|
|
|
networks: |
|
|
|
- backend |
|
|
|
volumes: |
|
|
|
- /home/xrazis/Documents/random_code/database/influx/:/var/lib/influxdb |
|
|
|
backend: |
|
|
|
build: "" |
|
|
|
ports: |
|
|
|
- "6000:6000" |
|
|
|
networks: |
|
|
|
- backend |
|
|
|
depends_on: |
|
|
|
- redis |
|
|
|
- influx |
|
|
|
networks: |
|
|
|
backend: |
|
|
@ -0,0 +1,11 @@ |
|
|
|
FROM node:latest |
|
|
|
|
|
|
|
WORKDIR /usr/src/app |
|
|
|
|
|
|
|
COPY package*.json ./ |
|
|
|
|
|
|
|
RUN npm install |
|
|
|
COPY . . |
|
|
|
|
|
|
|
EXPOSE 6000 |
|
|
|
CMD [ "npm", "run", "run" ] |
|
|
@ -0,0 +1,11 @@ |
|
|
|
{ |
|
|
|
"name": "web", |
|
|
|
"version": "1.0.0", |
|
|
|
"description": "", |
|
|
|
"main": "index.js", |
|
|
|
"scripts": { |
|
|
|
"test": "echo \"Error: no test specified\" && exit 1" |
|
|
|
}, |
|
|
|
"author": "", |
|
|
|
"license": "ISC" |
|
|
|
} |