Demo Build Updates
Intelligently cache vault.zip
Wait for SHIELD to come up and then run setup
Only setup once
@@ -94,11 +94,13 @@ failsafe:
EOF
VAULT_VERSION=0.8.3
+if [[ ! -f ${CACHED}/vault.zip ]]; then
curl -C - -Lo ${CACHED}/vault.zip https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip
pushd $CACHED
rm -f vault
unzip vault.zip
popd
+fi
cp $CACHED/vault ${SHIELD_CORE}/bin
cat > ${SHIELD_CORE}/rc/vault <<'EOF'
#!/bin/sh
@@ -120,19 +122,19 @@ cat > ${SHIELD_CORE}/etc/setup <<'EOF'
#!/bin/sh
set -ex
-#echo "waiting for shield to spin up..."
-#shield_up="1"
-#while [ $shield_up -eq 1 ]; do
-# sleep 1
-# shield_up=`nc -z core 8181; echo $?`
-#done
-
export SHIELD_CORE=demo
export SHIELD_BATCH_MODE=y
export PATH=/bin:/usr/bin:/shield/bin
+if [ ! -f ~/.SETUP-DONE ]; then
buckler api http://core:8181 demo
SHIELD_CORE_MASTER=master buckler initialize
+
+ # wait for it...
+ while ! buckler curl /v2/info; do
+ sleep 1
+ done
+
buckler login --username demo --password demo
buckler id
@@ -198,6 +200,13 @@ buckler create-tenant --name Fulfillment
buckler invite --tenant Fulfillment --role operator ophelia olaf nikita nelson
buckler invite --tenant Fulfillment --role engineer fiona
buckler invite --tenant Fulfillment --role admin frank
+
+ touch ~/.SETUP-DONE
+fi
+
+while true;
+ tail -f /dev/null # sleep forever
+done
EOF
chmod 755 ${SHIELD_CORE}/etc/setup
@@ -210,6 +219,9 @@ cat > ${SHIELD_CORE}/rc/init <<'EOF'
# spin the core
/shield/rc/shield-core
+
+# set up the data
+/shield/etc/setup
EOF
@@ -219,7 +231,6 @@ for img in shield-{agent,core,store}; do
popd
done
-
for img in {aegis,crm,shipit}; do
pushd $PWD/demo/$img
./build.sh
