-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.full.yml
87 lines (82 loc) · 2.09 KB
/
docker-compose.full.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
# docker-compose -f docker-compose.full.yml up
version: '3'
services:
# API and its relational db
#db:
# image: postgres:15.3-bullseye
# restart: unless-stopped
# volumes:
# - volume_db_data:/var/lib/postgresql/data
# - volume_db_dump:/var/dump_pgsql
# environment:
# POSTGRES_USER: postgres-user-2
# POSTGRES_PASSWORD: postgres-password-2
# POSTGRES_DB: postgres-db-2
# expose:
# - "5432"
# healthcheck:
# test:
# - CMD-SHELL
# - pg_isready -U postgres-user-2 -d postgres-db-2
# interval: 10s
# timeout: 5s
# retries: 10
# https://console.cloud.google.com/artifacts/docker/cloud-sql-connectors/us/gcr.io/cloud-sql-proxy
db:
image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.10.0-bullseye
restart: unless-stopped
env_file:
- ./env_vars/cloudsql.env
ports:
- "5432"
volumes:
- ./env_vars/cloudsql_creds.json:/secrets/credentials.json
entrypoint:
- sh
- -c
command:
- >
/cloud-sql-proxy
--address 0.0.0.0
--port 5432
--credentials-file /secrets/credentials.json
$$DATABASE_CONNECTION_NAME
healthcheck:
disable: true
# Gunicorn settings: https://docs.gunicorn.org/en/latest/settings.html
api:
image: django
build:
context: .
dockerfile: docker.full.Dockerfile
restart: "no"
depends_on:
- db
ports:
- 8080:8080
env_file:
- ./env_vars/cloudsql.env
environment:
DATABASE_HOST: db
DATABASE_PORT: 5432
command: >
gunicorn
--bind :8080
--workers=3
--worker-class=sync
--log-level=info
--log-file=-
--forwarded-allow-ips=*
--pid=gunicorn.pid
--timeout 60
--max-requests 1000
wsgi:application
platform: linux/amd64
volumes:
- volume_logs_django:/var/log/django:delegated
# https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
# Volumes are created with "UID:GID" permissions
volumes:
volume_db_data:
volume_db_dump:
volume_logs_django: