Skip to content

Commit 953c10b

Browse files
committed
PLUTON-19054 | add docker-compose base
1 parent 51b19fd commit 953c10b

20 files changed

+333
-165
lines changed

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,18 @@ COPY ./vaas/requirements /home/app/vaas/requirements
3131

3232
RUN pip install -r ./requirements/base.txt
3333

34+
#copy uwsgi config
35+
COPY ./docker/uwsgi.cfg /etc/
36+
37+
#copy mime types used by uwsgi
38+
COPY ./docker/mime.types /etc/
39+
3440
# copy project
3541
COPY ./vaas /home/app/vaas
3642

3743
# copy entrypoints.sh
3844
COPY \
45+
docker/entrypoint-uwsgi.sh \
3946
docker/entrypoint-uwsgi-dev.sh \
4047
docker/entrypoint-celery-worker.sh \
4148
docker/entrypoint-celery-routes-test.sh \

docker-compose.dev.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
services:
2+
celery-worker:
3+
entrypoint: [ '/entrypoint-celery-worker.sh' ]
4+
env_file: ./envs/dev.env
5+
volumes:
6+
- ./vaas:/home/app/vaas
7+
- ./plugins:/home/app/plugins
8+
networks:
9+
- vaas
10+
- default
11+
celery-cron-worker:
12+
entrypoint: [ '/entrypoint-celery-cron-worker.sh' ]
13+
env_file: ./envs/dev.env
14+
volumes:
15+
- ./vaas:/home/app/vaas
16+
- ./plugins:/home/app/plugins
17+
networks:
18+
- vaas
19+
- default
20+
celery-routes-test:
21+
entrypoint: [ '/entrypoint-celery-routes-test.sh' ]
22+
env_file: ./envs/dev.env
23+
volumes:
24+
- ./vaas:/home/app/vaas
25+
- ./plugins:/home/app/plugins
26+
networks:
27+
- vaas
28+
- default
29+
uwsgi:
30+
entrypoint: ['/wait-for-it.sh', 'mysql:3306', '-t', '30', '--', '/entrypoint-uwsgi-dev.sh' ]
31+
env_file: ./envs/dev.env
32+
volumes:
33+
- ./vaas:/home/app/vaas
34+
- ./plugins:/home/app/plugins
35+
networks:
36+
- vaas
37+
- default
38+
celery-scheduler:
39+
entrypoint: ['/wait-for-it.sh', 'uwsgi:3030', '-t', '60', '--', '/entrypoint-celery-scheduler.sh' ]
40+
env_file: ./envs/dev.env
41+
volumes:
42+
- ./vaas:/home/app/vaas
43+
- ./plugins:/home/app/plugins
44+
networks:
45+
- vaas
46+
- default
47+
48+
# Varnishes & nginx
49+
nginx-0:
50+
build: ./docker/nginx
51+
image: vaas-nginx
52+
expose:
53+
- "80"
54+
networks:
55+
vaas:
56+
ipv4_address: 192.168.199.10
57+
nginx-1:
58+
build: ./docker/nginx
59+
image: vaas-nginx
60+
expose:
61+
- "80"
62+
networks:
63+
vaas:
64+
ipv4_address: 192.168.199.11
65+
nginx-2:
66+
build: ./docker/nginx
67+
image: vaas-nginx
68+
expose:
69+
- "80"
70+
networks:
71+
vaas:
72+
ipv4_address: 192.168.199.12
73+
nginx-3:
74+
build: ./docker/nginx
75+
image: vaas-nginx
76+
expose:
77+
- "80"
78+
networks:
79+
vaas:
80+
ipv4_address: 192.168.199.13
81+
nginx-4:
82+
build: ./docker/nginx
83+
image: vaas-nginx
84+
expose:
85+
- "80"
86+
networks:
87+
vaas:
88+
ipv4_address: 192.168.199.14
89+
nginx-5:
90+
build: ./docker/nginx
91+
image: vaas-nginx
92+
expose:
93+
- "80"
94+
networks:
95+
vaas:
96+
ipv4_address: 192.168.199.15
97+
varnish-4.1:
98+
build: ./docker/varnish-4.1
99+
image: allegro/vaas-varnish-4.1
100+
expose:
101+
- "6082"
102+
- "6081"
103+
networks:
104+
vaas:
105+
ipv4_address: 192.168.199.4
106+
varnish-6.0.2:
107+
build: ./docker/varnish-6.0.2
108+
image: allegro/vaas-varnish-6.0.2
109+
expose:
110+
- "6082"
111+
- "6081"
112+
networks:
113+
vaas:
114+
ipv4_address: 192.168.199.6
115+
varnish-7.0:
116+
build: ./docker/varnish-7.0
117+
image: allegro/vaas-varnish-7.0
118+
expose:
119+
- "6082"
120+
- "6081"
121+
networks:
122+
vaas:
123+
ipv4_address: 192.168.199.7
124+
networks:
125+
vaas:
126+
driver: bridge
127+
ipam:
128+
driver: default
129+
config:
130+
- subnet: 192.168.199.0/24
131+
gateway: 192.168.199.1

docker-compose.override.yml

Lines changed: 6 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,41 @@
11
services:
22
celery-worker:
33
entrypoint: [ '/entrypoint-celery-worker.sh' ]
4-
env_file: ./envs/dev.env
4+
env_file: ./envs/base.env
55
volumes:
66
- ./vaas:/home/app/vaas
77
- ./plugins:/home/app/plugins
88
networks:
9-
- vaas
109
- default
1110
celery-cron-worker:
1211
entrypoint: [ '/entrypoint-celery-cron-worker.sh' ]
13-
env_file: ./envs/dev.env
12+
env_file: ./envs/base.env
1413
volumes:
1514
- ./vaas:/home/app/vaas
1615
- ./plugins:/home/app/plugins
1716
networks:
18-
- vaas
1917
- default
2018
celery-routes-test:
2119
entrypoint: [ '/entrypoint-celery-routes-test.sh' ]
22-
env_file: ./envs/dev.env
20+
env_file: ./envs/base.env
2321
volumes:
2422
- ./vaas:/home/app/vaas
2523
- ./plugins:/home/app/plugins
2624
networks:
27-
- vaas
2825
- default
2926
uwsgi:
30-
entrypoint: ['/wait-for-it.sh', 'mysql:3306', '-t', '30', '--', '/entrypoint-uwsgi-dev.sh' ]
31-
env_file: ./envs/dev.env
27+
entrypoint: ['/wait-for-it.sh', 'mysql:3306', '-t', '30', '--', '/entrypoint-uwsgi.sh' ]
28+
env_file: ./envs/base.env
3229
volumes:
3330
- ./vaas:/home/app/vaas
3431
- ./plugins:/home/app/plugins
3532
networks:
36-
- vaas
3733
- default
3834
celery-scheduler:
3935
entrypoint: ['/wait-for-it.sh', 'uwsgi:3030', '-t', '60', '--', '/entrypoint-celery-scheduler.sh' ]
40-
env_file: ./envs/dev.env
36+
env_file: ./envs/base.env
4137
volumes:
4238
- ./vaas:/home/app/vaas
4339
- ./plugins:/home/app/plugins
4440
networks:
45-
- vaas
4641
- default
47-
48-
# Varnishes & nginx
49-
nginx-0:
50-
build: ./docker/nginx
51-
image: vaas-nginx
52-
expose:
53-
- "80"
54-
networks:
55-
vaas:
56-
ipv4_address: 192.168.199.10
57-
nginx-1:
58-
build: ./docker/nginx
59-
image: vaas-nginx
60-
expose:
61-
- "80"
62-
networks:
63-
vaas:
64-
ipv4_address: 192.168.199.11
65-
nginx-2:
66-
build: ./docker/nginx
67-
image: vaas-nginx
68-
expose:
69-
- "80"
70-
networks:
71-
vaas:
72-
ipv4_address: 192.168.199.12
73-
nginx-3:
74-
build: ./docker/nginx
75-
image: vaas-nginx
76-
expose:
77-
- "80"
78-
networks:
79-
vaas:
80-
ipv4_address: 192.168.199.13
81-
nginx-4:
82-
build: ./docker/nginx
83-
image: vaas-nginx
84-
expose:
85-
- "80"
86-
networks:
87-
vaas:
88-
ipv4_address: 192.168.199.14
89-
nginx-5:
90-
build: ./docker/nginx
91-
image: vaas-nginx
92-
expose:
93-
- "80"
94-
networks:
95-
vaas:
96-
ipv4_address: 192.168.199.15
97-
varnish-4.1:
98-
build: ./docker/varnish-4.1
99-
image: allegro/vaas-varnish-4.1
100-
expose:
101-
- "6082"
102-
- "6081"
103-
networks:
104-
vaas:
105-
ipv4_address: 192.168.199.4
106-
varnish-6.0.2:
107-
build: ./docker/varnish-6.0.2
108-
image: allegro/vaas-varnish-6.0.2
109-
expose:
110-
- "6082"
111-
- "6081"
112-
networks:
113-
vaas:
114-
ipv4_address: 192.168.199.6
115-
varnish-7.0:
116-
build: ./docker/varnish-7.0
117-
image: allegro/vaas-varnish-7.0
118-
expose:
119-
- "6082"
120-
- "6081"
121-
networks:
122-
vaas:
123-
ipv4_address: 192.168.199.7
124-
networks:
125-
vaas:
126-
driver: bridge
127-
ipam:
128-
driver: default
129-
config:
130-
- subnet: 192.168.199.0/24
131-
gateway: 192.168.199.1

docker/entrypoint-celery-cron-worker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
exec celery --workdir=/home/app/vaas \
44
-A vaas.settings worker \
5-
--loglevel=DEBUG \
5+
--loglevel=$LOG_LEVEL \
66
--concurrency=1 \
77
-Q cron_queue

docker/entrypoint-celery-routes-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
exec celery --workdir=/home/app/vaas \
44
-A vaas.settings worker \
5-
--loglevel=DEBUG \
5+
--loglevel=$LOG_LEVEL \
66
--concurrency=1 \
77
-Q routes_test_queue

docker/entrypoint-celery-scheduler.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ echo "Migrating Scheduler"
22

33
exec celery --workdir=/home/app/vaas \
44
--app=vaas.settings beat \
5-
--loglevel=DEBUG \
5+
--loglevel=$LOG_LEVEL \
66
--scheduler=beatx.schedulers.Scheduler

docker/entrypoint-celery-worker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
exec celery --workdir=/home/app/vaas \
44
-A vaas.settings worker \
5-
--loglevel=DEBUG \
5+
--loglevel=$LOG_LEVEL \
66
--concurrency=1 \
77
-Q worker_queue

docker/entrypoint-uwsgi-dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ echo "Migrating"
77
python /home/app/vaas/manage.py migrate --run-syncdb
88

99
echo "Loading test_data"
10-
python /home/app/vaas/manage.py loaddata ./vaas/resources/data.yaml
10+
python /home/app/vaas/manage.py loaddata ./vaas/resources/dev-data.yaml
1111

1212
echo "Install the test requirements to allow [manage.py test] to be called within the container"
1313
pip install -r /home/app/vaas/requirements/test.txt

docker/entrypoint-uwsgi.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Collect static files"
4+
python /home/app/vaas/manage.py collectstatic --no-input
5+
6+
echo "Migrating"
7+
python /home/app/vaas/manage.py migrate --run-syncdb
8+
9+
echo "Loading base-data"
10+
python /home/app/vaas/manage.py loaddata ./vaas/resources/base-data.yaml
11+
12+
echo "Install the test requirements to allow [manage.py test] to be called within the container"
13+
pip install -r /home/app/vaas/requirements/base.txt
14+
15+
echo "Start uwsgi server"
16+
exec uwsgi --ini /etc/uwsgi.cfg --http-socket :3030

0 commit comments

Comments
 (0)