Skip to content

Staging consul scripts

anandkumarpatel edited this page Jan 28, 2016 · 4 revisions

seed.sh

# usage ./seed.sh <seedFile>
# seed file format is a value per line. ex:
# docker-listener v1.0.1
# filibuster v1.2.2
#

# inputs: <key> <value>
setValue() {
  local KEY=${1}
  local VALUE=${2}
  echo seeding $KEY with $VALUE
  while true; do
    echo ACTION: curl -f -X PUT -d "$VALUE" http://localhost:8500/v1/kv/"$KEY"
    STATUSCODE=$(curl --silent --output /dev/null --write-out "%{http_code}" -X PUT -d "$VALUE" http://localhost:8500/v1/kv/"$KEY")
    echo STATUSCODE: $STATUSCODE
    if test $STATUSCODE -eq 200; then
        break
    fi
    sleep 1
  done
}

# run action
while read line; do
 setValue $line
done < "$1"

seedFile

api/hostname api-staging-codenow.runnableapp.com
charon/version v3.0.0
dock-init/version v5.1.3
docker-listener/version v3.0.0
filibuster/version v0.1.7
image-builder/version d1.6.2-v4.0.0
krain/version v0.1.1
node/env staging
swarm/version 1.0.1

start.sh

#!/bin/bash
/seed.sh seedFile > /seed.log 2>&1 &
consul agent -config-dir /etc/consul.d/bootstrap -advertise=$(hostname -i)

dockerfile

root@ip-10-8-193-186:/home/ubuntu# docker history --no-trunc registry.runnable.com/2335750/567b8babbc020e1e00fece53:56974c8337c9d11e00be168f
IMAGE                                                              CREATED             CREATED BY                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           SIZE                COMMENT
7fdfb62a4d9f9485529325af677ed8a2d331af01d390111890862505ce08452e   2 weeks ago         /bin/sh -c #(nop) CMD ["/bin/sh" "-c" "for i in {1..10}; do grep -q ethwe /proc/net/dev && break; sleep 1; test \"$i\" = \"10\" && echo Runnable: network failed && exit 55; done;./start.sh"]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       0 B
06c818649a2d9944cca14cf919bd6de11acfcae75ee0eb7481844ff3336ece73   2 weeks ago         /bin/sh -c for i in {1..10}; do grep -q ethwe /proc/net/dev && break; sleep 1; test "$i" = "10" && echo Runnable: network failed && exit 55; done;chmod +x /seed.sh /start.sh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        753 B
82fb3fb7b3b639034dbcee2848e2bf6aee8e3a3cbb8854136a4febae27b2638d   2 weeks ago         /bin/sh -c #(nop) ADD file:3ed12cd3f67fb79772390e74742e744b3be1d06c8221e4edcaf9990853f70a01 in /                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     125 B
3e7394bd3595e375eb29fc99c297607ace3d799c889afab51b940e4eb85ac172   2 weeks ago         /bin/sh -c #(nop) ADD file:b3abce61409ec48a66dbceded7068524a7e323635644007f167613ead11d7883 in /                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     247 B
e53b984e16793d0d41dc7d72bdbd2efd8e8c9a9f37906cfb67df4889baa92d0a   2 weeks ago         /bin/sh -c #(nop) ADD file:49359cab253822186529981f4f9250df4795b093494a3e5dce5fd446ca6cbda6 in /                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     628 B
ec50b1042423a3b5ab2ea62bac34fbea4dc97c1a35320e160155aa508018128a   2 weeks ago         /bin/sh -c #(nop) ADD file:afcda9eca16897f94d3a55c80bb6344d94c0d908a773f1dc9150ce7e3692aa40 in /etc/consul.d/bootstrap                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               116 B
88caebb4713cd90f00396187000253593db757ac11b320099eefcd457ff229b0   2 weeks ago         /bin/sh -c #(nop) ADD file:d3a2bea86d1c234a024d49d1ebd8bc7e5152c72749eb7bdf1f6bfd8882791e86 in /etc/consul.d/bootstrap                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               114 B
a15ef99859f451e5bb46534a4ad1ad54a2be03d3cd3d10e2887c6b2396d2f9c1   2 weeks ago         /bin/sh -c #(nop) ADD file:7eedc58e359b02c84d9d67b111c26aa755bab3fb142a179b1b2e515098d510b0 in /etc/consul.d/bootstrap                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               118 B
1b336c153e413aed1d4ebeb2ee8739a00504626d98a678f843a5d18794de2613   2 weeks ago         /bin/sh -c #(nop) ADD file:0cfeb70cd6eb0177429543e002b4a5f6d519d4c341c32b911898bb5c535cdd01 in /etc/consul.d/bootstrap                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               116 B
c57d0337aa21f74be49a96960be0ed808fc3db29c857dd77e259ae310092f1ce   2 weeks ago         /bin/sh -c #(nop) EXPOSE 53/tcp 80/tcp 8300/tcp 8301/tcp 8400/tcp 8500/tcp 8600/tcp                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  0 B
f4e93c6897f0eafe8824d5983b958f95d800001358b049ac3cd993c243bfbbf3   2 weeks ago         /bin/sh -c #(nop) COPY file:5f599c14c83b94d737651fe1e41bb3270ec6d2cd7f83a1724c7448bba2b58501 in /etc/consul.d/bootstrap/config.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  188 B
eee826231275d75dbabaa5577e0585c7cbf4eedcd052b824435f642c2b16c25e   2 weeks ago         /bin/sh -c for i in {1..10}; do grep -q ethwe /proc/net/dev && break; sleep 1; test "$i" = "10" && echo Runnable: network failed && exit 55; done;mkdir /consul     && wget -P /consul/ https://dl.bintray.com/mitchellh/consul/0.5.2_web_ui.zip     && unzip /consul/0.5.2_web_ui.zip     && rm -rf /consul/0.5.2_web_ui.zip                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        992.3 kB
2b9fc2b67461f2a81e0314d947c05adc5a8496b9c1731cbc39cc5f1438c214b6   2 weeks ago         /bin/sh -c for i in {1..10}; do grep -q ethwe /proc/net/dev && break; sleep 1; test "$i" = "10" && echo Runnable: network failed && exit 55; done;cd /     && wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip     && unzip /0.5.2_linux_amd64.zip     && mv consul /usr/local/bin     && rm -rf /0.5.2_linux_amd64.zip                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            18.25 MB
100324c3d973a76490e6a5d9ab4680856fa3786f0eddab2b3684047da7b0a055   2 weeks ago         /bin/sh -c for i in {1..10}; do grep -q ethwe /proc/net/dev && break; sleep 1; test "$i" = "10" && echo Runnable: network failed && exit 55; done;apt-get update -y --force-yes     && apt-get upgrade -y --force-yes     && apt-get install -y --force-yes vim wget curl unzip dnsutils                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             89.66 MB
c4bea91afef3764163fd506f5c1090be1d34a9b63ece81867cb863455937048e   3 weeks ago         /bin/sh -c #(nop) CMD ["/bin/bash"]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  0 B
d9e545b90db85078ad93046df830534749f1301376441c99ff18dbcd29f68fd7   3 weeks ago         /bin/sh -c sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1.895 kB
4cdc0cbc1936e43921f7b64a520e41beea2759fbca90f9733f6d4da5de483926   3 weeks ago         /bin/sh -c echo '#!/bin/sh' > /usr/sbin/policy-rc.d  && echo 'exit 101' >> /usr/sbin/policy-rc.d  && chmod +x /usr/sbin/policy-rc.d   && dpkg-divert --local --rename --add /sbin/initctl  && cp -a /usr/sbin/policy-rc.d /sbin/initctl  && sed -i 's/^exit.*/exit 0/' /sbin/initctl   && echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup   && echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean  && echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean  && echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean   && echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages   && echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes   194.5 kB
fcee8bcfe180d9fbfddc5f7c96c5236e2ae699f81e9d9f445df7c0544ecf8a1a   3 weeks ago         /bin/sh -c #(nop) ADD file:482777a8ad62044151087a0dd81f22cb67585db07dfdda686202477d0c6ba0ae in /                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     187.7 MB
Clone this wiki locally