Skip to content

Commit 5b23c4d

Browse files
committed
Major update, portainer with agent behind Treafik
commit edd6d18 Author: Pascal Andy <[email protected]> Date: Wed Dec 5 15:06:01 2018 -0500 updated screenshots for portainer Signed-off-by: Pascal Andy <[email protected]> commit 23b09e2 Author: Pascal Andy <[email protected]> Date: Wed Dec 5 15:05:43 2018 -0500 minor Signed-off-by: Pascal Andy <[email protected]> commit b900f21 Author: Pascal Andy <[email protected]> Date: Wed Dec 5 14:59:16 2018 -0500 toolgui_portainer /f commit 136d664 Author: Pascal Andy <[email protected]> Date: Wed Dec 5 14:56:46 2018 -0500 toolgui_portainer /e commit 3aae4f5 Author: Pascal Andy <[email protected]> Date: Wed Dec 5 14:54:56 2018 -0500 toolgui_portainer /d commit 6452dbb Author: Pascal Andy <[email protected]> Date: Wed Dec 5 12:57:41 2018 -0500 portainer tests /c commit e0b327c Author: Pascal Andy <[email protected]> Date: Wed Dec 5 12:53:10 2018 -0500 portainer tests /b commit 3893a80 Author: Pascal Andy <[email protected]> Date: Wed Dec 5 12:43:04 2018 -0500 bypass portainer /a Signed-off-by: Pascal Andy <[email protected]>
1 parent 92dad70 commit 5b23c4d

File tree

4 files changed

+72
-37
lines changed

4 files changed

+72
-37
lines changed

traefik_stack5/README.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ This docker stack will run many services (Traefik, Socat, Portainer, Nginx, Cadd
88
2. Create *one instance*. Wait for the node to provision
99
3. Copy-paste:
1010

11+
#### STABLE setup (recommanded)
12+
1113
```
1214
# --- Setup the stack ---
13-
ENV_STABLE_BRANCH="1.52"
14-
ENV_EDGE_BRANCH="1.53"
15+
ENV_STABLE_BRANCH="master"
1516
ENV_MONOREPO="traefik_stack5"
1617
1718
# --- Setup the stack ---
@@ -22,6 +23,21 @@ cd "$ENV_MONOREPO" && \
2223
./runup.sh;
2324
```
2425

26+
#### EDGE setup (not recommanded)
27+
28+
```
29+
# --- Setup the stack ---
30+
ENV_EDGE_BRANCH="1.53"
31+
ENV_MONOREPO="traefik_stack5"
32+
33+
# --- Setup the stack ---
34+
source <(curl -s https://raw.githubusercontent.com/pascalandy/docker-stack-this/master/play-with-docker-setup.sh) && \
35+
sleep 2 && \
36+
git checkout "$ENV_EDGE_BRANCH" && \
37+
cd "$ENV_MONOREPO" && \
38+
./runup.sh;
39+
```
40+
2541
The script `runup.sh` will do the hard and deplo the stacks for us. Once deployed, you will see:
2642

2743

@@ -88,9 +104,9 @@ Portainer requires a slash `/` at the end of the path. There is something to twe
88104
![docker-stack-this-stack5_13](https://user-images.githubusercontent.com/6694151/34073737-76e1d998-e26e-11e7-8b7c-c619e91adadd.jpg)
89105
![docker-stack-this-stack5_14](https://user-images.githubusercontent.com/6694151/34073738-76f163ae-e26e-11e7-86d7-27ea62ae3284.jpg)
90106
![docker-stack-this-stack5_15](https://user-images.githubusercontent.com/6694151/34073739-77006d4a-e26e-11e7-8f2e-cbd4268ea403.jpg)
91-
![docker-stack-this-stack5_16](https://user-images.githubusercontent.com/6694151/34073740-770d66c6-e26e-11e7-8af8-434c3dd19780.jpg)
92-
![docker-stack-this-stack5_17](https://user-images.githubusercontent.com/6694151/34073741-771a3cc0-e26e-11e7-89cd-b31027506baf.jpg)
93-
![docker-stack-this-stack5_18](https://user-images.githubusercontent.com/6694151/34073742-7728b430-e26e-11e7-87a2-5e5375a24cfd.jpg)
107+
![docker-stack-this-stack5_16](https://user-images.githubusercontent.com/6694151/49540846-158f4700-f89f-11e8-8e14-ceca2ff2b910.jpg)
108+
109+
![docker-stack-this-stack5_17](https://user-images.githubusercontent.com/6694151/49540848-1922ce00-f89f-11e8-9fdc-b6fce70825c8.jpg)
94110

95111

96112
## All commands

traefik_stack5/rundown.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ function main() {
8080
# --- edit YOUR SCRIPT HERE
8181
function goto_myscript() {
8282

83-
echo; echo "Remove stacks ..."
84-
docker stack rm toolproxy || true; echo; sleep 1;
83+
echo; echo "Remove stacks ()if exsiting"
84+
docker stack rm toolproxy || true; sleep 1;
8585

86-
docker stack rm toolweb || true; echo; sleep 1;
86+
docker stack rm toolweb || true; sleep 1;
8787

88-
docker stack rm toolmonitor || true; echo; sleep 1;
88+
docker stack rm toolgui || true; sleep 1;
8989

9090
#echo; echo "Remove network ..."
9191
#docker network rm ntw_front

traefik_stack5/runup.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ function main() {
8181
function goto_myscript() {
8282

8383
# play-with-docker is ready
84-
docker run --rm devmtl/figlet:1.0 play-with-docker is ready; echo;
85-
docker run --rm devmtl/figlet:1.0 Lauching docker stack!; sleep 4; echo;
84+
docker run --rm devmtl/figlet:1.0 lauching stacks; sleep 2; echo;
8685

8786
# Stop
8887
echo; echo "If existing, remove stacks: "
@@ -118,23 +117,24 @@ echo "Start the stacks ..."; echo; echo;
118117

119118
# traefik
120119
docker stack deploy toolproxy -c toolproxy.yml
121-
echo; echo; sleep 2
120+
echo; sleep 1;
122121

123122
# webapps
124123
docker stack deploy toolwebapp -c toolwebapp.yml
125-
echo; echo; sleep 2
124+
echo; sleep 1;
126125

127-
# portainer
128-
docker stack deploy toolportainer -c toolportainer.yml
129-
echo; echo; sleep 2
126+
# testing as there is now an official stack
127+
# https://portainer.readthedocs.io/en/stable/deployment.html#inside-a-swarm-cluster
128+
docker stack deploy toolgui -c toolportainer.yml
129+
echo; sleep 1;
130130

131131
# wordpress
132132
# the system is path is at ./docker-stack5
133133
#_MYSQL_DIR="$(pwd)/html/db/mysql"
134134
#mkdir -p "$_MYSQL_DIR"
135135

136136
#docker stack deploy toolwp -c toolwp.yml
137-
#echo; echo; sleep 2
137+
echo; sleep 1;
138138

139139
# List
140140
echo; echo "docker stack ls ..."
@@ -160,7 +160,7 @@ echo "To see Traefik logs type: "; sleep 1;
160160
echo " docker service logs -f toolproxy_traefik"; echo; sleep 1;
161161

162162
# play-with-docker is ready
163-
docker run --rm devmtl/figlet:1.0 Lets play!; echo;
163+
docker run --rm devmtl/figlet:1.0 Your turn; echo;
164164

165165
}
166166

traefik_stack5/toolportainer.yml

+38-19
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,69 @@
1-
version: '3.3'
1+
version: '3.2'
22

33
services:
44

55
portainer:
6-
image: portainer/portainer:1.16.5
6+
image: portainer/portainer
7+
command: -H tcp://tasks.agent:9001 --tlsskipverify
8+
#managed by Traefik
9+
#ports:
10+
# - "9000:9000"
11+
volumes:
12+
- portainer_data:/data
713
networks:
814
- ntw_front
9-
volumes:
10-
- /var/run/docker.sock:/var/run/docker.sock
15+
- default
1116
deploy:
1217
mode: replicated
1318
replicas: 1
1419
placement:
1520
constraints: [node.role==manager]
1621
restart_policy:
1722
condition: on-failure
18-
max_attempts: 5
1923
resources:
2024
limits:
21-
cpus: '0.33'
22-
memory: 20M
25+
cpus: '0.20'
26+
memory: 48M
2327
reservations:
24-
cpus: '0.05'
25-
memory: 10M
28+
memory: 4M
2629
labels:
27-
- "traefik.frontend.rule=PathPrefixStrip:/portainer"
2830
- "traefik.backend=portainer"
31+
- "traefik.frontend.rule=PathPrefixStrip:/portainer"
2932
- "traefik.port=9000"
30-
- "traefik.weight=10"
3133
- "traefik.enable=true"
32-
- "traefik.passHostHeader=true"
3334
- "traefik.docker.network=ntw_front"
34-
- "traefik.frontend.entryPoints=http"
35+
- "traefik.weight=10"
3536
- "traefik.backend.loadbalancer.swarm=true"
3637
- "traefik.backend.loadbalancer.method=drr"
37-
# https://github.com/containous/traefik/issues/563#issuecomment-421360934
38+
## Bug fix / https://github.com/containous/traefik/issues/563#issuecomment-421360934
3839
- "traefik.frontend.redirect.regex=^(.*)/portainer$$"
3940
- "traefik.frontend.redirect.replacement=$$1/portainer/"
4041
- "traefik.frontend.rule=PathPrefix:/portainer;ReplacePathRegex: ^/portainer/(.*) /$$1"
4142

43+
agent:
44+
image: portainer/agent
45+
environment:
46+
AGENT_CLUSTER_ADDR: tasks.agent
47+
volumes:
48+
- /var/run/docker.sock:/var/run/docker.sock
49+
networks:
50+
- default
51+
deploy:
52+
mode: global
53+
restart_policy:
54+
condition: on-failure
55+
resources:
56+
limits:
57+
cpus: '0.20'
58+
memory: 48M
59+
reservations:
60+
memory: 4M
61+
4262
networks:
4363
ntw_front:
4464
external: true
65+
default:
66+
driver: overlay
4567

46-
# potential setup https://github.com/portainer/portainer/issues/461
47-
# Inspired from https://github.com/portainer/portainer-compose/blob/master/docker-stack.yml
48-
49-
# by Pascal Andy | https://pascalandy.com/
50-
# https://github.com/pascalandy/docker-stack-this
68+
volumes:
69+
portainer_data:

0 commit comments

Comments
 (0)