defined compose file for deploy

This commit is contained in:
2024-01-10 09:58:59 +01:00
parent bf99801157
commit bdf81a3c5b
5 changed files with 53 additions and 4 deletions

2
.vscode/tasks.json vendored
View File

@@ -13,7 +13,7 @@
"build": true, "build": true,
}, },
"files": [ "files": [
"${workspaceFolder}/docker-compose.yml" "${workspaceFolder}/docker-compose-debug.yml"
], ],
"isBackground": true, "isBackground": true,
"problemMatcher": "Terminal will be reused by tasks, press any key to close it" "problemMatcher": "Terminal will be reused by tasks, press any key to close it"

View File

@@ -1,6 +1,5 @@
# ToDo # ToDo
* year pagination * year pagination
* build & deploy via docker
# Authentication # Authentication
Authentication consists of the following parts: Authentication consists of the following parts:
@@ -16,4 +15,22 @@ Source:
# Multi-User Support # Multi-User Support
Each location record is marked with a user ID. 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. 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
```

32
docker-compose-deploy.yml Normal file
View File

@@ -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/

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{ {
"name": "rezije", "name": "utility-bills-tracker",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {