@@ -4,7 +4,7 @@ services:
4
4
# Databases
5
5
user-db :
6
6
hostname : ' user-db'
7
- image : postgres:16.4
7
+ image : ' postgres:16.4'
8
8
container_name : ' user-db'
9
9
build :
10
10
context : ./backend/user/src/lib/db
@@ -55,8 +55,6 @@ services:
55
55
restart : unless-stopped
56
56
networks :
57
57
- question-db-network
58
- ports :
59
- - 5433:5432
60
58
healthcheck :
61
59
test : ['CMD-SHELL', 'pg_isready -U peerprep-qn-express -d question']
62
60
interval : 10s
@@ -75,8 +73,6 @@ services:
75
73
args :
76
74
# For building with the correct env vars
77
75
- port=${USER_EXPRESS_PORT}
78
- ports :
79
- - ' 9001:${USER_EXPRESS_PORT}'
80
76
env_file :
81
77
- ./backend/user/.env.compose
82
78
environment :
@@ -91,12 +87,42 @@ services:
91
87
- user-db-network
92
88
- user-api-network
93
89
healthcheck :
94
- test : wget --no-verbose --tries=1 --spider http://localhost:9001 /health || exit 1
90
+ test : wget --no-verbose --tries=1 --spider http://localhost:${USER_EXPRESS_PORT} /health || exit 1
95
91
interval : 30s
96
92
timeout : 10s
97
93
retries : 5
98
94
start_period : 5s
99
95
96
+ question-service :
97
+ image : " question-express"
98
+ container_name : ' ${QUESTION_SERVICE_NAME}'
99
+ build :
100
+ context : ./backend/question
101
+ dockerfile : express.Dockerfile
102
+ target : production
103
+ args :
104
+ # For building with the correct env vars
105
+ - port=${QUESTION_EXPRESS_PORT}
106
+ env_file :
107
+ - ./backend/question/.env.compose
108
+ environment :
109
+ # Docker Compose Specific for Service Discovery
110
+ - EXPRESS_DB_HOST=question-db
111
+ - EXPRESS_DB_PORT=5432
112
+ depends_on :
113
+ question-db :
114
+ condition : service_healthy
115
+ restart : true
116
+ networks :
117
+ - question-db-network
118
+ - question-api-network
119
+ healthcheck :
120
+ test : wget --no-verbose --tries=1 --spider http://localhost:${QUESTION_EXPRESS_PORT}/health || exit 1
121
+ interval : 30s
122
+ timeout : 10s
123
+ retries : 5
124
+ start_period : 5s
125
+
100
126
# Frontend
101
127
102
128
frontend :
@@ -113,13 +139,15 @@ services:
113
139
- ./frontend/.env.compose
114
140
environment :
115
141
- VITE_USER_SERVICE=http://${USER_SERVICE_NAME}:${USER_EXPRESS_PORT}
116
- # #to remove localhost once integrating question
117
- - VITE_QUESTION_SERVICE=http://host.docker.internal:${QUESTION_EXPRESS_PORT}
142
+ - VITE_QUESTION_SERVICE=http://${QUESTION_SERVICE_NAME}:${QUESTION_EXPRESS_PORT}
118
143
- FRONTEND_PORT=${FRONTEND_PORT}
119
144
depends_on :
120
145
user-service :
121
146
condition : service_healthy
122
147
restart : true
148
+ question-service :
149
+ condition : service_healthy
150
+ restart : true
123
151
networks :
124
152
- user-api-network
125
153
- question-api-network
0 commit comments