├── .gitignore ├── LICENSE ├── README.md ├── Vagrantfile ├── monitor.sh ├── provision └── node.sh ├── run-on-all-nodes.sh ├── secrets └── mysql.with.secrets.yml └── services ├── apis.yml ├── before.calc.yml ├── calc.yml ├── cowsay.yml ├── cowsayhealth.yml ├── monitor-health.sh ├── mysql.yml └── viz.yml /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/vagrant 3 | 4 | ### Vagrant ### 5 | .vagrant/ 6 | 7 | # End of https://www.gitignore.io/api/vagrant 8 | 9 | *.inspect 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Wes Higbee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Errata for the course: 2 | 3 | ## 20.10 4 | 5 | ### Swarm Jobs! 6 | 7 | - As of Docker version `20.10` support for `jobs` has been added! 8 | - [read the jobs docs here](https://docs.docker.com/engine/reference/commandline/service_create/#running-as-a-job). 9 | - `mode` option has two new values: 10 | - `replicated-job` 11 | - `global-job` 12 | - `jobs` are run to `completion` 13 | - `completion` = return code 0 14 | - IMO comingling `service` and `job` concepts is somewhat confusing albeit they have many options in common.. but a `service` is an abstraction of a `daemon` or `long-running process` whereas a `job` is run once 15 | - A `docker jobs` or similar might be nice 16 | - But, `mode` works and avoids a slew of new docker commands and subcommands 17 | - Many `service` options aren't applicable, like `restart-condition`, `update` and `rollback` options 18 | - `replicated-job`s use the `replicas` setting to specify how many 19 | - `global-job`s run one per node (matching any placement constraints) 20 | - as nodes are added, each will have a task for each `global-job` 21 | 22 | 23 | ## 17.10 24 | 25 | - `docker service` commands no longer run detached by default as of `17.10` 26 | - This is nice because you get a **progress indicator** in the new interactive mode 27 | - If you want to run detached simply pass `--detach` 28 | - Applies to `service create`, `service update`, `service rollback`, and `service scale` 29 | - For command examples before and after this change and a history of the change, check out this PR, it's great: [docker/cli#525](https://github.com/docker/cli/pull/525) 30 | 31 | Updated as of 17.10 32 | 33 | Keep an eye out for future changes, this is the easiest spot for me to update. 34 | 35 | ## Refresh coming soon! (2nd edition) 36 | 37 | I'm working on a refresh to this course to update it for changes since the 1st edition was published! 38 | - It will be condensed, so some content won't make the cut. 39 | - Fortunately, the vast majority of the current course is still applicable and thus you can always watch the expanded 1st edition (current course) after the refresh (2nd edition) comes out! 40 | - Both are linked 41 | - on my [author page](https://www.pluralsight.com/authors/wes-mcclure). 42 | - and under **Links** Below 43 | 44 | ## Links 45 | 46 | - Getting Stated with Docker Swarm (2nd edition): 47 | - Status: WIP, eta May 2021 48 | - Course: (Link Pending) 49 | - Repo: [g0t4/course2-swarm-gs](https://github.com/g0t4/course2-swarm-gs) 50 | - Getting Stated with Docker Swarm Mode (1st edition) 51 | - Status: current course 52 | - Course: [1st edition Getting Started with Docker Swarm Mode](https://www.pluralsight.com/courses/docker-swarm-mode-getting-started) 53 | - Repo: [g0t4/docker-swarm-mode-getting-started](https://github.com/g0t4/docker-swarm-mode-getting-started) 54 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | 6 | config.vm.box = "box-cutter/ubuntu1610" 7 | config.vm.provision "shell", path: "provision/node.sh", privileged: true 8 | 9 | # Managers 10 | (1..3).each do |number| 11 | config.vm.define "m#{number}" do |node| 12 | node.vm.network "private_network", ip: "192.168.99.20#{number}" 13 | node.vm.hostname = "m#{number}" 14 | end 15 | end 16 | 17 | # Workers 18 | (1..4).each do |number| 19 | config.vm.define "w#{number}" do |node| 20 | node.vm.network "private_network", ip: "192.168.99.21#{number}" 21 | node.vm.hostname = "w#{number}" 22 | end 23 | end 24 | 25 | config.vm.provider "virtualbox" do |v| 26 | v.memory = 2048 27 | v.cpus = 1 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /monitor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | service=$1 4 | 5 | if [ -z ${service} ]; then 6 | echo "You must pass a service:" 7 | echo "./monitor.sh web" 8 | exit; 9 | fi 10 | 11 | sessionname="monitor-$service" 12 | setdockerhost="export DOCKER_HOST=192.168.99.201; " 13 | watch="$setdockerhost; watch -d -n 0.5 " 14 | servicels="$watch docker service ls" 15 | serviceinspect="$watch docker service inspect $service" 16 | serviceps="$watch docker service ps $service" 17 | 18 | tmux kill-session -t $sessionname 19 | 20 | tmux set-option remain-on-exit on 21 | 22 | 23 | tmux new-session -d -s $sessionname 24 | # tmux send-keys "$serviceinspect" C-m 25 | # tmux split-window -p 50 -h 26 | tmux send-keys "$servicels" C-m 27 | 28 | tmux split-window -p 75 -v 29 | tmux send-keys "$serviceps" C-m 30 | 31 | tmux split-window -p 30 -v 32 | # tmux select-pane -t 2 33 | tmux send-keys "$setdockerhost; clear" C-m 34 | 35 | 36 | 37 | tmux -2 attach-session -d -t $sessionname 38 | -------------------------------------------------------------------------------- /provision/node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install test version of docker engine, also shell completions 4 | curl -fsSL https://test.docker.com/ | sh 5 | 6 | # Add the vagrant user to the docker group 7 | usermod -aG docker vagrant 8 | 9 | # Configure the docker engine 10 | # Daemon options: https://docs.docker.com/engine/reference/commandline/dockerd/ 11 | # Set both unix socket and tcp to make it easy to connect both locally and remote 12 | # You can add TLS for added security (docker-machine does this automagically) 13 | cat > /etc/docker/daemon.json <