From 84b4dfae0235ed3a254cb5044a8e7eb9d6ee8dd2 Mon Sep 17 00:00:00 2001 From: James Hunt Date: Mon, 8 Feb 2016 13:44:47 -0500 Subject: [PATCH] New tmux-ified local dev environment Run `./bin/testdev` and get a SHIELD for free! No BOSH release, no BOSH-lite VM, no nothing! Just a test environment that does ... well, not much. --- bin/testdev | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 bin/testdev diff --git a/bin/testdev b/bin/testdev new file mode 100755 index 000000000..d94f673de --- /dev/null +++ b/bin/testdev @@ -0,0 +1,54 @@ +#!/bin/bash +PORT=8181 +export SHIELD_API=http://127.0.0.1:${PORT} + +case "${1}" in +(shieldd) + workdir=$(mktemp -d /tmp/shield.testdev.XXXXXXX) + trap "rm -rf ${workdir}" EXIT QUIT INT TERM + + mkdir ${workdir}/etc + cat >${workdir}/etc/shieldd.conf </dev/null + rm ${workdir}/var/key.pub + + if [[ ! -f "${workdir}/var/shield.db" ]]; then + echo ">> Setting up SHIELD schema in var/shield.db" + ./shield-schema -t sqlite3 -d "${workdir}/var/shield.db" + echo + fi + + echo ">> RUNNING SHIELDD" + ./shieldd -c ${workdir}/etc/shieldd.conf + echo + echo "shieldd exited." + echo "Press enter to close this session." + read JUNK + ;; + +("") + tmux set-option update-environment ' SHIELD_API' \; \ + new-session \; \ + new-window -n core ./bin/testdev shieldd \; + ;; + +(*) + echo >&2 "USAGE: $0 [ACTION]" + echo >&2 "" + echo >&2 "Run components of a test/dev shield setup, on http://127.0.0.1:${PORT}" + echo >&2 "" + echo >&2 "Actions:" + echo >&2 " shieldd Run SHIELD core daemon" +esac + +# vim:ft=bash