forked from tldr-devops/startpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-swarm.yml
167 lines (161 loc) · 4.38 KB
/
setup-swarm.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
version: '3.8'
x-service: &service
logging:
driver: json-file
options:
max-size: "100m"
max-file: "2"
restart: always
services:
# https://doc.traefik.io/traefik/getting-started/quick-start/
# https://dockerswarm.rocks/traefik/
traefik:
container_name: traefik
image: traefik:v2.6
ports:
- 80:80
- 443:443
deploy:
resources:
reservations:
cpus: '0.01'
memory: 50M
mode: replicated
replicas: 1
placement:
constraints:
- node.hostname == ${HOSTNAME?Variable HOSTNAME not set}
labels:
- traefik.enable=true
- traefik.docker.network=monitoring
- traefik.http.middlewares.admin-auth.basicauth.users=${USERNAME?Variable USERNAME not set}:${HASHED_PASSWORD?Variable HASHED_PASSWORD not set}
- traefik.http.middlewares.https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https-redirect.redirectscheme.permanent=true
- traefik.http.routers.traefik-api-http.rule=Host(`traefik.${DOMAIN?Variable DOMAIN not set}`)
- traefik.http.routers.traefik-api-http.entrypoints=http
- traefik.http.routers.traefik-api-http.service=api@internal
#- traefik.http.routers.traefik-api-http.middlewares=https-redirect
- traefik.http.routers.traefik-api-http.middlewares=admin-auth
- traefik.http.routers.traefik-api-https.rule=Host(`traefik.${DOMAIN?Variable DOMAIN not set}`)
- traefik.http.routers.traefik-api-https.entrypoints=https
- traefik.http.routers.traefik-api-https.tls=true
- traefik.http.routers.traefik-api-https.service=api@internal
- traefik.http.routers.traefik-api-https.tls.certresolver=le
- traefik.http.routers.traefik-api-https.middlewares=admin-auth
- traefik.http.services.traefik.loadbalancer.server.port=8080
<<: *service
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- traefik-certs:/certificates
command:
- --providers.docker
- --providers.docker.exposedbydefault=false
- --providers.docker.swarmmode
- --providers.docker.defaultRule=Host(`{{ .Name }}.${DOMAIN?Variable DOMAIN not set}`)
- --entrypoints.http.address=:80
- --entrypoints.https.address=:443
- --certificatesresolvers.le.acme.email=${EMAIL?Variable EMAIL not set}
- --certificatesresolvers.le.acme.storage=/certificates/acme.json
- --certificatesresolvers.le.acme.tlschallenge=true
- --accesslog
- --log
- --api
- --api.dashboard=true
- --ping=true
- --ping.entryPoint=ping
- --entryPoints.ping.address=:8081
- --metrics.prometheus=true
- --entryPoints.metrics.address=:8082
- --metrics.prometheus.entryPoint=metrics
- --serverstransport.insecureskipverify=true
healthcheck:
test: ["CMD", "wget", "-c", "http://localhost:8081/ping"]
interval: 1s
timeout: 1s
retries: 10
start_period: 2s
networks:
- database
- monitoring
- bitwarden
- gitlab
- registry
- minio
- nocodb
- openproject
- portainer
- strapi
- appwrite
- taiga
- rocketchat
- vaultwarden
- twake
- tuleap
- nextcloud
x-volume: &volume
driver: local
x-volume-driver-opts: &volume-driver-opts
type: none
o: bind
volumes:
traefik-certs:
name: traefik-certs
<<: *volume
driver_opts:
<<: *volume-driver-opts
device: ${DATAPATH?Variable DATAPATH not set}/traefik/certificates
x-network: &network
driver: overlay
attachable: true
networks:
monitoring:
name: monitoring
<<: *network
bitwarden:
name: bitwarden
<<: *network
gitlab:
name: gitlab
<<: *network
registry:
name: registry
<<: *network
minio:
name: minio
<<: *network
database:
name: database
<<: *network
nocodb:
name: nocodb
<<: *network
openproject:
name: openproject
<<: *network
portainer:
name: portainer
<<: *network
strapi:
name: strapi
<<: *network
appwrite:
name: appwrite
<<: *network
taiga:
name: taiga
<<: *network
rocketchat:
name: rocketchat
<<: *network
vaultwarden:
name: vaultwarden
<<: *network
twake:
name: twake
<<: *network
tuleap:
name: tuleap
<<: *network
nextcloud:
name: nextcloud
<<: *network