-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
192 lines (181 loc) · 5 KB
/
docker-compose.dev.yml
File metadata and controls
192 lines (181 loc) · 5 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
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
version: "3.9"
services:
static-files:
# nginx config
image: nginx
volumes:
- ./static:/usr/share/nginx/html/static:ro
- ./default.conf:/etc/nginx/conf.d/default.conf
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.static-files-insecure.compress=true"
- "traefik.http.routers.static-files-insecure.rule=Host(`localhost`) && PathPrefix(`/static`)"
- "traefik.http.routers.static-files-insecure.entrypoints=web"
depends_on:
- traefik
frontend:
build:
context: ./frontend/
dockerfile: ./Dockerfile_dev
command: bash -c "
gunicorn frontend.main:app -w 2 -b 0.0.0.0:8001 --reload --reload-extra-file /frontend/templates
"
ports:
- "8001:8001"
volumes:
- ./frontend:/frontend
env_file:
- .env.development
depends_on:
- traefik
- static-files
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend-insecure.rule=Host(`localhost`) && PathPrefix(`/frontend`)"
- "traefik.http.routers.frontend-insecure.entrypoints=web"
- "traefik.http.middlewares.frontend-sp.stripprefix.prefixes=/frontend"
- "traefik.http.middlewares.frontend-sp.stripprefix.forceSlash=false"
- "traefik.http.routers.frontend-insecure.middlewares=frontend-sp"
restart: on-failure
api:
build:
context: ./api/
dockerfile: ./Dockerfile_dev
command: bash -c "
while !</dev/tcp/db/5432; do sleep 1; done;
alembic -c /api/alembic.ini upgrade head;
uvicorn api.wsgi:app
--workers 2
--host 0.0.0.0
--reload --root-path /api/v1
"
ports:
- "8000:8000"
volumes:
- ./api:/api
depends_on:
- db
- traefik
env_file:
- .env.development
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`host.docker.internal`) && PathPrefix(`/api/v1`)"
- "traefik.http.routers.api.entrypoints=web"
- "traefik.http.routers.api.middlewares=api-sp"
- "traefik.http.middlewares.api-sp.stripprefix.prefixes=/api/v1"
- "traefik.http.middlewares.api-sp.stripprefix.forceSlash=false"
- "traefik.http.routers.apilh.rule=Host(`localhost`) && PathPrefix(`/api/v1`)"
- "traefik.http.routers.apilh.entrypoints=web"
- "traefik.http.routers.apilh.middlewares=api-sp"
restart: on-failure
traefik:
image: "traefik:v2.9"
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
db:
env_file:
- .env.development
image: postgis/postgis
volumes:
- postgis-data:/var/lib/postgresql
environment:
# If you need to create multiple database you can add coma separated databases eg gis,data
- ALLOW_IP_RANGE=0.0.0.0/0
# Add extensions you need to be enabled by default in the DB. Default are the five specified below
- POSTGRES_MULTIPLE_EXTENSIONS=postgis,hstore,postgis_topology,postgis_raster,pgrouting
- TZ=America/Denver
- PGTZ=America/Denver
ports:
- "5432:5432"
restart: on-failure
healthcheck:
test: "exit 0"
pgbackups:
image: prodrigestivill/postgres-backup-local
restart: always
volumes:
- ./pgbackups:/backups
links:
- db
depends_on:
- db
env_file:
- .env.development
environment:
- POSTGRES_EXTRA_OPTS=-Z6 --schema=public --blobs
- SCHEDULE=@daily
- BACKUP_KEEP_DAYS=7
- BACKUP_KEEP_WEEKS=4
- BACKUP_KEEP_MONTHS=6
- HEALTHCHECK_PORT=8080
# pgadmin:
# container_name: pgadmin4_container
# image: dpage/pgadmin4
# restart: always
# environment:
# PGADMIN_DEFAULT_EMAIL: admin@admin.com
# PGADMIN_DEFAULT_PASSWORD: root
# ports:
# - "5050:80"
redis:
image: redis:6-alpine
worker:
build:
context: ./api
dockerfile: Dockerfile_celery
hostname: worker
# command: celery -A worker celery_app.veg
entrypoint: celery
command: -A api.celery_app.veg worker --loglevel=info
volumes:
- ./api:/api
links:
- redis
depends_on:
- redis
env_file:
- .env.development
# celery_beat:
# build:
# context: ./beat
## dockerfile: ./compose/local/flask/Dockerfile
## image: flask_celery_example_celery_beat
# command: /start-celerybeat
# volumes:
# - .:/app
# env_file:
# - .env.development
# environment:
# - FLASK_APP=app
# depends_on:
# - redis
# - db
#
# flower:
# build:
# context: ./flower
## dockerfile: ./compose/local/flask/Dockerfile
## image: flask_celery_example_celery_flower
# command: /start-flower
# volumes:
# - .:/app
# env_file:
# - .env.development
# environment:
# - FLASK_APP=app
# ports:
# - 5557:5555
# depends_on:
# - redis
# - db
volumes:
postgis-data: