|
1 | | -## WORK IN PROGRESS |
2 | | - |
3 | | -2019-12-31 |
4 | | - |
5 | | -This README is from https://github.com/pascalandy/docker-stack-this/tree/master/traefik_stack5 |
6 | | - |
7 | | ---- |
8 | | - |
9 | | -## What is this? |
10 | | - |
11 | | -Using a **one-liner**, this docker stack will run many services (Traefik (with auth), Socat, Portainer, Nginx, Caddy, Whoami) in a straightforward copy-paste command. |
12 | | - |
13 | | -You may also refer the [README](https://github.com/pascalandy/docker-stack-this/blob/master/README.md) at the root of this repo. |
14 | | - |
15 | | -## Start here |
16 | | -1. Go to http://labs.play-with-docker.com/ |
17 | | -2. Create **one** instance |
18 | | -3. Copy-paste this one-liner: |
19 | | - |
20 | | -#### Stable setup (recommended) |
21 | | - |
22 | | -``` |
23 | | -ENV_BRANCH="master" |
24 | | -ENV_MONOREPO="traefik_stack6" |
25 | | -
|
26 | | -# On play-with-docker, install common apps |
27 | | -apk update && apk upgrade && apk add --no-cache \ |
28 | | - nano bash git curl wget unzip openssl tar ca-certificates && \ |
29 | | -rm -rf /var/cache/apk/* /tmp* && \ |
30 | | -docker swarm init --advertise-addr $(hostname -i) && \ |
31 | | -git clone https://github.com/pascalandy/docker-stack-this.git && \ |
32 | | -cd docker-stack-this && \ |
33 | | -git checkout ${ENV_BRANCH} && \ |
34 | | -cd ${ENV_MONOREPO} && \ |
35 | | -./runup.sh; |
36 | | -``` |
37 | | - |
38 | | -#### Edge setup (NOT recommended) |
39 | | - |
40 | | -``` |
41 | | -ENV_BRANCH="edge" |
42 | | -ENV_MONOREPO="traefik_stack6" |
43 | | -
|
44 | | -# On play-with-docker, install common apps |
45 | | -apk update && apk upgrade && apk add --no-cache \ |
46 | | - nano bash git curl wget unzip openssl tar ca-certificates && \ |
47 | | -rm -rf /var/cache/apk/* /tmp* && \ |
48 | | -docker swarm init --advertise-addr $(hostname -i) && \ |
49 | | -git clone https://github.com/pascalandy/docker-stack-this.git && \ |
50 | | -cd docker-stack-this && \ |
51 | | -git checkout ${ENV_BRANCH} && \ |
52 | | -cd ${ENV_MONOREPO} && \ |
53 | | -./runup.sh; |
54 | | -``` |
55 | | - |
56 | | -These scripts will do the hard of deploying the stacks for us. |
57 | | - |
58 | | -#### example |
59 | | - |
60 | | - |
61 | | - |
62 | | -## See your stacks |
63 | | - |
64 | | -``` |
65 | | -$ docker stack ls |
66 | | -
|
67 | | -NAME SERVICES ORCHESTRATOR |
68 | | -toolgui 2 Swarm |
69 | | -toolproxy 2 Swarm |
70 | | -toolwebapp 4 Swarm |
71 | | -``` |
72 | | - |
73 | | - |
74 | | -## See your services |
75 | | - |
76 | | -``` |
77 | | -$ docker service ls |
78 | | -
|
79 | | -ID NAME MODE REPLICAS IMAGE PORTS |
80 | | -xjdsq3gxd59y toolgui_agent global 1/1 portainer/agent:latest |
81 | | -0h375hmmnelo toolgui_portainer replicated 1/1 portainer/portainer:latest |
82 | | -xim07ahqctsp toolproxy_socat replicated 1/1 devmtl/socatproxy:1.2 |
83 | | -y249kaecel8e toolproxy_traefik replicated 1/1 traefik:1.7.12 *:80->80/tcp, *:443->443/tcp, *:8080->8080/tcp |
84 | | -s0061fdhvv6o toolwebapp_home replicated 1/1 abiosoft/caddy:1.0.1-no-stats |
85 | | -ocpk5l6yg2gt toolwebapp_who1 replicated 1/1 nginx:1.15-alpine |
86 | | -raq5czrlhrmb toolwebapp_who2 replicated 1/1 emilevauge/whoami:latest |
87 | | -66b1rduru5k9 toolwebapp_who3 replicated 1/1 emilevauge/whoami:latest |
88 | | -``` |
89 | | - |
90 | | -## Confirm that your services (containers) are running |
91 | | - |
92 | | -1. When you see that all services are deployed, click on `80` to see the static landing page. |
93 | | -2. From the same URL generated by play-with-docker, in the address bar of your browser, add `/who1` or `/who2` or `/who3` or `/portainer` to access other services. |
94 | | - |
95 | | - |
96 | | -#### Full URL example |
97 | | - |
98 | | -``` |
99 | | -http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/ |
100 | | -http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/who1 |
101 | | -http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/who2 |
102 | | -http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/who3 |
103 | | -http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/portainer |
104 | | -``` |
105 | | - |
106 | | -The container for the first URL is named `home`. |
107 | | - |
108 | | - |
109 | | -#### Web apps details: |
110 | | -- **/** = [caddy](https://github.com/pascalandy/caddy-securityheader) |
111 | | -- **/who1** = [caddy](https://github.com/pascalandy/caddy-securityheader) |
112 | | -- **/who2** = [whoami](https://hub.docker.com/r/emilevauge/whoami/) |
113 | | -- **/portainer** = [portainer](https://hub.docker.com/r/portainer/portainer/) |
114 | | - |
115 | | -For /who1 and /who2 you will see the container's Ids (5fe91baf7a3a & 78a0c7287df1) in this example |
116 | | - |
117 | | -``` |
118 | | -$ docker ps | grep whoami |
119 | | -5fe91baf7a3a emilevauge/whoami:latest "/whoamI" About a minute ago Up About a minute 80/tcp toolwebapp_who3.1.9zk09prm85gnl0ieuuncynhxh |
120 | | -78a0c7287df1 emilevauge/whoami:latest "/whoamI" About a minute ago Up About a minute 80/tcp toolwebapp_who2.1.wj7vf83ag91ft7jgdy3gwejp4 |
121 | | -``` |
122 | | - |
123 | | - |
124 | | -## How to access Traefik |
125 | | - |
126 | | - |
127 | | - |
128 | | - |
129 | | -#### Traefik password |
130 | | - |
131 | | -**user**: admin / **pass**: changethispass |
132 | | - |
133 | | -This password is encrypted in our configs `.configs/traefik.toml` |
134 | | - |
135 | | -To quickly generate yours with htpasswd, use my container: |
136 | | - |
137 | | -``` |
138 | | -docker run --rm -it devmtl/alpinefire:3.8-D sh -c 'htpasswd -Bbn admin changethispass' |
139 | | -``` |
140 | | - |
141 | | -This will display: |
142 | | - |
143 | | -``` |
144 | | -admin:$2y$05$pAfipn3.brdHMI2eWGnYH.84XYqLozp1sUPi36/l54UAwv.zGLtNC |
145 | | -``` |
146 | | - |
147 | | -Insert this string in your `.configs/traefik.toml`. |
148 | | - |
149 | | -#### What is Traefik? |
150 | | - |
151 | | -[Traefik](https://docs.traefik.io/configuration/backends/docker/) is a powerful layer 7 reverse proxy. Once running, the proxy will give you access to many web apps. I think this is a substantial use case to understand how this reverse-proxy works. |
152 | | - |
153 | | -#### Traefik version |
154 | | - |
155 | | -In `toolproxy.yml` look for something like `traefik:1.7.19`. |
156 | | - |
157 | | -#### Other stuff to know? |
158 | | - |
159 | | -- This stack does not use ACME (https://). ACME is a pain while developing … reaching limits, etc. |
160 | | -- If you don’t want to use socat, check out the monorepo `traefik-manager-noacme` |
161 | | - |
162 | | -## Screenshots |
163 | | - |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | | - |
169 | | - |
170 | | - |
171 | | - |
172 | | - |
173 | | -## All commands |
174 | | -In the active path, just execute those bash-scripts: |
175 | | - |
176 | | -- `./runup.sh` |
177 | | -- `./rundown.sh` |
178 | | - |
179 | | -**Bonus!** `./runctop.sh` is not a stack but a simple `docker run` to see the memory consumed by each container. |
| 1 | +Based on `traefik_stack5`. It adds the ability to generate certificates using ACME by https://letsencrypt.org/. |
180 | 2 |
|
| 3 | +You must understand how `traefik_stack5` runs. Then, it will be easy for you to run `traefik_stack6` on your own infra. I didn't test this on play-with-docker as ACME as rate limits. |
0 commit comments