Skip to content

Commit 2c6129c

Browse files
committed
define sensitive vars
Signed-off-by: Pascal Andy <pascal@firepress.org>
1 parent 9b72b9a commit 2c6129c

File tree

2 files changed

+148
-3
lines changed

2 files changed

+148
-3
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
version: '3.7'
2+
3+
x-default-opts:
4+
&default-opts
5+
logging:
6+
options:
7+
max-size: "10m"
8+
9+
networks:
10+
ntw_front:
11+
external: true
12+
ntw_proxy:
13+
external: true
14+
15+
services:
16+
17+
# this custom haproxy allows us to move traefik to worker nodes (if needed)
18+
# while this container listens on managers and only allows
19+
# traefik to connect, read-only, to limited docker api calls
20+
# https://github.com/Tecnativa/docker-socket-proxy
21+
# image: devmtl/proxysocket:1.9.10 (with wget for heathcheck)
22+
# image: tecnativa/docker-socket-proxy
23+
proxysocket:
24+
<<: *default-opts
25+
image: devmtl/proxysocket:1.9.13
26+
networks:
27+
- ntw_proxy
28+
volumes:
29+
- /var/run/docker.sock:/var/run/docker.sock
30+
environment:
31+
# specific to 'docker stack deploy'
32+
NETWORKS: 1
33+
SERVICES: 1
34+
TASKS: 1
35+
SWARM: 1
36+
deploy:
37+
mode: global
38+
placement:
39+
constraints: [node.role == manager]
40+
restart_policy:
41+
condition: on-failure
42+
resources:
43+
limits:
44+
cpus: '0.20'
45+
memory: 8M
46+
reservations:
47+
cpus: '0.10'
48+
memory: 4M
49+
50+
# Traefik reverse proxy has a bunch of features:
51+
# - reverse proxy all 80/443 ingress traffic on a swarm
52+
# - dynamic config via each app's swarm service labels
53+
# - HA multi-container design for traefik
54+
# - runs traefik on host NIC directly, to improve performance
55+
# and capture client IP's
56+
#
57+
#- --debug=true
58+
#
59+
# OPTION A) Select STAGING or PROD letsencrypt server
60+
# https://acme-v02.api.letsencrypt.org/directory
61+
# https://acme-staging-v02.api.letsencrypt.org/directory
62+
#
63+
# OPTION B)
64+
#- --entryPoints=Name:http Address::80 # don't force HTTPS
65+
#- --entryPoints=Name:http Address::80 Redirect.EntryPoint:https # force HTTPS
66+
#
67+
# If not using proxysocket
68+
#- --docker.endpoint=unix:///var/run/docker.sock
69+
traefik:
70+
<<: *default-opts
71+
image: traefik:1.7.26-alpine
72+
ports:
73+
- target: 80
74+
protocol: tcp
75+
published: 80
76+
mode: ingress
77+
- target: 443
78+
protocol: tcp
79+
published: 443
80+
mode: ingress
81+
- target: 8080
82+
protocol: tcp
83+
published: 8080
84+
mode: ingress
85+
networks:
86+
- ntw_front
87+
- ntw_proxy
88+
environment:
89+
DO_AUTH_TOKEN: ${do_auth_token}
90+
volumes:
91+
- ${PATH_ACME_JSON_FILE}/acme.json:/etc/traefik/acme/acme.json
92+
command:
93+
- --docker
94+
- --docker.domain=traefik
95+
- --docker.swarmMode
96+
- --docker.watch
97+
- --docker.exposedbydefault=false
98+
- --docker.endpoint=tcp://proxysocket:2375
99+
- --entryPoints=Name:http Address::80 Redirect.EntryPoint:https
100+
- --entryPoints=Name:https Address::443 TLS
101+
- --defaultentrypoints=http,https
102+
- --acme
103+
- --acme.email=${ACME_EMAIL}
104+
- --acme.dnsChallenge
105+
- --acme.dnsChallenge.provider=digitalocean
106+
- --acme.domains=*.${MAIN_DOMAIN},${MAIN_DOMAIN}
107+
- --acme.entryPoint=https
108+
- --acme.onhostrule=true
109+
- --acme.storage=/etc/traefik/acme/acme.json
110+
- --acme.caserver=https://acme-v02.api.letsencrypt.org/directory
111+
- --acme.acmelogging=true
112+
- --logLevel=INFO
113+
- --api=true
114+
deploy:
115+
mode: replicated
116+
replicas: 1
117+
update_config:
118+
delay: 2s
119+
placement:
120+
constraints: [node.labels.nodeid==1]
121+
restart_policy:
122+
condition: on-failure
123+
max_attempts: 20
124+
resources:
125+
limits:
126+
cpus: '0.33'
127+
memory: 96M
128+
reservations:
129+
cpus: '0.05'
130+
memory: 48M
131+
labels:
132+
- traefik.frontend.rule=Host:${DASHBOARD_DOMAIN}
133+
- traefik.docker.network=ntw_front
134+
- traefik.enable=true
135+
- traefik.port=8080
136+
137+
# https://github.com/pascalandy/docker-stack-this, inspired by https://github.com/BretFisher/dogvscat
138+
139+
140+
141+
142+
143+
144+
145+

traefik_stack6/stack-proxy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ services:
8888
environment:
8989
DO_AUTH_TOKEN: ${do_auth_token}
9090
volumes:
91-
- /mnt/DeployGRP/tooldata/traefik/traefik_stack6/acme.json:/etc/traefik/acme/acme.json
91+
- ${PATH_ACME_JSON_FILE}/acme.json:/etc/traefik/acme/acme.json
9292
command:
9393
- --docker
9494
- --docker.domain=traefik
@@ -100,7 +100,7 @@ services:
100100
- --entryPoints=Name:https Address::443 TLS
101101
- --defaultentrypoints=http,https
102102
- --acme
103-
- --acme.email=relations@firepress.org
103+
- --acme.email=${ACME_EMAIL}
104104
- --acme.httpchallenge
105105
- --acme.httpchallenge.entrypoint=http
106106
- --acme.entryPoint=https
@@ -128,7 +128,7 @@ services:
128128
cpus: '0.05'
129129
memory: 48M
130130
labels:
131-
- traefik.frontend.rule=Host:traefik.firepress.link
131+
- traefik.frontend.rule=Host:${DASHBOARD_DOMAIN}
132132
- traefik.docker.network=ntw_front
133133
- traefik.enable=true
134134
- traefik.port=8080

0 commit comments

Comments
 (0)