-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
67 lines (64 loc) · 1.75 KB
/
docker-compose.yml
File metadata and controls
67 lines (64 loc) · 1.75 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
services:
db:
image: postgres:15
container_name: chronos-db
restart: on-failure
env_file:
- .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- '5434:5432'
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
interval: 10s
timeout: 5s
retries: 5
logging:
driver: 'none'
db-collation-fix:
image: postgres:15
container_name: chronos-db-collation-fix
depends_on:
db:
condition: service_healthy
env_file:
- .env
environment:
PGPASSWORD: ${POSTGRES_PASSWORD}
entrypoint: ['sh', '-lc']
command: |
set -e
while ! pg_isready -h db -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -t 1 >/dev/null 2>&1; do sleep 1; done
psql -h db -U "${POSTGRES_USER}" -d postgres -v ON_ERROR_STOP=1 \
-c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '${POSTGRES_DB}';" \
-c "ALTER DATABASE \"${POSTGRES_DB}\" REFRESH COLLATION VERSION;" \
-c "REINDEX DATABASE \"${POSTGRES_DB}\";"
restart: 'no'
logging:
driver: 'none'
chronos:
build: .
container_name: chronos-backend
depends_on:
db:
condition: service_healthy
db-collation-fix:
condition: service_completed_successfully
env_file:
- .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
CHRONOS_PORT: ${CHRONOS_PORT}
ports:
- '${CHRONOS_PORT}:3000'
- '5555:5555'
volumes:
- ./prisma:/app/prisma
restart: always
volumes:
pgdata: