-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
125 lines (117 loc) · 3.76 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
---
version: "3.3"
networks:
internal-network:
internal: true
external-network:
volumes:
postgres_data:
static_volume:
services:
postgres:
image: postgres:13-alpine
container_name: postgres
environment:
- POSTGRES_DB=juntagrico
- POSTGRES_USER=juntagrico
- POSTGRES_PASSWORD=juntagrico
volumes:
- postgres_data:/var/lib/postgresql/data/
networks:
internal-network:
traefik:
image: traefik:v2.4
container_name: traefik
command:
- --api=true
- --api.dashboard=true
- --api.insecure=true
- --entrypoints.http.address=:80
- --ping=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
ports:
- 80:80
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
traefik.enable: true
traefik.http.routers.api-http.entryPoints: http
traefik.http.routers.api-http.rule: ((Host(`localhost`) && PathPrefix(`/api`)) || (Host(`localhost`) && PathPrefix(`/dashboard`)))
traefik.http.routers.api-http.service: api@internal
networks:
external-network:
internal-network:
depends_on:
- juntagrico
- nginx
nginx:
image: nginx:1.19-alpine
container_name: nginx
environment:
NGINX_CONFIG: |
server {
listen 8001;
location / {
alias /home/app/web/static/;
}
}
command:
- /bin/sh
- -c
- |
echo "$$NGINX_CONFIG" > /etc/nginx/conf.d/default.conf
sed -e "s/error_log.*/error_log\ \/dev\/null\ crit;/g" -e "s/access_log.*/access_log\ \/dev\/null;/g" -i /etc/nginx/nginx.conf
nginx -g "daemon off;"
volumes:
- static_volume:/home/app/web/static
labels:
traefik.enable: true
traefik.http.middlewares.web-compress.compress: true
traefik.http.middlewares.web-stripprefix.stripprefix.prefixes: /static
traefik.http.routers.web-http.entrypoints: http
traefik.http.routers.web-http.middlewares: web-compress@docker,web-stripprefix@docker
traefik.http.routers.web-http.rule: (Host(`localhost`) && PathPrefix(`/static`))
traefik.http.services.web-http.loadbalancer.server.port: 8001
networks:
internal-network:
expose:
- 8001
depends_on:
- juntagrico
juntagrico:
image: rotebeete/juntagrico
container_name: juntagrico
environment:
DJANGO_SUPERUSER_USERNAME: "juntagrico"
DJANGO_SUPERUSER_PASSWORD: "juntagrico"
DJANGO_SUPERUSER_EMAIL: "[email protected]"
JUNTAGRICO_DATABASE_BACKEND: django.db.backends.postgresql
JUNTAGRICO_DATABASE_NAME: juntagrico
JUNTAGRICO_DATABASE_USER: juntagrico
JUNTAGRICO_DATABASE_PASS: juntagrico
JUNTAGRICO_DATABASE_HOST: postgres
JUNTAGRICO_SECRET_KEY: "please-change-me-for-production"
# JUNTAGRICO_WHITELIST_EMAILS is a safe-guard that is enabled in debug
# mode. When debug mode is enabled, only mails matching the given whitelist
# will be sent.
# For day to day development, we use the console backend and allow all mail
# to be sent.
# Mail can be seen in the logs of the juntagrico container, use
# `docker-compose logs -f juntagrico` to trail them.
JUNTAGRICO_EMAIL_BACKEND: django.core.mail.backends.console.EmailBackend
JUNTAGRICO_WHITELIST_EMAILS: ".*"
labels:
traefik.enable: true
traefik.http.routers.app-http.entrypoints: http
traefik.http.routers.app-http.rule: (Host(`localhost`) && PathPrefix(`/`))
traefik.http.services.app-http.loadbalancer.server.port: 8000
volumes:
- static_volume:/home/app/web/static
networks:
internal-network:
expose:
- 8000
depends_on:
- postgres