-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
95 lines (89 loc) · 2.2 KB
/
docker-compose.yml
File metadata and controls
95 lines (89 loc) · 2.2 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
version: '3'
services:
jaeger:
image: jaegertracing/all-in-one:latest
container_name: simple-chat-jaeger
ports:
- "16686:16686"
- "4317:4317"
- "4318:4318"
- "14250:14250"
- "14268:14268"
- "14269:14269"
- "9411:9411"
networks:
- simple-chat-network
postgres:
image: postgres:14.2-alpine
container_name: simple-chat-postgres
env_file:
- .env.template
ports:
- "54320:5432"
volumes:
- ./scripts/init_postgres.sh:/docker-entrypoint-initdb.d/init_postgres.sh
- simple-chat-pgdata:/var/lib/postgresql/data
networks:
- simple-chat-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
db-migrate:
image: migrate/migrate
env_file:
- .env.template
networks:
- simple-chat-network
volumes:
- ./migrations:/migrations
command: [ "-path", "/migrations", "-database", "postgres://user:password@postgres:5432/rust-simple-chat?sslmode=disable&search_path=rust_simple_chat", "up" ]
depends_on:
postgres:
condition: service_healthy
chat:
build:
context: .
args:
SERVICE_NAME: "chat" # /src/bin/<bin_name>
container_name: chat-api
env_file:
- .env.template
environment:
SERVER_PORT: "9000"
SERVER_METRICS_PORT: "9007"
ports:
- "9000:9000"
- "9007:9007"
volumes:
- /data:/usr/src/app
networks:
- simple-chat-network
depends_on:
- db-migrate
worker:
build:
context: .
args:
SERVICE_NAME: "worker" # /src/bin/<bin_name>
container_name: worker
env_file:
- .env.template
environment:
SERVER_PORT: "9001" # set another port than chat, because server default port 9000
SERVER_METRICS_PORT: "9008" # set another metrics port than chat, because server default port 9007
ports:
- "9001:9001"
volumes:
- /data:/usr/src/app
networks:
- simple-chat-network
depends_on:
- db-migrate
networks:
simple-chat-network:
driver: bridge
volumes:
simple-chat-pgdata: