-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
160 lines (148 loc) · 3.92 KB
/
docker-compose.yml
File metadata and controls
160 lines (148 loc) · 3.92 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
150
151
152
153
154
155
156
157
158
159
160
services:
# ------------------------------------------------------------------
# OPTIONAL: Local Postgres + seeder (NOT used when connecting to Neon)
# ------------------------------------------------------------------
# db:
# container_name: db
# image: postgres:16
# restart: unless-stopped
# env_file: .env
# environment:
# POSTGRES_USER: ${DB_USER}
# POSTGRES_PASSWORD: ${DB_PASSWORD}
# POSTGRES_DB: ${DB_NAME}
# ports:
# - "${DB_PORT}:${DB_PORT}"
# volumes:
# - pgdata:/var/lib/postgresql/data
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
# interval: 3s
# timeout: 3s
# retries: 20
#
# db-seeder:
# image: postgres:16
# depends_on:
# db:
# condition: service_healthy
# volumes:
# - ./database:/seed
# env_file:
# - .env
# command: >
# bash -lc "
# echo 'Waiting for Postgres: ';
# echo $$DB_NAME;
# until pg_isready -h $$DB_HOST -U $$DB_USER -d $$DB_NAME; do sleep 1; done;
# export PGPASSWORD=\"$$DB_PASSWORD\";
# echo 'Running SQL seed files.';
# for f in ./seed/*.sql; do
# echo 'Executing' $$f;
# psql -h $$DB_HOST -U $$DB_USER -d $$DB_NAME -v ON_ERROR_STOP=1 -1 -f \"$$f\";
# done;
# echo 'All seed files executed successfully.';
# "
mongo:
image: mongo:7
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 5s
retries: 5
rabbitmq:
image: rabbitmq:3-management
healthcheck:
test: ["CMD", "rabbitmqctl", "status"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "no"]
ports: ["6379:6379"]
listing-service:
build:
context: .
dockerfile: ./listing-service/Dockerfile
container_name: listing-service
env_file:
- ./.env
- ./listing-service/.env
environment:
# This will come from your .env and should point to Neon
DATABASE_URL: ${DATABASE_URL}
ports:
- "${LISTING_PORT}:${LISTING_PORT}"
# No longer depends on db-seeder / local Postgres
orchestrator:
build:
context: .
dockerfile: ./orchestrator/Dockerfile
container_name: orchestrator
env_file:
- ./.env
- ./orchestrator/.env
ports:
- "${ORCHESTRATOR_PORT}:${ORCHESTRATOR_PORT}"
environment:
# Use a single DATABASE_URL from .env (Neon)
DATABASE_URL: ${DATABASE_URL}
depends_on:
mongo:
condition: service_healthy
rabbitmq:
condition: service_healthy
events-server:
build:
context: .
dockerfile: ./events-server/Dockerfile
container_name: events-server
env_file:
- ./.env
- ./events-server/.env
environment:
# Server
PORT: ":8001"
ports:
- "8001:8001"
depends_on:
- redis
- rabbitmq
- orchestrator
healthcheck:
# No /health route shown, so do a TCP check
test: ["CMD", "sh", "-c", "nc -z localhost 8001"]
interval: 10s
timeout: 5s
retries: 5
chat-consumer: # background worker
build:
context: .
dockerfile: ./chat-consumer/Dockerfile
env_file:
- ./.env
- ./chat-consumer/.env
depends_on:
rabbitmq:
condition: service_healthy
restart: unless-stopped # typical for background jobs
frontend:
build:
context: .
dockerfile: ./frontend/Dockerfile
container_name: frontend
ports:
- "3000:3000"
environment:
NODE_ENV: production
depends_on:
- orchestrator
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/"]
interval: 10s
timeout: 5s
retries: 5
volumes:
pgdata:
# Only used if you uncomment the local db service