-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
75 lines (69 loc) · 1.79 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
version: '3.9'
services:
reverse-proxy:
image: traefik:v2.8
restart: unless-stopped
container_name: traefik
networks:
- webssh
ports:
- 80:80
- 443:443
volumes:
- ./traefik.yml:/etc/traefik/traefik.yml:ro
- ./acme.json:/acme.json:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./tr-config:/etc/traefik/config
db:
image: postgres
container_name: db
environment:
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD
volumes:
- pg-data:/var/lib/postgresql/data
networks:
- webssh
redis:
image: redis
container_name: redis
volumes:
- redis-data:/usr/local/etc/redis
networks:
- webssh
app:
build: .
environment:
- DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@db/$POSTGRES_DB
- REDIS_URL=redis://redis:6379
- RAILS_MASTER_KEY
labels:
- traefik.enable=true
- traefik.http.routers.app-http.entrypoints=web
- traefik.http.routers.app-http.rule=Host(`icoder.tw`)
- traefik.http.routers.app-https.entrypoints=websecure
- traefik.http.routers.app-https.rule=Host(`icoder.tw`)
- traefik.http.routers.app-http.middlewares=https-only@file
- traefik.http.routers.app-https.tls=true
- traefik.http.routers.app-https.tls.certresolver=letencrypt
- traefik.http.routers.app-https.service=app
- traefik.http.services.app.loadbalancer.server.port=3000
- traefik.docker.network=webssh
networks:
- webssh
volumes:
- .:/app
- /home/docker/id_key:/root/.ssh/
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- db
- redis
volumes:
pg-data:
external: true
redis-data:
external: true
networks:
webssh:
external: true