From bbe7332f46549665b29e959b1e6c1bb833776385 Mon Sep 17 00:00:00 2001 From: Haris Razis Date: Mon, 14 Dec 2020 11:22:26 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=20Add=20docker-compose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 39 ++++++++------------------------ server/Dockerfile | 11 +++++++++ server/actions/influx_actions.js | 2 +- server/config/keys.js | 4 ++-- server/docker-compose.yml | 23 +++++++++++++++++++ server/index.js | 4 ++-- 6 files changed, 49 insertions(+), 34 deletions(-) create mode 100644 server/Dockerfile create mode 100644 server/docker-compose.yml diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d8a6482..b0a3955 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,21 +2,12 @@ - - - - - - - - - - + + + - + - - - + - + - - - - - - - @@ -117,18 +100,15 @@ - + - - - @@ -149,6 +129,7 @@ + 1607333101556 diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..8abf7f6 --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,11 @@ +FROM node:latest + +WORKDIR /usr/src/app + +COPY package*.json ./ + +RUN npm install +COPY . . + +EXPOSE 6000 +CMD [ "npm", "run", "run" ] \ No newline at end of file diff --git a/server/actions/influx_actions.js b/server/actions/influx_actions.js index 44c7e54..c7edb1e 100644 --- a/server/actions/influx_actions.js +++ b/server/actions/influx_actions.js @@ -35,7 +35,7 @@ query = (timeFrame, filter) => { .then(async (result) => { }) .catch(() => { - return [{Error: 'Error occured'}]; + return [{Error: 'Error occurred'}]; }); } diff --git a/server/config/keys.js b/server/config/keys.js index 21957a8..e2f2414 100644 --- a/server/config/keys.js +++ b/server/config/keys.js @@ -5,6 +5,6 @@ module.exports = { influx_bucket: '', redis_user: '', redis_password: '', - redis_host: '0.0.0.0', - redis_port: '7001' + redis_host: 'redis', + redis_port: '6379' } \ No newline at end of file diff --git a/server/docker-compose.yml b/server/docker-compose.yml new file mode 100644 index 0000000..c59e068 --- /dev/null +++ b/server/docker-compose.yml @@ -0,0 +1,23 @@ +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: diff --git a/server/index.js b/server/index.js index 902fb4c..b535d0c 100644 --- a/server/index.js +++ b/server/index.js @@ -10,5 +10,5 @@ const measurementRoute = require('./routes/data') app.use(measurementRoute) -server.listen(3000); -console.log(chalk.green.bold('Server listening on port 3000!')); \ No newline at end of file +server.listen(6000); +console.log(chalk.green.bold('Server listening on port 6000!')); \ No newline at end of file