-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
138 lines (128 loc) · 3.41 KB
/
Copy pathdocker-compose.yml
File metadata and controls
138 lines (128 loc) · 3.41 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
# docker-compose.yml
services:
db:
image: postgres:15-alpine
container_name: sinapi_db
hostname: db
env_file: .env
environment:
- POSTGRES_MULTIPLE_DATABASES=sinapi,kong
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- KONG_PG_USER=${KONG_PG_USER}
- KONG_PG_PASSWORD=${KONG_PG_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/db/multiple-databases.sh:/docker-entrypoint-initdb.d/multiple-databases.sh
ports:
- "127.0.0.1:5432:5432"
restart: unless-stopped
networks:
- sinapi-net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U kong -d kong"]
interval: 10s
timeout: 5s
retries: 5
api:
container_name: sinapi_api
build: .
env_file: .env
volumes:
- ./autosinapi_downloads:/app/downloads
depends_on:
db:
condition: service_healthy
restart: unless-stopped
networks:
- sinapi-net
redis:
image: redis:7-alpine
container_name: sinapi_redis
restart: unless-stopped
networks:
- sinapi-net
celery_worker:
build: .
container_name: sinapi_worker
command: celery -A api.tasks.celery_app worker --loglevel=info
env_file: .env
volumes:
- ./autosinapi_downloads:/app/downloads
depends_on:
- redis
- db
restart: unless-stopped
networks:
- sinapi-net
kong-migrations:
#image: kong:3.4
build: ./kong/
container_name: kong_migrations
env_file: .env
environment:
- KONG_DATABASE=postgres
- KONG_PG_DATABASE=kong
- KONG_PG_HOST=db
- KONG_PG_USER=${KONG_PG_USER}
- KONG_PG_PASSWORD=${KONG_PG_PASSWORD}
command: >
sh -c "
echo 'Waiting for PostgreSQL user \"kong\" to be created...';
until pg_isready -h db -U ${KONG_PG_USER} -d kong;
do
echo 'Waiting for database...';
sleep 2;
done;
echo 'User \"kong\" is ready. Resetting and running Kong migrations...';
kong migrations reset -y && kong migrations bootstrap && kong config db_import /usr/local/kong/declarative/kong.yml || sleep 3600
#kong migrations bootstrap --vv
"
depends_on:
db:
condition: service_healthy
restart: "no"
networks:
- sinapi-net
volumes:
- ./kong:/usr/local/kong/declarative
kong:
#image: kong:3.4
build: ./kong/
container_name: sinapi_gateway
env_file: .env
environment:
- KONG_DATABASE=postgres
- KONG_PG_DATABASE=kong
- KONG_PG_HOST=db
- KONG_PG_USER=${KONG_PG_USER}
- KONG_PG_PASSWORD=${KONG_PG_PASSWORD}
- KONG_PROXY_ACCESS_LOG=/dev/stdout
- KONG_ADMIN_ACCESS_LOG=/dev/stdout
- KONG_PROXY_ERROR_LOG=/dev/stderr
- KONG_ADMIN_ERROR_LOG=/dev/stderr
- KONG_ADMIN_LISTEN=0.0.0.0:8001
depends_on:
kong-migrations:
condition: service_completed_successfully
ports:
- "8000:8000"
restart: unless-stopped
networks:
- sinapi-net
healthcheck:
test: ["CMD", "kong", "health"]
interval: 10s
timeout: 5s
retries: 5
tunnel:
image: cloudflare/cloudflared:latest
command: tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN}
restart: unless-stopped
container_name: cloudflared_tunnel
volumes:
postgres_data:
driver: local
networks:
sinapi-net:
driver: bridge