-
Notifications
You must be signed in to change notification settings - Fork 183
/
production.yml
191 lines (185 loc) · 6.94 KB
/
production.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
180
181
182
183
184
185
186
187
188
189
190
191
volumes:
production_postgres_data: {}
production_postgres_data_backups: {}
production_staticfiles: {}
production_data: {}
services:
django: &django
build:
context: .
dockerfile: ./compose/production/django/Dockerfile
image: ghostwriter_production_django
restart: unless-stopped
depends_on:
- postgres
- redis
labels:
name: ghostwriter_django
environment:
- USE_DOCKER=${USE_DOCKER}
- IPYTHONDIR=${IPYTHONDIR}
- DJANGO_2FA_ALWAYS_REVEAL_BACKUP_TOKENS=${DJANGO_2FA_ALWAYS_REVEAL_BACKUP_TOKENS}
- DJANGO_ACCOUNT_ALLOW_REGISTRATION=${DJANGO_ACCOUNT_ALLOW_REGISTRATION}
- DJANGO_ACCOUNT_EMAIL_VERIFICATION=${DJANGO_ACCOUNT_EMAIL_VERIFICATION}
- DJANGO_ADMIN_URL=${DJANGO_ADMIN_URL}
- DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS}
- DJANGO_CSRF_COOKIE_SECURE=${DJANGO_CSRF_COOKIE_SECURE}
- DJANGO_CSRF_TRUSTED_ORIGINS=${DJANGO_CSRF_TRUSTED_ORIGINS}
- DJANGO_DATE_FORMAT=${DJANGO_DATE_FORMAT}
- DJANGO_JWT_SECRET_KEY=${DJANGO_JWT_SECRET_KEY}
- DJANGO_QCLUSTER_NAME=${DJANGO_QCLUSTER_NAME}
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
- DJANGO_SECURE_SSL_REDIRECT=${DJANGO_SECURE_SSL_REDIRECT}
- DJANGO_SESSION_COOKIE_AGE=${DJANGO_SESSION_COOKIE_AGE}
- DJANGO_SESSION_COOKIE_SECURE=${DJANGO_SESSION_COOKIE_SECURE}
- DJANGO_SESSION_EXPIRE_AT_BROWSER_CLOSE=${DJANGO_SESSION_EXPIRE_AT_BROWSER_CLOSE}
- DJANGO_SESSION_SAVE_EVERY_REQUEST=${DJANGO_SESSION_SAVE_EVERY_REQUEST}
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}
- DJANGO_SOCIAL_ACCOUNT_ALLOW_REGISTRATION=${DJANGO_SOCIAL_ACCOUNT_ALLOW_REGISTRATION}
- DJANGO_SOCIAL_ACCOUNT_DOMAIN_ALLOWLIST=${DJANGO_SOCIAL_ACCOUNT_DOMAIN_ALLOWLIST}
- DJANGO_SOCIAL_ACCOUNT_LOGIN_ON_GET=${DJANGO_SOCIAL_ACCOUNT_LOGIN_ON_GET}
- DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL}
- DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD}
- DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME}
- HASURA_ACTION_SECRET=${HASURA_GRAPHQL_ACTION_SECRET}
- MAILGUN_API_KEY=${DJANGO_MAILGUN_API_KEY}
- MAILGUN_DOMAIN=${DJANGO_MAILGUN_DOMAIN}
- NO_PROXY=graphql_engine
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_USER=${POSTGRES_USER}
- REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}/0
- WEB_CONCURRENCY=${DJANGO_WEB_CONCURRENCY}
healthcheck:
test: curl --insecure --fail https://nginx/status/simple/ || exit 1
interval: ${HEALTHCHECK_INTERVAL}
timeout: ${HEALTHCHECK_TIMEOUT}
retries: ${HEALTHCHECK_RETRIES}
start_period: ${HEALTHCHECK_START}
command: /start
volumes:
- production_staticfiles:/app/staticfiles
- production_data:/app/ghostwriter/media
postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
image: ghostwriter_production_postgres
restart: unless-stopped
volumes:
- production_postgres_data:/var/lib/postgresql/data
- production_postgres_data_backups:/backups
labels:
name: ghostwriter_postgres
environment:
- NO_PROXY=django,graphql_engine
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_USER=${POSTGRES_USER}
healthcheck:
test: pg_isready -d $$POSTGRES_DB -U $$POSTGRES_USER
interval: ${HEALTHCHECK_INTERVAL}
timeout: ${HEALTHCHECK_TIMEOUT}
retries: ${HEALTHCHECK_RETRIES}
start_period: ${HEALTHCHECK_START}
ports:
- "${POSTGRES_PORT}:5432"
nginx:
build: ./compose/production/nginx
image: ghostwriter_production_nginx
restart: unless-stopped
depends_on:
- django
volumes:
- production_data:/app/media
- production_staticfiles:/app/staticfiles
- ./compose/production/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./ssl:/ssl
labels:
name: ghostwriter_nginx
ports:
- "0.0.0.0:80:80"
- "0.0.0.0:443:443"
environment:
- NO_PROXY=django,graphql_engine
healthcheck:
test: curl --insecure --fail https://localhost/accounts/login || exit 1
interval: ${HEALTHCHECK_INTERVAL}
timeout: ${HEALTHCHECK_TIMEOUT}
retries: ${HEALTHCHECK_RETRIES}
start_period: ${HEALTHCHECK_START}
redis:
build:
context: .
dockerfile: ./compose/production/redis/Dockerfile
image: ghostwriter_production_redis
labels:
name: ghostwriter_redis
restart: unless-stopped
healthcheck:
test: redis-cli --raw incr ping || exit 1
interval: ${HEALTHCHECK_INTERVAL}
timeout: ${HEALTHCHECK_TIMEOUT}
retries: ${HEALTHCHECK_RETRIES}
start_period: ${HEALTHCHECK_START}
queue:
<<: *django
image: ghostwriter_production_queue
restart: unless-stopped
depends_on:
- redis
- postgres
- django
ports: []
labels:
name: ghostwriter_queue
command: /start-queue
graphql_engine:
build:
context: .
dockerfile: ./compose/production/hasura/Dockerfile
image: ghostwriter_production_graphql
depends_on:
- postgres
- django
restart: unless-stopped
ports:
- "${HASURA_GRAPHQL_SERVER_PORT}:8080"
- "9691:9691"
volumes:
- ./hasura-docker/metadata:/metadata
- ./ssl:/etc/ssl/certs
logging:
driver: "json-file"
options:
max-file: "1"
max-size: "10m"
labels:
name: ghostwriter_graphql
environment:
- ACTIONS_URL_BASE=https://${NGINX_HOST}:${NGINX_PORT}/api
- HASURA_ACTION_SECRET=${HASURA_GRAPHQL_ACTION_SECRET}
- HASURA_GRAPHQL_ADMIN_SECRET=${HASURA_GRAPHQL_ADMIN_SECRET}
- HASURA_GRAPHQL_AUTH_HOOK=https://${NGINX_HOST}:${NGINX_PORT}/api/webhook
- HASURA_GRAPHQL_CONSOLE_ASSETS_DIR=/srv/console-assets
- HASURA_GRAPHQL_DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
- HASURA_GRAPHQL_DEV_MODE=${HASURA_GRAPHQL_DEV_MODE}
- HASURA_GRAPHQL_ENABLE_CONSOLE=${HASURA_GRAPHQL_ENABLE_CONSOLE}
- HASURA_GRAPHQL_ENABLED_LOG_TYPES=${HASURA_GRAPHQL_ENABLED_LOG_TYPES}
- HASURA_GRAPHQL_ENABLE_TELEMETRY=${HASURA_GRAPHQL_ENABLE_TELEMETRY}
- HASURA_GRAPHQL_INSECURE_SKIP_TLS_VERIFY=${HASURA_GRAPHQL_INSECURE_SKIP_TLS_VERIFY}
- HASURA_GRAPHQL_LOG_LEVEL=${HASURA_GRAPHQL_LOG_LEVEL}
- HASURA_GRAPHQL_METADATA_DIR=${HASURA_GRAPHQL_METADATA_DIR}
- HASURA_GRAPHQL_MIGRATIONS_DIR=${HASURA_GRAPHQL_MIGRATIONS_DIR}
- HASURA_GRAPHQL_SERVER_PORT=${HASURA_GRAPHQL_SERVER_PORT}
- NO_PROXY=django
healthcheck:
test: curl --insecure --fail http://graphql_engine:8080/healthz || exit 1
interval: ${HEALTHCHECK_INTERVAL}
timeout: ${HEALTHCHECK_TIMEOUT}
retries: ${HEALTHCHECK_RETRIES}
start_period: ${HEALTHCHECK_START}