forked from presstofan/python-app-docker-swarm-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstapp.yml
37 lines (35 loc) · 1.73 KB
/
stapp.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
version: '3.3'
services:
stapp:
image: shawkins/lou-reporting
# The labels section is where you specify configuration values for Traefik.
# Docker labels don’t do anything by themselves, but Traefik reads these so
# it knows how to treat containers.
ports:
- 8501
networks:
- traefik-public
deploy:
replicas: 1
restart_policy:
condition: on-failure
# placement:
# constraints:
# - node.role==manager
labels:
- traefik.enable=true # enable traefik
- traefik.docker.network=traefik-public # put it in the same network as traefik
- traefik.constraint-label=traefik-public # assign the same label as traefik so it can be discovered
- traefik.http.routers.stapp.rule=Host(`${APP_DOMAIN?Variable not set}`) # listen to port 80 for request to APP_DOMAIN (use together with the line below)
- traefik.http.routers.stapp.entrypoints=http
- traefik.http.middlewares.stapp.redirectscheme.scheme=https # redirect traffic to https
- traefik.http.middlewares.stapp.redirectscheme.permanent=true # redirect traffic to https
- traefik.http.routers.stapp-secured.rule=Host(`${APP_DOMAIN?Variable not set}`) # listen to port 443 for request to APP_DOMAIN (use together with the line below)
- traefik.http.routers.stapp-secured.entrypoints=https
- traefik.http.routers.stapp-secured.tls.certresolver=le # use the Let's Encrypt certificate we set up earlier
- traefik.http.services.stapp-secured.loadbalancer.server.port=8501 # ask Traefik to search for port 8501 of the stapp service container
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
traefik-public:
external: true