From f8bcd6f03241d20f1b1d71687ca1a8c6b4808ceb Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Mon, 22 Feb 2016 21:43:09 -0500 Subject: [PATCH] Move the gossip script to a demo script that is generic for all demos --- demo/demoscript.md | 118 +++++++++++++++++++++++++++++++++++++++++++++ demo/gossip.txt | 79 ------------------------------ 2 files changed, 118 insertions(+), 79 deletions(-) create mode 100644 demo/demoscript.md delete mode 100644 demo/gossip.txt diff --git a/demo/demoscript.md b/demo/demoscript.md new file mode 100644 index 0000000000..9ff3d4b346 --- /dev/null +++ b/demo/demoscript.md @@ -0,0 +1,118 @@ +# The bldr demo script + +## Pre-bldr world + +``` +docker run -it redis +``` + +Look, so easy! Look how much it abstracted. However, what happens when you +want to inject runtime configuration data? e.g. how do you fix this: + +``` +WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. +``` + +First, Google for what this means. Now you know you need to modify the +`tcp-backlog` setting to 128. How do you do this? + +Now you need to eat the entire Dockerfile and all of its complexity (a copy +is included in this dir for reference) + +## With bldr + +``` +docker run -it chef/redis +``` + +Looks pretty much the same, except with a supervisor wrapping the run and +some extra colorization. Ok... + +But we can ask the supervisor what things are configurable: + +``` +docker run -it chef/redis config redis +``` + +Get a TOML output with all the configuration values. + +Run the container again overriding the configuration: + +``` +docker run -e BLDR_redis='tcp-backlog = 128' -it chef/redis +``` + +See the message gone. + +## Making the configuration permanent + +*** This part is currently broken due to the switch from etcd *** + +(Once this is reimplemented we can inject this config into the supervisor +by asking it to load a TOML file from the host machine) + +## Built-in topology awareness discovery using gossip + +You'll want three terminal windows for this. + +First let's start the primary: + +``` +docker run chef/redis start chef/redis --gossip-permanent --topology leader +``` + +This prints out the IP of the container, so you can run two more: + +``` +docker run -it chef/redis start chef/redis --gossip-permanent --gossip-peer 172.17.0.3 --topology leader +``` + +(run that twice) + +See how the cluster automatically voted once there was quorum on a leader, +picked one as the master, the others are followers. + +## Sidecar + +Need to do this from another container for now since the bldr containers +are so bare and don't have any of these tools. + +``` +docker run -it fedora /bin/sh +# Then inside the container +dnf -y install curl jq +``` + +Show the gossip endpoint of the sidecar. + +``` +curl http://some-peer:9631/gossip | jq . +``` + +Show how we will show status + +``` +curl http://some-peer:9631/gossip | jq '.member_list.members | map({ip: .ip, health: .health})' +``` + +# Show the Packaging System + +``` +cd studio && make docker-studio +# Talk about what this is, then rebuild something +make gpg +# You need Internet access for this part - not guest Wi-Fi because +# until the depot is up, it runs on a weird port +build rust +``` + +Talk about how to make a Docker container out of this! + +``` +dockerize chef/rust +``` + +# To-Do on Gossip + +* Show partitions +* Show how peers are loosely connected diff --git a/demo/gossip.txt b/demo/gossip.txt deleted file mode 100644 index cc6f0266d5..0000000000 --- a/demo/gossip.txt +++ /dev/null @@ -1,79 +0,0 @@ -Four terminals -pkg-shell each -ifconfig in each - -Tab two -Four terminals -docker exec in each, mapping to the other tab -ifconfig in each -jq installed in each - -even network 4 and 6 -odd network 5 and 7 - -Start 4 -env RUST_LOG=warn ./target/debug/bldr start chef/redis --gossip-permanent - -Start 5 -env RUST_LOG=warn ./target/debug/bldr start chef/redis --gossip-permanent --gossip-peer 172.17.0.4 - -Start 6 -env RUST_LOG=warn ./target/debug/bldr start chef/redis --gossip-peer 172.17.0.4 --gossip-permanent - -Start 7 -env RUST_LOG=warn ./target/debug/bldr start chef/redis --gossip-peer 172.17.0.5 --gossip-permanent - - -Show that they both saw each other as alive - -Show the gossip endpoint of the sidecar - -curl http://localhost:9631/gossip | jq . - -Show how we will show status - -curl http://localhost:9631/gossip | jq '.member_list.members | map({ip: .ip, health: .health})' - -Partition 4 from 5 -On 4 -iptables -A INPUT -s 172.17.0.5 -j DROP -On 5 -iptables -A INPUT -s 172.17.0.4 -j DROP - -Show that.. they stay alive, because they can find a route to each other -through 6 and 7 - -Heal the partition -On 4 -iptables -D INPUT -s 172.17.0.5 -j DROP -On 5 -iptables -D INPUT -s 172.17.0.4 -j DROP - - - -Partition 4 and 6 from 5 and 7 - -On 4 and 6 -iptables -A INPUT -s 172.17.0.5 -j DROP -iptables -A INPUT -s 172.17.0.7 -j DROP - -On 5 and 7 -iptables -A INPUT -s 172.17.0.4 -j DROP -iptables -A INPUT -s 172.17.0.6 -j DROP - -Show the status on both sides - -curl http://localhost:9631/gossip | jq '.member_list.members | map({ip: .ip, health: .health})' - -Describe the alzheimers problem - -Heal the partition - -On 4 + 6 -iptables -D INPUT -s 172.17.0.5 -j DROP -iptables -D INPUT -s 172.17.0.7 -j DROP - -On 5 + 7 -iptables -D INPUT -s 172.17.0.4 -j DROP -iptables -D INPUT -s 172.17.0.6 -j DROP -