-
Notifications
You must be signed in to change notification settings - Fork 8
/
docker-compose.yml
198 lines (183 loc) · 7.77 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
version: "3.9"
x-defaults: &defaults
user: ${UID}:${GID}
x-env-defaults: &env-defaults
http_proxy: ${HTTP_PROXY:-}
https_proxy: ${HTTPS_PROXY:-}
x-geonature-depends-on-defaults: &geonature-depends-on-defaults
redis:
condition: service_healthy
postgres:
condition: service_healthy
x-geonature-backend-env: &geonature-backend-env
<<: *env-defaults
GEONATURE_SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT:-5432}/${POSTGRES_DB}
GEONATURE_URL_APPLICATION: ${GEONATURE_FRONTEND_PROTOCOL}://${GEONATURE_FRONTEND_HOSTPORT}${GEONATURE_FRONTEND_PREFIX}
GEONATURE_API_ENDPOINT: ${GEONATURE_BACKEND_PROTOCOL}://${GEONATURE_BACKEND_HOSTPORT}${GEONATURE_BACKEND_PREFIX}
GEONATURE_API_TAXHUB: ${TAXHUB_PROTOCOL}://${TAXHUB_HOSTPORT}${TAXHUB_API_PREFIX}
GEONATURE_CONFIG_FILE: ${GEONATURE_CONFIG_FILE:-/dist/config/geonature_config.toml}
GEONATURE_CELERY__broker_url: ${GEONATURE_CELERY__broker_url:-redis://redis}
GEONATURE_CELERY__result_backend: ${GEONATURE_CELERY__result_backend:-redis://redis}
x-geonature-backend-defaults: &geonature-backend-defaults
<<: *defaults
image: ${GEONATURE_BACKEND_EXTRA_IMAGE}
depends_on:
<<: *geonature-depends-on-defaults
volumes:
- ./config/geonature:/dist/config
- ./data/geonature/media:${GEONATURE_MEDIA_FOLDER:-/dist/media}
- ./data/geonature/custom:${GEONATURE_CUSTOM_STATIC_FOLDER:-/dist/custom}
environment:
<<: *geonature-backend-env
services:
traefik:
image: traefik:2.10.4
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entryPoints.web.address=:80"
- "--entryPoints.web.http.redirections.entrypoint.to=:${HTTPS_PORT}"
- "--entryPoints.web.http.redirections.entrypoint.scheme=https"
- "--entryPoints.websecure.address=:443"
- "--certificatesResolvers.acme-resolver.acme.email=${ACME_EMAIL}"
- "--certificatesResolvers.acme-resolver.acme.storage=/etc/traefik/certs/acme.json"
- "--certificatesResolvers.acme-resolver.acme.tlsChallenge=true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./config/traefik:/etc/traefik/dynamic
- ./data/traefik/certs:/etc/traefik/certs
ports:
- ${HTTP_PORT:-80}:80
- ${HTTPS_PORT:-443}:443
redis:
image: ${REDIS_IMAGE:-redis:7-alpine}
volumes:
- redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
postgres:
image: ${POSTGRES_IMAGE:-postgis/postgis:15-3.4}
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
volumes:
- ./assets/postgres/initdb:/docker-entrypoint-initdb.d/
- postgres:/var/lib/postgresql/data
healthcheck:
# during db init, postgres is not listening on localhost so this avoid false healthy status
test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB}", "-U", "${POSTGRES_USER}", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
usershub:
<<: *defaults
image: ${USERSHUB_IMAGE}
depends_on:
postgres:
condition: service_healthy
geonature-install-db:
condition: service_completed_successfully
volumes:
- ./config/usershub:/dist/config/
environment:
<<: *env-defaults
USERSHUB_URL_APPLICATION: "${USERSHUB_PROTOCOL}://${USERSHUB_HOSTPORT}${USERSHUB_PREFIX}"
USERSHUB_SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT:-5432}/${POSTGRES_DB}
USERSHUB_SETTINGS: ${USERSHUB_SETTINGS:-/dist/config/config.py}
USERSHUB_ACTIVATE_APP: ${USERSHUB_ACTIVATE_APP:-true}
USERSHUB_ACTIVATE_API: ${USERSHUB_ACTIVATE_API:-true}
USERSHUB_COOKIE_EXPIRATION: ${USERSHUB_COOKIE_EXPIRATION:-3600}
USERSHUB_FILL_MD5_PASS: ${USERSHUB_FILL_MD5_PASS:-false}
labels:
- "traefik.enable=true"
- "traefik.http.routers.usershub.rule=Host(`${USERSHUB_HOST}`) && PathPrefix(`${USERSHUB_PREFIX}`)"
- "traefik.http.routers.usershub.entrypoints=websecure"
- "traefik.http.routers.usershub.tls.certResolver=acme-resolver"
taxhub:
<<: *defaults
image: ${TAXHUB_IMAGE}
depends_on:
postgres:
condition: service_healthy
geonature-install-db:
condition: service_completed_successfully
volumes:
- ./config/taxhub:/dist/config
- ./data/taxhub/medias:${TAXHUB_STATIC_FOLDER:-/dist/static}/medias
environment:
<<: *env-defaults
TAXHUB_APPLICATION_ROOT: "${TAXHUB_PREFIX}"
TAXHUB_SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT:-5432}/${POSTGRES_DB}
TAXHUB_SETTINGS: ${TAXHUB_SETTINGS:-/dist/config/config.py}
TAXHUB_UPLOAD_FOLDER: "medias"
TAXHUB_SQLALCHEMY_TRACK_MODIFICATIONS: False
TAXHUB_COOKIE_EXPIRATION: 3600
TAXHUB_PASS_METHOD: "hash"
labels:
- "traefik.enable=true"
- "traefik.http.routers.taxhub.rule=Host(`${TAXHUB_HOST}`) && PathPrefix(`${TAXHUB_PREFIX}`)"
- "traefik.http.routers.taxhub.entrypoints=websecure"
- "traefik.http.routers.taxhub.tls.certResolver=acme-resolver"
geonature-install-db:
<<: *geonature-backend-defaults
command: "geonature permissions supergrant --yes ${GEONATURE_SUPERGRANT_ARGS:---help}"
environment:
<<: *geonature-backend-env
srid_local: ${GEONATURE_DB_LOCAL_SRID}
add_sample_data: ${GEONATURE_DB_ADD_SAMPLE_DATA:-false}
install_bdc_statuts: ${GEONATURE_DB_INSTALL_BDC_STATUTS:-true}
install_sig_layers: ${GEONATURE_DB_INSTALL_SIG_LAYERS:-true}
install_grid_layer: ${GEONATURE_DB_INSTALL_GRID_LAYER:-true}
install_ref_sensitivity: ${GEONATURE_DB_INSTALL_REF_SENSITIVITY:-true}
usershub: ${GEONATURE_DB_INSTALL_USERSHUB:-true}
usershub_samples: ${GEONATURE_DB_INSTALL_USERSHUB_SAMPLES:-true}
taxhub: ${GEONATURE_DB_INSTALL_TAXHUB:-true}
taxhub_samples: ${GEONATURE_DB_INSTALL_TAXHUB_SAMPLES:-true}
geonature-worker:
<<: *geonature-backend-defaults
depends_on:
<<: *geonature-depends-on-defaults
geonature-install-db:
condition: service_completed_successfully
entrypoint: []
command: celery -A geonature.celery_app:app worker --beat --schedule-filename=/dist/media/celerybeat-schedule.db
geonature-backend:
<<: *geonature-backend-defaults
depends_on:
<<: *geonature-depends-on-defaults
geonature-install-db:
condition: service_completed_successfully
entrypoint: []
command:
- "gunicorn"
- "geonature:create_app()"
- "--name=geonature"
- "--workers=2"
- "--threads=2"
- "--access-logfile=-"
- "--bind=0.0.0.0:8000"
- "--reload"
- "--reload-extra-file=${GEONATURE_CONFIG_FILE:-/dist/config/geonature_config.toml}"
labels:
- "traefik.enable=true"
- "traefik.http.routers.geonature-backend.rule=Host(`${GEONATURE_BACKEND_HOST}`) && PathPrefix(`${GEONATURE_BACKEND_PREFIX}`)"
- "traefik.http.routers.geonature-backend.entrypoints=websecure"
- "traefik.http.routers.geonature-backend.tls.certResolver=acme-resolver"
geonature-frontend:
image: ${GEONATURE_FRONTEND_EXTRA_IMAGE}
environment:
- NGINX_LOCATION=${GEONATURE_FRONTEND_PREFIX}
- API_ENDPOINT="${GEONATURE_BACKEND_PROTOCOL}://${GEONATURE_BACKEND_HOSTPORT}${GEONATURE_BACKEND_PREFIX}"
labels:
- "traefik.enable=true"
- "traefik.http.routers.geonature.rule=Host(`${GEONATURE_FRONTEND_HOST}`) && PathPrefix(`${GEONATURE_FRONTEND_PREFIX}`)"
- "traefik.http.routers.geonature.entrypoints=websecure"
- "traefik.http.routers.geonature.tls.certResolver=acme-resolver"
volumes:
redis:
postgres: