-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcompose.yaml
More file actions
145 lines (134 loc) · 4 KB
/
compose.yaml
File metadata and controls
145 lines (134 loc) · 4 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
name: "cpnucleo-default"
# Consolidated common healthcheck configurations.
x-common-healthcheck:
x-healthcheck-api: &healthcheck-api
test: ["CMD", "curl", "-f", "http://localhost:5000/healthz"]
interval: 30s
timeout: 10s
retries: 3
x-healthcheck-identity: &healthcheck-identity
test: ["CMD", "curl", "-f", "http://localhost:5010/healthz"]
interval: 30s
timeout: 10s
retries: 3
x-healthcheck-grpcserver: &healthcheck-grpcserver
test: ["CMD", "curl", "-f", "http://localhost:5021/healthz"]
interval: 30s
timeout: 10s
retries: 3
x-healthcheck-webclient: &healthcheck-webclient
test: ["CMD", "curl", "-f", "http://localhost:5030/healthz"]
interval: 30s
timeout: 10s
retries: 3
# Extension defining common configuration for API services in the default configuration.
x-common-api: &common-api
depends_on:
db:
condition: service_healthy
env_file:
- .env
deploy:
resources:
limits:
cpus: "0.4"
memory: "100MB"
services:
webapi1-cpnucleo: &webapi1
<<: *common-api
image: ghcr.io/jonathanperis/cpnucleo-web-api:latest
container_name: webapi1-cpnucleo
ports:
# Mapping internal port 5000 to external host port 5100 for webapi1 service
- "5100:5000"
healthcheck: *healthcheck-api
webapi2-cpnucleo:
<<: [*webapi1, *common-api]
container_name: webapi2-cpnucleo
ports:
# Mapping internal port 5000 to external host port 5111 for webapi2 service
- "5111:5000"
identityapi-cpnucleo:
<<: *common-api
image: ghcr.io/jonathanperis/cpnucleo-identity-api:latest
container_name: identityapi-cpnucleo
ports:
# Mapping internal port 5010 to external host port 5200 for identity API service
- "5200:5010"
healthcheck: *healthcheck-identity
grpcserver-cpnucleo:
<<: *common-api
image: ghcr.io/jonathanperis/cpnucleo-grpc-server:latest
container_name: grpcserver-cpnucleo
ports:
# Mapping internal port 5020 to external host port 5300 for grpc server service
- "5300:5020"
# Mapping internal port 5021 to external host port 5301 for grpc server service
- "5301:5021"
healthcheck: *healthcheck-grpcserver
webclient-cpnucleo:
<<: *common-api
image: ghcr.io/jonathanperis/cpnucleo-web-client:latest
container_name: webclient-cpnucleo
ports:
# Mapping internal port 5030 to external host port 5400 for web client service
- "5400:5030"
healthcheck: *healthcheck-webclient
env_file:
- .env
deploy:
resources:
limits:
cpus: "0.4"
memory: "100MB"
db:
image: postgres:16.7
container_name: db-cpnucleo
volumes:
- db_data:/var/lib/postgresql/data
- ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 5s
timeout: 5s
retries: 5
ports:
# Exposing default PostgreSQL port on both host and container
- "5432:5432"
deploy:
resources:
limits:
cpus: "0.5"
memory: "330MB"
command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c fsync=0 -c full_page_writes=0
nginx:
image: nginx
container_name: nginx-cpnucleo
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- webapi1-cpnucleo
- webapi2-cpnucleo
ports:
# Mapping external port 9999 to internal port 9999 for NGINX reverse-proxy
- "9999:9999"
deploy:
resources:
limits:
cpus: "0.2"
memory: "20MB"
volumes:
db_data:
driver: local
labels:
- "com.example.service=cpnucleo-db"
networks:
default:
name: cpnucleo_network
driver: bridge
driver_opts:
com.example.description: "Default network for cpnucleo services"