Skip to content

Commit 36cba80

Browse files
committed
reset traefik_stack6 directory
1 parent b3d7e3c commit 36cba80

File tree

14 files changed

+229
-426
lines changed

14 files changed

+229
-426
lines changed

traefik_stack6/README.md

100755100644
Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,94 +2,95 @@
22

33
This docker stack will run many services (Traefik (with auth), Socat, Portainer, Nginx, Caddy, Whoami) in a straightforward copy-paste command. Please also refer the [README](https://github.com/pascalandy/docker-stack-this/blob/master/README.md) at the root of this repo.
44

5-
## What news since `traefik_stack5`
6-
7-
wip
8-
95
## Start here
10-
116
1. Go to http://labs.play-with-docker.com/
12-
2. Create *a cluster* using the the one click tool
13-
14-
![launch-a-cluster](https://user-images.githubusercontent.com/6694151/62176506-cd320700-b30f-11e9-818d-07bd43ea78ec.gif)
7+
2. Create **one** instance
8+
3. Copy-paste:
159

16-
3. On one of the manager node, copy-paste:
17-
18-
#### stable branch (recommended)
10+
#### Stable setup (recommended)
1911

2012
```
21-
ENV_BRANCH="master";
22-
ENV_MONOREPO="traefik_stack6";
23-
24-
echo "Setup the stack" && \
25-
source <(curl -s https://raw.githubusercontent.com/pascalandy/docker-stack-this/${ENV_BRANCH}/${ENV_MONOREPO}/play-with-docker-setup.sh) && \
26-
sleep 2 && \
27-
git checkout ${ENV_BRANCH} && \
28-
cd ${ENV_MONOREPO} && \
13+
ENV_BRANCH="master"
14+
ENV_MONOREPO="traefik_stack5"
15+
16+
# On play-with-docker, install common apps
17+
apk update && apk upgrade && apk add --no-cache \
18+
nano bash git curl wget unzip openssl tar ca-certificates && \
19+
rm -rf /var/cache/apk/* /tmp* && \
20+
docker swarm init --advertise-addr $(hostname -i) && \
21+
git clone https://github.com/pascalandy/docker-stack-this.git && \
22+
cd docker-stack-this && \
23+
git checkout ${ENV_BRANCH} && \
24+
cd ${ENV_MONOREPO} && \
2925
./runup.sh;
3026
```
3127

32-
#### edge branch (NOT recommended)
28+
#### Edge setup (NOT recommended)
3329

3430
```
35-
ENV_BRANCH="edge";
36-
ENV_MONOREPO="traefik_stack6";
37-
38-
echo "Setup the stack" && \
39-
source <(curl -s https://raw.githubusercontent.com/pascalandy/docker-stack-this/${ENV_BRANCH}/${ENV_MONOREPO}/play-with-docker-setup.sh) && \
40-
sleep 2 && \
41-
git checkout ${ENV_BRANCH} && \
42-
cd ${ENV_MONOREPO} && \
31+
ENV_BRANCH="edge"
32+
ENV_MONOREPO="traefik_stack5"
33+
34+
# On play-with-docker, install common apps
35+
apk update && apk upgrade && apk add --no-cache \
36+
nano bash git curl wget unzip openssl tar ca-certificates && \
37+
rm -rf /var/cache/apk/* /tmp* && \
38+
docker swarm init --advertise-addr $(hostname -i) && \
39+
git clone https://github.com/pascalandy/docker-stack-this.git && \
40+
cd docker-stack-this && \
41+
git checkout ${ENV_BRANCH} && \
42+
cd ${ENV_MONOREPO} && \
4343
./runup.sh;
4444
```
4545

46-
This will run `play-with-docker-setup.sh` and `runup.sh`. These scripts will do the hard of deploying the stacks for us.
46+
These scripts will do the hard of deploying the stacks for us.
47+
48+
#### example
4749

48-
#### See your stacks
50+
![2019-08-01_16h56](https://user-images.githubusercontent.com/6694151/62326965-5ca8f880-b47d-11e9-9416-2139d514fc64.gif)
51+
52+
## See your stacks
4953

5054
```
51-
docker stack ls
55+
$ docker stack ls
5256
5357
NAME SERVICES ORCHESTRATOR
54-
toolconsul 2 Swarm
5558
toolgui 2 Swarm
5659
toolproxy 2 Swarm
5760
toolwebapp 4 Swarm
5861
```
5962

6063

61-
#### See your services
64+
## See your services
6265

6366
```
64-
docker service ls
65-
66-
ID NAME MODE REPLICAS IMAGE PORTS
67-
ruapy5e7ru6u toolconsul_consul-leader replicated 1/1 consul:1.5
68-
hvc4ssxz5rme toolconsul_consul-replica replicated 3/3 consul:1.5
69-
t4e2094q5v6o toolgui_agent global 5/5 portainer/agent:latest
70-
ywnm2dm6cx8s toolgui_portainer replicated 1/1 portainer/portainer:latest
71-
rtljih72vls4 toolproxy_socat replicated 3/3 devmtl/socatproxy:1.2
72-
nu1d14ysu6c3 toolproxy_traefik replicated 3/3 traefik:1.7.12 *:80->80/tcp, *: 443->443/tcp, *:8080->8080/tcp
73-
cbov3qbzn3xo toolwebapp_home replicated 3/3 abiosoft/caddy:0.11.1-no-stats
74-
zfnnpl4iql80 toolwebapp_who1 replicated 3/3 nginx:1.15-alpine
75-
h5dn0jmk9he1 toolwebapp_who2 replicated 1/1 emilevauge/whoami:latest
76-
1nztlij8emje toolwebapp_who3 replicated 1/1 emilevauge/whoami:latest
67+
$ docker service ls
68+
69+
ID NAME MODE REPLICAS IMAGE PORTS
70+
xjdsq3gxd59y toolgui_agent global 1/1 portainer/agent:latest
71+
0h375hmmnelo toolgui_portainer replicated 1/1 portainer/portainer:latest
72+
xim07ahqctsp toolproxy_socat replicated 1/1 devmtl/socatproxy:1.2
73+
y249kaecel8e toolproxy_traefik replicated 1/1 traefik:1.7.12 *:80->80/tcp, *:443->443/tcp, *:8080->8080/tcp
74+
s0061fdhvv6o toolwebapp_home replicated 1/1 abiosoft/caddy:1.0.1-no-stats
75+
ocpk5l6yg2gt toolwebapp_who1 replicated 1/1 nginx:1.15-alpine
76+
raq5czrlhrmb toolwebapp_who2 replicated 1/1 emilevauge/whoami:latest
77+
66b1rduru5k9 toolwebapp_who3 replicated 1/1 emilevauge/whoami:latest
7778
```
7879

7980
## Confirm that your services (containers) are running
8081

8182
1. When you see that all services are deployed, click on `80` to see the static landing page.
82-
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.
83+
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.
8384

8485

8586
#### Full URL example
8687

8788
```
88-
http://ip172-18-0-3-bl0dq2l35dvg00f09hcg-80.direct.labs.play-with-docker.com/
89-
http://ip172-18-0-3-bl0dq2l35dvg00f09hcg-80.direct.labs.play-with-docker.com/who1/
90-
http://ip172-18-0-3-bl0dq2l35dvg00f09hcg-80.direct.labs.play-with-docker.com/who2/
91-
http://ip172-18-0-3-bl0dq2l35dvg00f09hcg-80.direct.labs.play-with-docker.com/who3/
92-
http://ip172-18-0-3-bl0dq2l35dvg00f09hcg-80.direct.labs.play-with-docker.com/portainer/
89+
http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/
90+
http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/who1
91+
http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/who2
92+
http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/who3
93+
http://pwd10-0-7-3-80.host1.labs.play-with-docker.com/portainer
9394
```
9495

9596
The container for the first URL is named `home`.
@@ -99,14 +100,14 @@ The container for the first URL is named `home`.
99100
- **/** = [caddy](https://github.com/pascalandy/caddy-securityheader)
100101
- **/who1** = [caddy](https://github.com/pascalandy/caddy-securityheader)
101102
- **/who2** = [whoami](https://hub.docker.com/r/emilevauge/whoami/)
102-
- **/portainer/** = [portainer](https://hub.docker.com/r/portainer/portainer/)
103+
- **/portainer** = [portainer](https://hub.docker.com/r/portainer/portainer/)
103104

104105
For /who1 and /who2 you will see the container's Ids (5fe91baf7a3a & 78a0c7287df1) in this example
105106

106107
```
107108
$ docker ps | grep whoami
108-
4114379237a9 emilevauge/whoami:latest "/whoamI" 8 minutes ago Up 8 minutes 80/tcp
109-
toolwebapp_who3.1.qq6cpdk9mw5j3ngspzm53xhqd
109+
5fe91baf7a3a emilevauge/whoami:latest "/whoamI" About a minute ago Up About a minute 80/tcp toolwebapp_who3.1.9zk09prm85gnl0ieuuncynhxh
110+
78a0c7287df1 emilevauge/whoami:latest "/whoamI" About a minute ago Up About a minute 80/tcp toolwebapp_who2.1.wj7vf83ag91ft7jgdy3gwejp4
110111
```
111112

112113

@@ -121,7 +122,7 @@ $ docker ps | grep whoami
121122

122123
This password is encrypted in our configs `.configs/traefik.toml`
123124

124-
To quickly generate your password using htpasswd, use my container:
125+
To quickly generate yours with htpasswd, use my container:
125126

126127
```
127128
docker run --rm -it devmtl/alpinefire:3.8-D sh -c 'htpasswd -Bbn admin changethispass'
@@ -133,15 +134,15 @@ This will display:
133134
admin:$2y$05$pAfipn3.brdHMI2eWGnYH.84XYqLozp1sUPi36/l54UAwv.zGLtNC
134135
```
135136

136-
Insert this string in the `stack-proxy.yml` and `stack-consul.yml`
137+
Insert this string in your `.configs/traefik.toml`.
137138

138139
#### What is Traefik?
139140

140141
[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.
141142

142143
#### Traefik version
143144

144-
In `toolproxy.yml` look for something like `traefik:1.7.12-alpine`.
145+
In `toolproxy.yml` look for something like `traefik:1.7.12`.
145146

146147
In some mono-repo, I **my own traefik image**. Feel free to use the official images. It will not break anything.
147148

@@ -169,3 +170,4 @@ In the active path, just execute those bash-scripts:
169170
- `./runctop.sh`
170171

171172
**Bonus!** `./runctop.sh` is not a stack but a simple docker run to see the memory consumed by each container.
173+

traefik_stack6/config_and_vars.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ set -o pipefail # Use last non-zero exit code in a pipeline
1717
# Define variables for the whole project
1818
# USE CAPITAL VARS to indicate this VAR comes from outside
1919

20-
# config you var here
20+
# Not used in docker-compose at the moment
2121
echo "no vars here";
22-
23-
# https://github.com/pascalandy/docker-stack-this

traefik_stack6/configs/acme.json

Whitespace-only changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
defaultEntryPoints = ["http"]
2+
3+
[entryPoints]
4+
[entryPoints.dashboard]
5+
address = ":8080"
6+
[entryPoints.dashboard.auth]
7+
[entryPoints.dashboard.auth.basic]
8+
users = ["admin:$2y$05$pAfipn3.brdHMI2eWGnYH.84XYqLozp1sUPi36/l54UAwv.zGLtNC"]
9+
[entryPoints.http]
10+
address = ":80"
11+
# [entryPoints.http.redirect]
12+
# entryPoint = "https"
13+
# [entryPoints.https]
14+
# address = ":443"
15+
# [entryPoints.https.tls]
16+
17+
[api]
18+
entrypoint="dashboard"
19+
20+
#[acme]
21+
#email = "your_email@your_domain.net"
22+
#storage = "acme.json"
23+
#entryPoint = "https"
24+
#caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
25+
#onHostRule = true
26+
# [acme.httpChallenge]
27+
# entryPoint = "http"

traefik_stack6/play-with-docker-setup.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

traefik_stack6/runctop.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,5 @@ docker run --rm -ti \
9191
# --- Entrypoint
9292
main "$@"
9393

94-
# https://github.com/pascalandy/docker-stack-this
94+
# by Pascal Andy | https://pascalandy.com/
95+
# https://github.com/pascalandy/bash-script-template

traefik_stack6/rundown.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,11 @@ function main() {
8080
# --- edit YOUR SCRIPT HERE
8181
function goto_myscript() {
8282

83-
docker stack rm toolconsul || true; sleep 1; echo;
83+
docker stack rm stkproxy || true; sleep 1;
8484

85-
docker stack rm toolproxy || true; sleep 1; echo;
85+
docker stack rm stkwebapp || true; sleep 1;
8686

87-
docker stack rm toolwebapp || true; sleep 1; echo;
88-
89-
docker stack rm toolgui || true; sleep 1; echo;
87+
docker stack rm stkgui || true; sleep 1;
9088

9189
#echo; echo "Remove network ..."
9290
#docker network rm ntw_front
@@ -99,4 +97,5 @@ docker stack rm toolgui || true; sleep 1; echo;
9997
# --- Entrypoint
10098
main "$@"
10199

102-
# https://github.com/pascalandy/docker-stack-this
100+
# by Pascal Andy | https://pascalandy.com/
101+
# https://github.com/pascalandy/bash-script-template

0 commit comments

Comments
 (0)