forked from comses/comses.net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdc-staging.yml
154 lines (153 loc) · 4.2 KB
/
dc-staging.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
version: '3'
services:
redis:
image: redis:6-alpine
restart: always
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
networks:
- cms
volumes:
- ./deploy/conf/redis.conf:/usr/local/etc/redis/redis.conf
- ./docker/shared/redis:/data
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION}
restart: always
networks:
- esnet
environment:
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
deploy:
resources:
limits:
memory: 1g
cap_add:
- IPC_LOCK
volumes:
- ./deploy/elasticsearch.conf.d/log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties
- ./deploy/elasticsearch.conf.d/elasticsearch-primary.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- esdata1:/usr/share/elasticsearch/data
# FIXME: duplication bad
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION}
restart: always
networks:
- esnet
environment:
- bootstrap.memory_lock=true
- node.name=esnode2
- discovery.seed_hosts=elasticsearch
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
deploy:
resources:
limits:
memory: 1g
cap_add:
- IPC_LOCK
volumes:
- ./deploy/elasticsearch.conf.d/elasticsearch-node.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- ./deploy/elasticsearch.conf.d/log4j2.properties:/usr/share/elasticsearch/config/log4j2.properties
- esdata2:/usr/share/elasticsearch/data
${DB_HOST}:
image: postgis/postgis:10-3.1
restart: always
networks:
- db
volumes:
- ./docker/shared/pgdata:/var/lib/postgresql/data
environment:
# autofilled by ./build.sh envsubst
# FIXME: replace with init sql script, see https://github.com/docker/docker/issues/13490
POSTGRES_USER: "${DB_USER}"
POSTGRES_PASSWORD: "${DB_PASSWORD}"
POSTGRES_DB: "${DB_NAME}"
js:
# FIXME: currently needs a second Django `./manage.py collectstatic` to move generated assets from Django into
# static directory, seems we should be able to skip that step
build: frontend
image: comses/cmsjs:${RELEASE_VERSION}
command: ['yarn', 'build']
environment:
NODE_ENV: "staging"
volumes:
- ./frontend/src:/code/src
- ./frontend/yarn.lock:/code/yarn.lock
- ./docker/shared:/shared
- ./deploy/conf/config.ini:/secrets/config.ini
nginx:
image: nginx:stable
restart: always
volumes:
- ./deploy/nginx/nginx-staging.conf:/etc/nginx/nginx.conf
- ./deploy/nginx/uwsgi_params:/etc/nginx/uwsgi_params
- ./deploy/nginx/well-known:/srv/.well-known
- ./docker/shared/logs/nginx:/var/log/nginx
- ./docker/shared/static:/srv/static
- ./docker/shared/media:/srv/media
- ./docker/shared/library:/library
- sockets:/shared/sockets
command: ["nginx", "-g", "daemon off;"]
networks:
- cms
ports:
- "80:80"
depends_on:
- cms
cms:
build:
context: ./django
args:
REQUIREMENTS_FILE: requirements-dev.txt
UBUNTU_MIRROR: "Compute.clouds.archive.ubuntu.com"
RUN_SCRIPT: "./deploy/prod.sh"
image: comses/cms:${RELEASE_VERSION}
restart: always
networks:
- cms
- esnet
- db
volumes:
- ./deploy/conf/config.ini:/secrets/config.ini
- ./deploy/elasticsearch.conf.d:/etc/elasticsearch
- ./docker/shared:/shared
- sockets:/shared/sockets
environment:
DJANGO_SETTINGS_MODULE: "core.settings.staging"
DB_USER: ${DB_USER}
DB_HOST: ${DB_HOST}
DB_NAME: ${DB_NAME}
DB_PORT: ${DB_PORT}
ports:
- "127.0.0.1:9191:9191" # uWSGI stats server
depends_on:
- ${DB_HOST}
- elasticsearch
- redis
networks:
esnet:
driver: bridge
cms:
driver: bridge
db:
driver: bridge
volumes:
sockets:
driver: local
esdata1:
driver: local
esdata2:
driver: local