-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-swarm-traefik.yml
87 lines (80 loc) · 2.79 KB
/
docker-swarm-traefik.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
version: "3.8" # https://docs.docker.com/compose/compose-file/compose-file-v3/
services:
caddy:
image: caddy:latest
# https://hub.docker.com/_/caddy
volumes:
- snipeit_public:/var/www/snipeit/public
- caddy_data:/data
networks:
- web
- traefik
configs:
- source: snipe-it-caddyfile
target: /etc/caddy/Caddyfile
environment:
# https://caddyserver.com/docs/automatic-https#overview
- DOMAIN=:80
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.snipeit.entrypoints=websecure"
- "traefik.http.routers.snipeit.rule=Host(`snipeit.yourdomain.test`)"
- "traefik.http.services.snipeit.loadbalancer.server.port=80" # Port traefik needs to route traffic to
snipeit:
image: zeigren/snipe-it:latest # ghcr.io/zeigren/snipe-it-docker:latest
# https://hub.docker.com/r/zeigren/snipe-it
volumes: # https://docs.docker.com/compose/compose-file/compose-file-v3/#volumes
- snipeit:/var/www/snipeit/storage
- snipeit_public:/var/www/snipeit/public
secrets: # https://docs.docker.com/compose/compose-file/compose-file-v3/#secrets
- snipeit_sql_password
- snipeit_app_key
networks: # https://docs.docker.com/compose/compose-file/compose-file-v3/#networks
- web
- db
- redis
environment: # https://docs.docker.com/compose/compose-file/compose-file-v3/#environment
- DB_PASSWORD=DOCKER-SECRET->snipeit_sql_password
- APP_URL=https://snipeit.yourdomain.test
- COOKIE_DOMAIN=snipeit.yourdomain.test
# Run first without APP_KEY to have the container create one
# - APP_KEY=DOCKER-SECRET->snipeit_app_key
mariadb:
image: mariadb:latest
# https://hub.docker.com/_/mariadb
volumes:
- snipeit_db:/var/lib/mysql
secrets:
- snipeit_sql_password
networks:
- db
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/snipeit_sql_password
- MYSQL_PASSWORD_FILE=/run/secrets/snipeit_sql_password
- MYSQL_USER=snipeit
- MYSQL_DATABASE=snipeit
redis:
image: redis:alpine
# https://hub.docker.com/_/redis
networks:
- redis
volumes: # https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
snipeit:
snipeit_db:
snipeit_public:
caddy_data:
configs: # https://docs.docker.com/compose/compose-file/compose-file-v3/#configs-configuration-reference
snipe-it-caddyfile:
external: true
secrets: # https://docs.docker.com/compose/compose-file/compose-file-v3/#secrets-configuration-reference
snipeit_sql_password:
external: true
snipeit_app_key:
external: true
networks: # https://docs.docker.com/compose/compose-file/compose-file-v3/#network-configuration-reference
web:
db:
redis:
traefik:
external: true