-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
138 lines (131 loc) · 3.5 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
secrets:
postgres_pass:
file: ${SECRETS_DIR}/postgres_pass
pgadmin_pass:
file: ${SECRETS_DIR}/pgadmin_pass
pgapp_pass:
file: ${SECRETS_DIR}/pgapp_pass
django_secret_key:
file: ${SECRETS_DIR}/django_secret_key
email_pass:
file: ${SECRETS_DIR}/email_pass
services:
projetosd_db:
image: postgres:14.1-alpine
hostname: postgres
container_name: postgres
restart: always
volumes:
- ${PG_DIR}:/var/lib/postgresql/data
- ${BACKUP_DIR}:/backups
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_pass
secrets:
- postgres_pass
networks:
- backend
pgadmin:
image: dpage/pgadmin4:7.1
hostname: pgadmin
container_name: pgadmin
restart: always
environment:
- PGADMIN_DEFAULT_EMAIL
- PGADMIN_DEFAULT_PASSWORD_FILE=/run/secrets/pgadmin_pass
- PGADMIN_CONFIG_CONSOLE_LOG_LEVEL=40
secrets:
- pgadmin_pass
depends_on:
- projetosd_db
volumes:
- ./servers.json:/pgadmin4/servers.json
networks:
- backend
web:
build: .
image: web
command: bash -c "sh init-services-projetosd-web.sh"
hostname: web
container_name: web
restart: always
volumes:
- .:/code
- ./static:/code/static # Mapeie a pasta para o contêiner
- ./staticfiles:/code/staticfiles
ports:
- 3000:3000 # debugging service
environment:
- DEBUG
- IS_PRODUCTION
- PG_APP_USER
- PG_APP_PASSWORD_FILE=/run/secrets/pgapp_pass
- SECRET_KEY_FILE=/run/secrets/django_secret_key
- EMAIL_HOST_USER
- DEFAULT_FROM_EMAIL
- EMAIL_HOST_PASSWORD_FILE=/run/secrets/email_pass
# https://stackoverflow.com/questions/76003473/how-to-disable-debugger-warnings-about-frozen-modules-when-using-nbconvert-execu
- PYDEVD_DISABLE_FILE_VALIDATION=1
secrets:
- pgapp_pass
- django_secret_key
- email_pass
networks:
- backend
depends_on:
- projetosd_db
ssl:
build: ssl/
image: ssl
hostname: ssl
container_name: ssl
restart: always
environment:
- DOMAIN_NAME
- SSL_ENV=${ENV_NAME}
- SSL_SUBDOMAINS=www,adm,api,status
- SSL_ACCOUNT_EMAIL
- SSL_CA_DOMAIN
- SSL_RELOAD_CMD
- SSL_NOTIFIER_ADDRESS
- SSL_NOTIFIER_USERNAME
- SSL_NOTIFIER_PASSWORD
- NOTIFICATION_MAIL_TARGET
volumes:
- "${SSL_DIR}/certs:/data/ssl"
- "${SSL_DIR}/getssl:/root/.getssl"
- "${SSL_DIR}/acme-challenge:/data/acme-challenge"
proxy:
build: proxy/
image: proxy
hostname: proxy
container_name: proxy
restart: always
environment:
- NG_ENV=${ENV_NAME}
- NG_TPL_AUTH_NAME=projetosd
- NG_TPL_MAIN_DOMAIN=${DOMAIN_NAME}
- NG_TPL_WEB_DOMAINS=${DOMAIN_NAME} www.${DOMAIN_NAME}
- NG_TPL_ADM_DOMAIN=adm.${DOMAIN_NAME}
- NG_TPL_API_DOMAIN=api.${DOMAIN_NAME}
- NG_TPL_STATUS_DOMAIN=status.${DOMAIN_NAME}
- NG_TPL_WEB_HOST=web:8000
- NG_TPL_ADM_HOST=pgadmin:80
- NG_TPL_API_HOST=api:80
- NG_TPL_STATUS_HOST=web:80
ports:
- "80:80"
- "443:443"
networks:
- frontend
- backend
tmpfs: # docker compose only (docker stack ignores it)
- /data/cache/assets:size=32M,mode=770,uid=101,gid=101
volumes:
- "${SSL_DIR}/certs:/certs:ro"
- "${SSL_DIR}/acme-challenge:/usr/share/nginx/html/.well-known/acme-challenge:ro"
networks:
frontend:
driver: bridge
backend:
driver: bridge