-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
81 lines (75 loc) · 2.05 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
services:
mongodb:
image: mongo:latest
container_name: mongodb
restart: always
env_file: .env
environment:
- MONGO_INITDB_ROOT_USERNAME=$MONGO_ROOT_USERNAME
- MONGO_INITDB_ROOT_PASSWORD=$MONGO_ROOT_PASSWORD
- MONGO_INITDB_DATABASE=$MONGO_DB
- MONGO_USERNAME=$MONGO_USERNAME
- MONGO_PASSWORD=$MONGO_PASSWORD
- MONGO_HOSTNAME=$MONGO_HOSTNAME
- MONGO_PORT=$MONGO_PORT
- MONGO_DB=$MONGO_DB
ports:
- "27017:27017"
volumes:
- mongodb:/data/db
- ./mongodb/init.sh:/docker-entrypoint-initdb.d/init.sh:ro
networks:
- iwa-api
app:
image: iwa-api:latest
container_name: iwa-api
restart: always
env_file: .env
environment:
- NODE_ENV=production
- MONGO_USERNAME=$MONGO_USERNAME
- MONGO_PASSWORD=$MONGO_PASSWORD
- MONGO_HOSTNAME=$MONGO_HOSTNAME
- MONGO_PORT=$MONGO_PORT
- MONGO_DB=$MONGO_DB
- WAIT_HOSTS=$MONGO_HOSTNAME:$MONGO_PORT
- WAIT_TIMEOUT=300
- WAIT_SLEEP_INTERVAL=30
- WAIT_HOST_CONNECT_TIMEOUT=30
ports:
- "3000:3000"
volumes:
- iwa-api:/home/node/app
networks:
- iwa-api
command: sh -c "/wait && cd /home/node/app && node mongodb/populateDb.js && node index.js"
nginx:
image: nginx:1.15-alpine
container_name: nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./data/nginx:/etc/nginx/conf.d
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
networks:
- iwa-api
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
container_name: certbot
restart: always
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
networks:
- iwa-api
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
networks:
iwa-api:
driver: bridge
volumes:
mongodb:
iwa-api: