This repository was archived by the owner on Dec 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
85 lines (78 loc) · 2.31 KB
/
docker-compose.yml
File metadata and controls
85 lines (78 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
version: "3.9"
services:
devicehub:
init: true
container_name: devicehub
build:
context: .
dockerfile: docker/devicehub.Dockerfile
#image: dkr-dsg.ac.upc.edu/ereuse/devicehub:testing_docker__f42b2d09
environment:
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_HOST=postgres
- DB_DATABASE=${DB_DATABASE}
- HOST=${HOST}
- EMAIL_DEMO=${EMAIL_DEMO}
- PASSWORD_DEMO=${PASSWORD_DEMO}
- JWT_PASS=${JWT_PASS}
- SECRET_KEY=${SECRET_KEY}
- DEVICEHUB_HOST=${DEVICEHUB_HOST}
- URL_MANUALS=${URL_MANUALS}
- DEPLOYMENT=${DEPLOYMENT}
ports:
- 5000:5000
volumes:
- shared:/shared:rw
- app:/opt/devicehub:rw
postgres:
#image: dkr-dsg.ac.upc.edu/ereuse/postgres:testing_docker__f42b2d09
container_name: postgres_devicehub
build:
context: .
dockerfile: docker/postgres.Dockerfile
# 4. To create the database.
# 5. Give permissions to the corresponding users in the database.
# extra src https://github.com/docker-library/docs/blob/master/postgres/README.md#environment-variables
environment:
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USER}
- POSTGRES_DB=${DB_DATABASE}
volumes:
- pg_data:/var/lib/postgresql/data
# DEBUG
#ports:
# - 5432:5432
backup:
image: postgres:15.4-bookworm
container_name: postgres_backup
depends_on:
- postgres
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_DATABASE}
- BACKUP_PATH=${BACKUP_PATH}
volumes:
- pg_data:/var/lib/postgresql/data
- ${BACKUP_PATH}:/backups
command: >
bash -c "
while true; do
# Backup every day
sleep 86400
PGPASSWORD=$$POSTGRES_PASSWORD pg_dump -h postgres -U $$POSTGRES_USER -Fc $$POSTGRES_DB > $$BACKUP_PATH/$$(date +%Y-%m-%d-%H-%M-%S).dump
echo ""Backup done at $$(date +%Y-%m-%d_%H:%M:%S)""
#delete all but the most recent 4 backups
ls -1 $$BACKUP_PATH/*.dump | head -n -4 | xargs rm -f
done"
nginx:
image: nginx
ports:
- 8080:8080
volumes:
- ./docker/nginx-devicehub.nginx.conf:/etc/nginx/nginx.conf:ro
volumes:
shared:
pg_data:
app: