@@ -27,6 +27,11 @@ services:
27
27
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER} # Load from .env
28
28
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS} # Load from .env
29
29
restart : unless-stopped
30
+ healthcheck :
31
+ test : rabbitmq-diagnostics -q ping
32
+ interval : 30s
33
+ timeout : 30s
34
+ retries : 3
30
35
volumes :
31
36
- rabbitmqdata:/var/lib/rabbitmq/
32
37
@@ -38,69 +43,69 @@ services:
38
43
env_file :
39
44
- .env
40
45
restart : unless-stopped
46
+ healthcheck :
47
+ test : ["CMD", "redis-cli", "ping"]
48
+ interval : 10s
49
+ timeout : 5s
50
+ retries : 3
41
51
command : ["redis-server", "--requirepass", "${CACHE_PASSWORD}"]
42
52
volumes :
43
53
- cachedata:/data
44
54
45
- # prometheus:
46
- # image: "prom/prometheus"
47
- # container_name: "my_chess_style_prom"
48
- # env_file:
49
- # - .env
50
- # command:
51
- # - "--config.file=/etc/prometheus/prometheus.yml"
52
- # ports:
53
- # - 9090:9090
54
- # restart: unless-stopped
55
- # volumes:
56
- # - ./observability/prometheus:/etc/prometheus
57
- # - prom_data:/prometheus
58
- #
59
- # grafana:
60
- # image: "grafana/grafana"
61
- # container_name: "my_chess_style_graf"
62
- # env_file:
63
- # - .env
64
- # ports:
65
- # - 3000:3000
66
- # restart: unless-stopped
67
- # environment:
68
- # - GF_SECURITY_ADMIN_USER=${GRAFANA_DEFAULT_USER}
69
- # - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_DEFAULT_PASS}
70
- # volumes:
71
- # - ./observability/grafana:/etc/grafana/provisioning/datasources
72
- #
73
- # pg_explorer:
74
- # image: "prometheuscommunity/postgres-exporter"
75
- # container_name: "my_chess_style_pg_explorer"
76
- # env_file:
77
- # - .env
78
- # ports:
79
- # - 9187:9187
80
- # depends_on:
81
- # pg_server:
82
- # condition: service_healthy
83
- # prometheus:
84
- # condition: service_started
85
- # restart: unless-stopped
55
+ prometheus :
56
+ image : " prom/prometheus"
57
+ container_name : " my_chess_style_prom"
58
+ env_file :
59
+ - .env
60
+ command :
61
+ - " --config.file=/etc/prometheus/prometheus.yml"
62
+ ports :
63
+ - 9090:9090
64
+ restart : unless-stopped
65
+ volumes :
66
+ - ./observability/prometheus:/etc/prometheus
67
+ - prom_data:/prometheus
68
+
69
+ grafana :
70
+ image : " grafana/grafana"
71
+ container_name : " my_chess_style_graf"
72
+ env_file :
73
+ - .env
74
+ ports :
75
+ - 3000:3000
76
+ restart : unless-stopped
77
+ environment :
78
+ - GF_SECURITY_ADMIN_USER=${GRAFANA_DEFAULT_USER}
79
+ - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_DEFAULT_PASS}
80
+ volumes :
81
+ - ./observability/grafana:/etc/grafana/provisioning/datasources
82
+
83
+ pg_explorer :
84
+ image : " prometheuscommunity/postgres-exporter"
85
+ container_name : " my_chess_style_pg_explorer"
86
+ env_file :
87
+ - .env
88
+ ports :
89
+ - 9187:9187
90
+ depends_on :
91
+ pg_server :
92
+ condition : service_healthy
93
+ prometheus :
94
+ condition : service_started
95
+ restart : unless-stopped
86
96
87
97
django-web-frontend :
88
98
build :
89
99
context : .
90
100
dockerfile : Dockerfile.frontend
91
101
container_name : my_chess_style_django_web_frontend
92
102
ports :
93
- - " 3000:8080"
103
+ - " 3000:80"
104
+ depends_on :
105
+ django-web-backend :
106
+ condition : service_healthy
94
107
healthcheck :
95
- test :
96
- [
97
- " CMD" ,
98
- " wget" ,
99
- " --no-verbose" ,
100
- " --tries=1" ,
101
- " --spider" ,
102
- " http://localhost:8080/" ,
103
- ]
108
+ test : ["CMD", "curl", "-f", "http://localhost/"]
104
109
interval : 30s
105
110
timeout : 3s
106
111
retries : 3
@@ -115,9 +120,12 @@ services:
115
120
ports :
116
121
- " 8000:8000"
117
122
depends_on :
118
- - pg_server
119
- - cache
120
- - rabbitmq_server
123
+ pg_server :
124
+ condition : service_healthy
125
+ cache :
126
+ condition : service_healthy
127
+ rabbitmq_server :
128
+ condition : service_healthy
121
129
env_file :
122
130
- .env
123
131
develop :
@@ -133,10 +141,14 @@ services:
133
141
image : my-chess-style-base
134
142
container_name : my_chess_style_celery_worker
135
143
depends_on :
136
- - django-web-backend
137
- - pg_server
138
- - cache
139
- - rabbitmq_server
144
+ django-web-backend :
145
+ condition : service_healthy
146
+ pg_server :
147
+ condition : service_healthy
148
+ cache :
149
+ condition : service_started
150
+ rabbitmq_server :
151
+ condition : service_healthy
140
152
env_file :
141
153
- .env
142
154
command : sh celery_entry.sh
@@ -146,13 +158,12 @@ services:
146
158
- " 80:80"
147
159
- " 443:443"
148
160
volumes :
149
- - ./nginx.conf:/etc/nginx/nginx.conf:ro
150
- - static_files:/var/www/static:ro
151
- - media_files:/var/www/media:ro
152
- - ./ssl:/etc/nginx/ssl:ro # If using SSL
161
+ - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
153
162
depends_on :
154
- - django-web-backend
155
- - django-web-frontend
163
+ django-web-backend :
164
+ condition : service_healthy
165
+ django-web-frontend :
166
+ condition : service_healthy
156
167
157
168
networks :
158
169
default :
0 commit comments