Skip to content

Commit 173cb46

Browse files
committed
updated compose files and swarm lab
1 parent bcda425 commit 173cb46

File tree

3 files changed

+118
-5
lines changed

3 files changed

+118
-5
lines changed

admin-training/containers/01-docker-swarm-introduction.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ This guide assumes that:
2424
2. The sNow! server will also provide access to share file system via NFS (/home and /sNow). Check the [sNow! documentation](https://hpcnow.github.io/snow-documentation) in order to integrate other cluster file systems like BeeGFS, Lustre or IBM Spectrum Scale.
2525

2626
## Installation
27-
Docker Swarm manager nodes implement the Raft Consensus Algorithm to manage the global cluster state.
27+
Docker Swarm manager nodes implement the *Raft Consensus Algorithm* to manage the global cluster state.
2828
This is key for managing and scheduling tasks in the cluster, and also storing the same consistent state.
2929

30-
Raft tolerates up to (N-1)/2 failures and requires a majority or quorum of (N/2)+1 members to agree on values proposed to the cluster. This means that the size of the cluster should be at least 3 to resist one node failure or 5 to resist 3 nodes failures.
30+
Raft *tolerates* up to *(N-1)/2 failures* and requires a majority or quorum of (N/2)+1 members to agree on values proposed to the cluster. This means that the size of the cluster should be at least 3 to resist one node failure or 5 to resist 3 nodes failures.
3131

3232
This hands-on assumes that you have already deployed three VMs (domains) dedicated for Docker Swarm cluster or three compute nodes (production solution).
3333

3434
By default manager nodes also act as a worker nodes. For a small systems or non-critical services, this is relatively low-risk.
35-
However, because manager nodes use the Raft consensus algorithm to replicate data in a consistent way, they are sensitive to resource starvation. In sNow! environment you can isolate managers in VMs without running other services and deploy few bare metal nodes as Docker Swarm workers. In order to do so, you can drain manager nodes to make them unavailable as worker nodes:
35+
However, because manager nodes use the Raft consensus algorithm to replicate data in a consistent way, they are sensitive to resource starvation. In sNow! environment you can *isolate managers in VMs without running other services* and deploy few bare metal nodes as Docker Swarm workers. In order to do so, you can drain manager nodes to make them unavailable as worker nodes:
3636
```
3737
docker node update --availability drain <NODEID>
3838
```
@@ -196,9 +196,11 @@ docker service rm sleep_app
196196
The following example represents much better the benefits of adopting this technology.
197197

198198
### Defining a stack of services
199-
Docker Swarm allows to deploy a complete application stack to the swarm. The deploy command accepts a stack description in the form of a Compose file.
199+
Docker Swarm allows to deploy a complete application stack to the swarm. The deploy command accepts a stack description in the form of a [compose-file](https://docs.docker.com/compose/compose-file/).
200200

201-
In the container folder there is a file called monitoring-stack.yml which contains an example of a complete monitoring stack including a ElasticSearch cluster, kibana, InfluxDB, grafana, etc.
201+
In the container folder there are two compose files:
202+
* [gui-stack.yml](gui-stack.yml) which contains an example of two popular Swarm GUIs stack, [Portainer](https://portainer.io) and [Swarmpit](https://swarmpit.io/).
203+
* [monitoring-stack.yml](monitoring-stack.yml) which contains an example of a complete monitoring stack including a ElasticSearch cluster, Kibana, InfluxDB, Grafana, etc.
202204

203205
Download this file to your swarm01 and execute the following command to orchestrate the monitoring stack example:
204206
```
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# This example deploys two popular swarm GUIs
2+
# portainer: https://portainer.io
3+
# swarmpit: https://swarmpit.io/
4+
version: "3"
5+
services:
6+
7+
portainer:
8+
image: portainer/portainer
9+
command: -H unix:///var/run/docker.sock
10+
ports:
11+
- "9000:9000"
12+
volumes:
13+
- /etc/portainer:/data
14+
- /var/run/docker.sock:/var/run/docker.sock
15+
networks:
16+
- net
17+
deploy:
18+
placement:
19+
constraints: [node.role == manager]
20+
21+
app:
22+
image: swarmpit/swarmpit:latest
23+
environment:
24+
- SWARMPIT_DB=http://db:5984
25+
volumes:
26+
- /var/run/docker.sock:/var/run/docker.sock:ro
27+
ports:
28+
- 888:8080
29+
networks:
30+
- net
31+
deploy:
32+
resources:
33+
limits:
34+
cpus: '0.50'
35+
memory: 1024M
36+
reservations:
37+
cpus: '0.25'
38+
memory: 512M
39+
placement:
40+
constraints:
41+
- node.role == manager
42+
43+
db:
44+
image: klaemo/couchdb:2.0.0
45+
volumes:
46+
- db-data:/opt/couchdb/data
47+
networks:
48+
- net
49+
deploy:
50+
resources:
51+
limits:
52+
cpus: '0.30'
53+
memory: 512M
54+
reservations:
55+
cpus: '0.15'
56+
memory: 256M
57+
58+
agent:
59+
image: swarmpit/agent:latest
60+
environment:
61+
- DOCKER_API_VERSION=1.35
62+
volumes:
63+
- /var/run/docker.sock:/var/run/docker.sock:ro
64+
networks:
65+
- net
66+
deploy:
67+
mode: global
68+
resources:
69+
limits:
70+
cpus: '0.10'
71+
memory: 64M
72+
reservations:
73+
cpus: '0.05'
74+
memory: 32M
75+
76+
networks:
77+
net:
78+
driver: overlay
79+
80+
volumes:
81+
db-data:
82+
driver: local

admin-training/containers/monitoring-stack.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ services:
2222
- influxbd:/var/lib/influxdb
2323
deploy:
2424
replicas: 1
25+
update_config:
26+
parallelism: 1
27+
delay: 10s
2528
placement:
2629
constraints:
2730
- node.role == manager
@@ -36,6 +39,9 @@ services:
3639
- influxbd
3740
deploy:
3841
replicas: 1
42+
update_config:
43+
parallelism: 1
44+
delay: 10s
3945
placement:
4046
constraints:
4147
- node.role == manager
@@ -53,6 +59,9 @@ services:
5359
- influx
5460
deploy:
5561
mode: global
62+
update_config:
63+
parallelism: 1
64+
delay: 10s
5665

5766

5867
elasticsearch:
@@ -67,6 +76,11 @@ services:
6776
memlock:
6877
soft: -1
6978
hard: -1
79+
deploy:
80+
mode: global
81+
update_config:
82+
parallelism: 1
83+
delay: 10s
7084
volumes:
7185
- esdata1:/elasticsearch/data
7286
ports:
@@ -86,6 +100,11 @@ services:
86100
memlock:
87101
soft: -1
88102
hard: -1
103+
deploy:
104+
mode: global
105+
update_config:
106+
parallelism: 1
107+
delay: 10s
89108
volumes:
90109
- esdata2:/elasticsearch/data
91110
networks:
@@ -103,6 +122,11 @@ services:
103122
memlock:
104123
soft: -1
105124
hard: -1
125+
deploy:
126+
mode: global
127+
update_config:
128+
parallelism: 1
129+
delay: 10s
106130
volumes:
107131
- esdata3:/elasticsearch/data
108132
networks:
@@ -113,6 +137,11 @@ services:
113137
environment:
114138
SERVER_NAME: kibana.local
115139
ELASTICSEARCH_URL: http://elasticsearch:9200
140+
deploy:
141+
mode: global
142+
update_config:
143+
parallelism: 1
144+
delay: 10s
116145
ports:
117146
- '5601:5601'
118147
networks:

0 commit comments

Comments
 (0)