-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.local-dev.yml
211 lines (198 loc) · 6.17 KB
/
docker-compose.local-dev.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
199
200
201
202
203
204
205
206
207
208
209
210
211
volumes:
fake-cluster-scratch:
fake-archive-storage:
services:
db:
ports:
# postgres accessible on the host at 5433 for debugging
- "5433:5432"
django:
image: laxy:dev
build:
context: .
dockerfile: ./docker/laxy/Dockerfile
environment:
- LAXY_DEBUG=yes
- LAXY_SSL=no
- LAXY_DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
- LAXY_BROKER_URL=amqp://guest@rabbitmq
- LAXY_ADMIN_EMAIL=admin@example.com
- LAXY_ADMIN_USERNAME=admin
- LAXY_ADMIN_PASSWORD=adminpass
- LAXY_SECRET_KEY=_do_please_change_this_in_production_
- DEBUGGER_PORT=21004
volumes:
- .:/app
# Django app is publicly accessible without reverse proxy
ports:
- "8001:8001"
# Debugger port
- "21004:21004"
logging:
driver: "json-file"
options:
max-size: "10k"
max-file: "1"
depends_on:
- db
command: bash -c "sleep 10 &&
pip3 install -U ptvsd &&
python3 manage.py migrate --no-input --run-syncdb &&
python3 manage.py migrate --no-input &&
python3 manage.py makemigrations --no-input &&
python3 manage.py migrate --no-input &&
python3 manage.py shell -c \"from os import environ as env; from django.contrib.auth import get_user_model; username = env.get('LAXY_ADMIN_USERNAME', 'admin'); User = get_user_model(); User.objects.filter(username=username).count() or User.objects.create_superuser(username, env.get('LAXY_ADMIN_EMAIL', None), env.get('LAXY_ADMIN_PASSWORD', None));\" &&
python3 manage.py loaddata --app laxy_backend /app/docker/fake-cluster/fixtures.json &&
LAXY_FRONTEND_API_URL=http://`hostname`:8001 python3 manage.py runserver 0.0.0.0:8001"
# Examine the logs to find the token to login to the Jupyter notebook
# (eg docker-compose logs -f docker-compose.yml -f docker-compose.dev.yml shell-notebook )
shell-notebook:
image: laxy:dev
build:
context: .
dockerfile: ./docker/laxy/Dockerfile
environment:
- LAXY_DEBUG=yes
- LAXY_SSL=no
- LAXY_DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
- LAXY_BROKER_URL=amqp://guest@rabbitmq
- LAXY_ADMIN_EMAIL=admin@example.com
- LAXY_ADMIN_USERNAME=admin
- LAXY_ADMIN_PASSWORD=adminpass
- LAXY_SECRET_KEY=_do_please_change_this_in_production_
- LAXY_SENTRY_DSN=
volumes:
- .:/app
ports:
- "8999:8999"
logging:
driver: "json-file"
options:
max-size: "10k"
max-file: "1"
depends_on:
- db
command: bash -c "sleep 10 &&
pip3 install jupyter ipython ipykernel django-extensions &&
python3 manage.py shell_plus --notebook"
# This is npm + webpack, automatically rebuilding upon changes and serving on port 8002.
# The source code directory on your host is mounted inside the container, so changes
# you make will trigger automatic rebuilds (via webpack --watch).
# If you prefer to run npm yourself outside a container, comment this out and run
# "npm install && npm run server" manually.
dev-frontend-server:
image: node:10-buster
working_dir: /app
environment:
- LAXY_DEBUG=yes
- LAXY_SSL=no
volumes:
- .:/app
# Frontend webpack-dev-server publicly accessible on port 8002
ports:
- "8002:8002"
logging:
driver: "json-file"
options:
max-size: "10k"
max-file: "1"
restart: "unless-stopped"
command: bash -c "cd /app/laxy_frontend &&
npm install &&
npm run server"
depends_on:
- django
# NOTE: You may need to change the default Docker container memory to 4Gb when using
# this container, since `conda create` often exceeds 2Gb of RAM
# Running with the docker-compose --compatibility flag should allow the
# 'deploy.resources.limits.memory' setting in this service to be honoured.
#
# We use port 2222 for OpenSSH so we can easily expose it to the host for debugging
# without a port clash with the host SSH server.
fake-cluster:
image: fake-cluster:latest
build:
context: ./docker/fake-cluster
volumes:
# - ./.fake-cluster-scratch:/scratch
# We use a volume here since on OSX conda seems to have issues with host directory mounts
- fake-cluster-scratch:/scratch
ports:
- "2222:2222"
logging:
driver: "json-file"
options:
max-size: "10k"
max-file: "1"
restart: "unless-stopped"
depends_on:
- django
deploy:
resources:
limits:
memory: "4000M"
fake-archival-host:
image: fake-cluster:latest
build:
context: ./docker/fake-cluster
volumes:
# - ./.fake-cluster-scratch:/scratch
# We use a volume here since on OSX conda seems to have issues with host directory mounts
- fake-archive-storage:/archive
ports:
- "2223:2222"
logging:
driver: "json-file"
options:
max-size: "10k"
max-file: "1"
restart: "unless-stopped"
depends_on:
- django
splash:
image: scrapinghub/splash:latest
command: --disable-lua --disable-browser-caches --max-timeout 300
ports:
- "8050:8050"
depends_on:
- django
# - queue-high
##
# Disabled services not required for simple local dev, overridden from base docker-compose.yml
##
# For simple local development, we run in Django debug mode (LAXY_DEBUG=yes) with CELERY_ALWAYS_EAGER=True
# so that celery tasks run non-async in the Django process. We don't need the celery daemon in this case.
queue-high:
image: alpine
entrypoint:
- /bin/echo
command: "Service disabled"
restart: "no"
queue-low:
image: alpine
entrypoint:
- /bin/echo
command: "Service disabled"
restart: "no"
celery-beat:
image: alpine
entrypoint:
- /bin/echo
command: "Service disabled"
restart: "no"
# We don't need flower if we aren't using celeryd
flower:
image: alpine
entrypoint:
- /bin/echo
command: "Service disabled"
restart: "no"
nginx:
image: alpine
entrypoint:
- /bin/echo
command: "Service disabled"
restart: "no"
ports:
# dev
- "9999:80"