-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
149 lines (142 loc) · 3.79 KB
/
docker-compose.yml
File metadata and controls
149 lines (142 loc) · 3.79 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
x-logging: &default-logging
driver: loki
options:
loki-url: 'http://localhost:3100/api/prom/push'
loki-pipeline-stages: |
- multiline:
firstline: '^\d{4}-\d{2}-\d{2} \d{1,2}:\d{2}:\d{2}'
max_wait_time: 3s
- regex:
expression: '^(?P<time>\d{4}-\d{2}-\d{2} \d{1,2}:\d{2}:\d{2},d{3}) (?P<message>(?s:.*))$$'
services:
fastid-db:
image: postgres:16-alpine
env_file:
- .env
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
- POSTGRES_DB=${POSTGRES_DB?Variable not set}
volumes:
- pg_data:/var/lib/postgresql/data
ports:
- "5412:5432"
restart: unless-stopped
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
networks:
- fastid-net
- observability_net
fastid-redis:
image: redis:latest
env_file:
- .env
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD?Variable not set}
restart: unless-stopped
# Set credentials & logging
command: >
sh -c '
mkdir -p /usr/local/etc/redis &&
echo "bind 0.0.0.0" > /usr/local/etc/redis/redis.conf &&
echo "appendonly yes" >> /usr/local/etc/redis/redis.conf &&
echo "user default on >$REDIS_PASSWORD ~* +@all" > /usr/local/etc/redis/users.acl &&
redis-server /usr/local/etc/redis/redis.conf --aclfile /usr/local/etc/redis/users.acl
'
volumes:
- redis_data:/var/lib/redis/data
ports:
- "6312:6379"
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- fastid-net
- observability_net
fastid-api:
build:
context: .
dockerfile: docker/fastapi.Dockerfile
target: dev
command: "uvicorn \"fastid.api.app:api_app\" --host 0.0.0.0 --port 8000 --reload"
env_file:
- .env
restart: unless-stopped
ports:
- "8012:8000"
depends_on:
fastid-db:
condition: service_healthy
fastid-redis:
condition: service_healthy
logging: *default-logging
volumes:
- "./migrations:/opt/fastid/migrations"
- "./fastid:/opt/fastid/fastid"
- "./templates:/opt/fastid/templates"
- "./static:/opt/fastid/static"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8000/api/v1/readiness" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- fastid-net
- observability_net
fastid-frontend:
build:
context: .
dockerfile: docker/fastapi.Dockerfile
target: dev
command: "uvicorn \"fastid.frontend.app:frontend_app\" --host 0.0.0.0 --port 3000 --reload"
env_file:
- .env
restart: unless-stopped
ports:
- "3012:3000"
depends_on:
fastid-api:
condition: service_healthy
logging: *default-logging
volumes:
- "./fastid:/opt/fastid/fastid"
- "./templates:/opt/fastid/templates"
- "./static:/opt/fastid/static"
networks:
- fastid-net
- observability_net
fastid-admin:
build:
context: .
dockerfile: docker/fastapi.Dockerfile
target: dev
command: "uvicorn \"fastid.admin.app:admin_app\" --host 0.0.0.0 --port 4000 --reload"
env_file:
- .env
restart: unless-stopped
ports:
- "4012:4000"
depends_on:
fastid-api:
condition: service_healthy
logging: *default-logging
volumes:
- "./fastid:/opt/fastid/fastid"
networks:
- fastid-net
- observability_net
volumes:
pg_data:
redis_data:
networks:
fastid-net:
name: fastid-net
observability_net:
name: observability_net