11services :
22 db :
3- # Workaround for PostgreSQL crash with pgvector v0.6.1 on ARM64
4- # image: pgvector/pgvector:pg15
5- # volumes:
6- # - postgres_data:/var/lib/postgresql/data/
7- # - ./db/init-vector-extension.sql:/docker-entrypoint-initdb.d/init-vector-extension.sql
8- build :
9- context : ./db
10- dockerfile : Dockerfile
3+ image : pgvector/pgvector:pg15
114 volumes :
125 - postgres_data:/var/lib/postgresql/data/
6+ - ./db/init-vector-extension.sql:/docker-entrypoint-initdb.d/init-vector-extension.sql
137 environment :
148 - POSTGRES_USER=balancer
159 - POSTGRES_PASSWORD=balancer
@@ -24,17 +18,26 @@ services:
2418 networks :
2519 app_net :
2620 ipv4_address : 192.168.0.2
27- # pgadmin:
28- # container_name: pgadmin4
29- # image: dpage/pgadmin4
30- # environment:
31- # PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org
32- # PGADMIN_DEFAULT_PASSWORD: balancer
33- # ports:
34- # - "5050:80"
35- # networks:
36- # app_net:
37- # ipv4_address: 192.168.0.4
21+ healthcheck :
22+ test : ["CMD-SHELL", "pg_isready -U balancer -d balancer_dev"]
23+ interval : 5s
24+ timeout : 5s
25+ retries : 5
26+
27+ pgadmin :
28+ image : dpage/pgadmin4
29+ environment :
30+ - PGADMIN_DEFAULT_EMAIL=balancer-noreply@codeforphilly.org
31+ - PGADMIN_DEFAULT_PASSWORD=balancer
32+ ports :
33+ - " 5050:80"
34+ depends_on :
35+ db :
36+ condition : service_healthy
37+ networks :
38+ app_net :
39+ ipv4_address : 192.168.0.4
40+
3841 backend :
3942 image : balancer-backend
4043 build : ./server
@@ -52,6 +55,13 @@ services:
5255 networks :
5356 app_net :
5457 ipv4_address : 192.168.0.3
58+ healthcheck :
59+ test : ["CMD-SHELL", "python3 -c 'import http.client;conn=http.client.HTTPConnection(\"localhost:8000\");conn.request(\"GET\",\"/admin/login/\");res=conn.getresponse();exit(0 if res.status in [200,301,302,401] else 1)'"]
60+ interval : 10s
61+ timeout : 5s
62+ retries : 5
63+ start_period : 10s
64+
5565 frontend :
5666 image : balancer-frontend
5767 build :
@@ -67,10 +77,17 @@ services:
6777 - " ./frontend:/usr/src/app:delegated"
6878 - " /usr/src/app/node_modules/"
6979 depends_on :
70- - backend
80+ backend :
81+ condition : service_healthy
7182 networks :
7283 app_net :
7384 ipv4_address : 192.168.0.5
85+ healthcheck :
86+ test : ["CMD-SHELL", "curl -f http://localhost:3000 || exit 1"]
87+ interval : 10s
88+ timeout : 5s
89+ retries : 5
90+
7491volumes :
7592 postgres_data :
7693networks :
@@ -79,4 +96,4 @@ networks:
7996 driver : default
8097 config :
8198 - subnet : " 192.168.0.0/24"
82- gateway : 192.168.0.1
99+ gateway : 192.168.0.1
0 commit comments