From bdf81a3c5b5d36e31bfaefa288eda184689da942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Wed, 10 Jan 2024 09:58:59 +0100 Subject: [PATCH] defined compose file for deploy --- .vscode/tasks.json | 2 +- README.md | 21 ++++++++++-- ...er-compose.yml => docker-compose-debug.yml | 0 docker-compose-deploy.yml | 32 +++++++++++++++++++ package-lock.json | 2 +- 5 files changed, 53 insertions(+), 4 deletions(-) rename docker-compose.yml => docker-compose-debug.yml (100%) create mode 100644 docker-compose-deploy.yml diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 1b2136f..312e5c6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -13,7 +13,7 @@ "build": true, }, "files": [ - "${workspaceFolder}/docker-compose.yml" + "${workspaceFolder}/docker-compose-debug.yml" ], "isBackground": true, "problemMatcher": "Terminal will be reused by tasks, press any key to close it" diff --git a/README.md b/README.md index 771ae4d..c92c04a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # ToDo * year pagination -* build & deploy via docker # Authentication Authentication consists of the following parts: @@ -16,4 +15,22 @@ Source: # Multi-User Support Each location record is marked with a user ID. -All the actions user `withUser` to fetch user ID, which is then used in all the DB operations. \ No newline at end of file +All the actions user `withUser` to fetch user ID, which is then used in all the DB operations. + +# Deploying +The deployment is done via Docker: +* build docker image +* deploy Docker service + +## Building Docker image +Run the following command: +```bash +docker build . -t utility-bills-tracker:1.2.0 +``` +The image will be stored in the local Docker instance. + +## Deploying Docker service +Run the following command: +```bash +docker stack deploy -c docker-compose-deploy.yml utility-bills-tracker:1.2.0 +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose-debug.yml similarity index 100% rename from docker-compose.yml rename to docker-compose-debug.yml diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml new file mode 100644 index 0000000..b18194e --- /dev/null +++ b/docker-compose-deploy.yml @@ -0,0 +1,32 @@ +# this compose file runs Postgres db and exposes it's port to the host machine +version: "3.7" + +services: + web-app: + image: utility-bills-tracker:latest + restart: always + ports: + - 3000:3000 + environment: + MONGODB_URI: mongodb://root:XZtq9WakpT35wb8C76omRx@mongo:27017/ + GOOGLE_ID: 355397364527-adjrokm6hromcaaar0qfhk050mfr35ou.apps.googleusercontent.com + GOOGLE_SECRET: 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 + AUTH_SECRET: Gh0jQ35oq6DR8HkLR3heA8EaEDtxYN/xkP6blvukZ0w= + mongo: + image: mongo:6.0.12 + restart: always + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: XZtq9WakpT35wb8C76omRx + volumes: + - ./mongo:/data/db + mongo-express: + image: mongo-express + restart: always + ports: + - 8081:8081 + environment: + ME_CONFIG_MONGODB_ADMINUSERNAME: root + ME_CONFIG_MONGODB_ADMINPASSWORD: XZtq9WakpT35wb8C76omRx + ME_CONFIG_MONGODB_URL: mongodb://root:XZtq9WakpT35wb8C76omRx@mongo:27017/ + diff --git a/package-lock.json b/package-lock.json index 3e8bc94..b7880c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "rezije", + "name": "utility-bills-tracker", "lockfileVersion": 3, "requires": true, "packages": {