-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
137 lines (137 loc) · 3.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
version: '3.7'
x-images:
env: &env {env_file: [.env, docker.env]}
django: &django
<<: [ *env ]
tty: true
depends_on:
- db
- redis
- setup-postgres
working_dir: /code/src
command:
- sh
- '-c'
- >-
:
&& dockerize -wait http://setup-postgres -timeout $${POSTGRES_STARTUP_TIMEOUT}
&& /bin/bash /code/init/init.sh
volumes:
- ./crontab:/etc/cron.d/django
- ./src/project/settings/instances:/code/src/project/settings/instances
- mediafiles:/code/public/media
- statics:/code/public/static
- logs:/logs/
services:
mailcatcher:
<<: [ *env ]
image: corpusops/mailhog
hostname: mailcatcher
volumes: ["mails:/mails"]
environment:
MH_STORAGE: maildir
MH_MAILDIR_PATH: /mails
MH_SMTP_BIND_ADDR: 0.0.0.0:1025
MH_API_BIND_ADDR: 0.0.0.0:8025
MH_UI_BIND_ADDR: 0.0.0.0:8025
MH_UI_WEB_PATH: /mailcatcher
MH_AUTH_FILE: /home/mailhog/pw
user: root
entrypoint:
- sh
- '-c'
- >
chown mailhog /mails
&& pw=$$(MH_AUTH_FILE="" MailHog bcrypt "$${MAILCATCHER_PASSWORD:-mailcatcher}")
&& echo "$${MAILCATCHER_USER:-mailcatcher}:$$pw" > $$MH_AUTH_FILE
&& su mailhog -p -c MailHog
redis:
<<: [ *env ]
image: "corpusops/redis:4.0-alpine"
hostname: redis
volumes:
- 'redis:/data'
db:
<<: [ *env ]
image: "corpusops/pgrouting:10.1-2.5.4"
volumes:
- postgresql:/var/lib/postgresql/data
nginx:
<<: [ *env ]
restart: always
image: "corpusops/nginx:1.14-alpine"
depends_on:
- django
volumes:
- ./prod/etc/nginx/vhost.conf.template:/etc/nginx/conf.d/default.conf.template
- mediafiles:/public/media/:ro
- statics:/public/static/
- logs:/logs/
- certs:/certs/
command: >
/bin/sh -c "
v=/etc/nginx/conf.d/default.conf
&& frep --overwrite $$v.template:$$v
&& exec /bin/supervisord.sh"
environment:
- SUPERVISORD_CONFIGS=/etc/supervisor.d/cron /etc/supervisor.d/nginx /etc/supervisor.d/rsyslog
django:
<<: [ *django ]
cron:
<<: [ *django ]
command:
- sh
- '-c'
- >-
:
&& dockerize -wait http://setup-postgres -timeout $${POSTGRES_STARTUP_TIMEOUT}
&& /bin/bash /code/init/cron.sh
depends_on:
- django
backup:
<<: [ *env ]
environment: {POSTGRES_HOST: db}
image: "corpusops/dbsmartbackup:${DSB_VERSION:-pgrouting-10-2.5-2.6}"
restart: always
volumes:
- backupdb-dumps:/var/db_smart_backup/
- backupdb-logs:/var/db_smart_backup/logs/
# commented; not removed to mlake diff with terrralego easier
# convertit:
# <<: [ *env ]
# image: makinacorpus/convertit
# hostname: convertit
setup-postgres:
<<: [ *env ]
image: corpusops/pgrouting:10.1-2.5.4
depends_on:
- db
entrypoint:
- /bin/sh
- '-c'
- |-
set -ex
POSTGRES_STARTUP_TIMEOUT=$${POSTGRES_STARTUP_TIMEOUT:-45s}
flag=/started_$$(echo $$POSTGRES_DB|sed -re "s![/:]!__!g")
if [ -e "$$flag" ];then rm -f "$$flag";fi
echo "Try connection to pgsql: $$POSTGRES_DB & wait for db init" >&2 \
&& ( while true;do if ( \
echo "select 1 from spatial_ref_sys limit 1;select postgis_version();"\
| psql -v ON_ERROR_STOP=1 \
"postgres://$$POSTGRES_USER:$$POSTGRES_PASSWORD@$$POSTGRES_HOST/$$POSTGRES_DB"\
);then touch $$flag && break;fi;done )&
set -x \
&& dockerize -wait file://$$flag -timeout $${POSTGRES_STARTUP_TIMEOUT} \
&& while true;do printf "HTTP/1.1 200 OK\n\nstarted"| ( nc -l -p 80 || /bin/true);done
volumes:
backupdb-logs:
backupdb-dumps:
postgresql:
redis:
mediafiles:
statics:
name: "${DJANGO_NAME}back-statics"
external: false
logs:
mails:
certs: