Notes:
- cannot be used for multiple leaders/quorum
- races between leader updates in servers/clients should be handled by message queuing and/or retry
#!/bin/bash | |
CONSUL="localhost:8500" | |
main() { | |
case "$1" in | |
info) | |
curl -s "$CONSUL/v1/kv/$2" | jq -r .[] | |
;; | |
get) |
{ | |
"ssl_certificate": {"$file": "/nginx/files/foobar"}, | |
"user": ["nobody", "nogroup"], | |
"events": { | |
"worker_connections": 1024, | |
"accept_mutex": "on" | |
}, | |
"http": { | |
"gzip_disable": "\"MSIE [1-6]\\.\"", | |
"upstream": { |
#!/bin/bash | |
foo() { | |
echo "foo: exported from file1" | |
} | |
locals() { | |
bar() { | |
echo "bar: local to file1" | |
} |
-----> Python app detected | |
-----> Preparing Python runtime (python-2.7.7) | |
Traceback (most recent call last): | |
File "/tmp/buildpacks/heroku-buildpack-python/vendor/bpwatch/bpwatch", line 13, in <module> | |
import bp_cli | |
File "/tmp/buildpacks/heroku-buildpack-python/vendor/bpwatch/bpwatch.zip/bp_cli.py", line 26, in <module> | |
File "/tmp/buildpacks/heroku-buildpack-python/vendor/bpwatch/bpwatch.zip/logplex/__init__.py", line 1, in <module> | |
File "/tmp/buildpacks/heroku-buildpack-python/vendor/bpwatch/bpwatch.zip/logplex/core.py", line 8, in <module> | |
File "/tmp/buildpacks/heroku-buildpack-python/vendor/bpwatch/bpwatch.zip/logplex/packages/requests/__init__.py", line 58, in <module> | |
File "/tmp/buildpacks/heroku-buildpack-python/vendor/bpwatch/bpwatch.zip/logplex/packages/requests/utils.py", line 12, in <module> |
destructuring_assignment_for_named_local_args() { | |
declare numbers letters words | |
read numbers letters words <<<"$@" | |
echo "$numbers" | |
echo "$letters" | |
echo "$words" | |
} | |
destructuring_assignment_for_named_local_args 123 abc "Hello world" |
FROM ubuntu:trusty | |
MAINTAINER Jeff Lindsay <progrium@gmail.com> | |
RUN apt-get -y install unzip | |
ADD https://dl.bintray.com/mitchellh/consul/0.2.0_linux_amd64.zip /tmp/consul.zip | |
RUN cd /usr/local/sbin && unzip /tmp/consul.zip && chmod +x /usr/local/sbin/consul | |
EXPOSE 8300 8301 8302 | |
ENTRYPOINT ["/usr/local/sbin/consul", "agent", "-server", "-data-dir=/tmp/consul"] |
package main | |
import ( | |
"bufio" | |
"crypto/sha1" | |
"crypto/tls" | |
"encoding/base64" | |
"encoding/hex" | |
"io" | |
"io/ioutil" |
// many servers, one master, many clients | |
// server | |
set, err := discoverd.Register("db", 9099) | |
<-set.BecomeLeader() | |
// client | |
set, err := discoverd.ServiceSet("db") | |
leader := <-set.NewLeader() |
#!/bin/bash | |
# | |
# Usage: | |
# $ echo "host1 host2 host3" | ./sshmany uname -a | |
# $ cat myservers | ./sshmany echo Hello world | |
# | |
cmd="$@" | |
servers="$(cat)" | |
i=37 | |
for server in $servers; do |