-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
179 lines (168 loc) · 3.94 KB
/
docker-compose.yml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
version: '3.9'
networks:
kong-net:
driver: bridge
kong-ext-net:
driver: bridge
backend-database-net:
driver: bridge
volumes:
kong_data: { }
services:
# Database
postgres:
container_name: postgres_backend
image: postgres:15.0-alpine
volumes:
- /var/opt/phd_postgres_backend/pg_data:/var/lib/postgresql/data/pgdata
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
- POSTGRES_HOST_AUTH_METHOD=trust
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
networks:
- backend-database-net
healthcheck:
test: [ "CMD", "pg_isready", "-U", "postgres" ]
interval: 30s
timeout: 30s
retries: 3
restart: unless-stopped
# Backend
backend_api:
container_name: backend
build:
context: ${PWD}/backend
dockerfile: Dockerfile
env_file:
- backend/ENV/api.env
depends_on:
- kong
- postgres
networks:
- kong-ext-net
- backend-database-net
restart: unless-stopped
# Frontend
frontend:
container_name: frontend
build:
context: ${PWD}/frontend/website/nginx
dockerfile: Dockerfile
depends_on:
- kong
networks:
- kong-ext-net
restart: unless-stopped
# Grafana
grafana:
container_name: grafana
build:
context: ${PWD}/frontend/grafana
dockerfile: Dockerfile
env_file:
- frontend/grafana/ENV/deploy.env
volumes:
- ./frontend/grafana/ENV/grafana.ini:/etc/grafana/grafana.ini
depends_on:
- kong
- postgres
networks:
- kong-ext-net
- backend-database-net
restart: unless-stopped
# API Gateway
kong:
container_name: api_gateway
image: kong:2.8.3-alpine
environment:
- KONG_ADMIN_ACCESS_LOG=/dev/stdout
- KONG_ADMIN_ERROR_LOG=/dev/stderr
- KONG_ADMIN_LISTEN=0.0.0.0:8001
- KONG_PROXY_ACCESS_LOG=/dev/stdout
- KONG_PROXY_ERROR_LOG=/dev/stderr
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-db
- KONG_PG_DATABASE=kong_db
- KONG_PG_USER=kong
depends_on:
- kong-db
- kong-migrations-up
ports:
- "8000:8000/tcp"
- "8001:8001/tcp"
- "8443:8443/tcp"
- "8444:8444/tcp"
networks:
- kong-net
- kong-ext-net
healthcheck:
test: [ "CMD", "kong", "health" ]
interval: 10s
timeout: 10s
retries: 10
restart: unless-stopped
kong-db:
container_name: api_gateway_db
image: postgres:9.5
environment:
- POSTGRES_DB=kong_db
- POSTGRES_USER=kong
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
- kong_data:/var/lib/postgresql/data
stdin_open: true
tty: true
networks:
- kong-net
healthcheck:
test: [ "CMD", "pg_isready", "-U", "kong" ]
interval: 30s
timeout: 30s
retries: 3
restart: unless-stopped
kong-migrations:
container_name: api_gateway_migrations
image: kong:2.8.3-alpine
command: "kong migrations bootstrap"
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-db
- KONG_PG_DATABASE=kong_db
- KONG_PG_USER=kong
depends_on:
- kong-db
networks:
- kong-net
restart: on-failure
kong-migrations-up:
container_name: api_gateway_migrations_up
image: kong:2.8.3-alpine
command: "kong migrations up && kong migrations finish"
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=kong-db
- KONG_PG_DATABASE=kong_db
- KONG_PG_USER=kong
depends_on:
- kong-db
- kong-migrations
networks:
- kong-net
restart: on-failure
# Database viewer
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4:6.21
environment:
- PGADMIN_DEFAULT_PASSWORD=marcvila
depends_on:
- postgres
restart: unless-stopped
ports:
- "5433:80"
networks:
- backend-database-net