forked from lucaslorentz/caddy-docker-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
distributed.yaml
106 lines (96 loc) · 2.45 KB
/
distributed.yaml
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
version: '3.7'
services:
caddy_server:
image: lucaslorentz/caddy-docker-proxy:ci-alpine
ports:
- 80:80
- 443:443
networks:
- caddy_controller
- caddy
environment:
- CADDY_DOCKER_MODE=server
- CADDY_CONTROLLER_NETWORK=10.200.200.0/24
volumes:
# this volume is needed to keep the certificates
# otherwise, new ones will be re-issued upon restart
- caddy_data:/data
deploy:
replicas: 3
labels:
caddy_controlled_server:
caddy_controller:
image: lucaslorentz/caddy-docker-proxy:ci-alpine
networks:
- caddy_controller
- caddy
environment:
- CADDY_DOCKER_MODE=controller
- CADDY_CONTROLLER_NETWORK=10.200.200.0/24
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# Proxy to service
whoami0:
image: jwilder/whoami
networks:
- caddy
deploy:
labels:
caddy: whoami0.example.com
caddy.reverse_proxy: "{{upstreams 8000}}"
# remove the following line when you have verified your setup
# Otherwise you risk being rate limited by let's encrypt
caddy.tls.ca: https://acme-staging-v02.api.letsencrypt.org/directory
# Proxy to service
whoami1:
image: jwilder/whoami
networks:
- caddy
deploy:
labels:
caddy: whoami1.example.com
caddy.reverse_proxy: "{{upstreams 8000}}"
caddy.tls: "internal"
# Proxy to container
whoami2:
image: jwilder/whoami
networks:
- caddy
labels:
caddy: whoami2.example.com
caddy.reverse_proxy: "{{upstreams 8000}}"
caddy.tls: "internal"
# Proxy to container
whoami3:
image: jwilder/whoami
networks:
- caddy
labels:
caddy: whoami3.example.com
caddy.reverse_proxy: "{{upstreams 8000}}"
caddy.tls: "internal"
# Proxy with matches and route
echo_0:
image: brndnmtthws/nginx-echo-headers
networks:
- caddy
deploy:
labels:
caddy: echo0.example.com
[email protected]: "/sourcepath /sourcepath/*"
caddy.route: "@match"
caddy.route.0_uri: "strip_prefix /sourcepath"
caddy.route.1_rewrite: "* /targetpath{path}"
caddy.route.2_reverse_proxy: "{{upstreams 8080}}"
caddy.tls: "internal"
networks:
caddy:
driver: overlay
caddy_controller:
driver: overlay
ipam:
driver: default
config:
- subnet: "10.200.200.0/24"
volumes:
caddy_data: {}