-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <<EOF | ||
--- | ||
port: ${PORT} | ||
database_type: sqlite3 | ||
database_dsn: ${workdir}/var/shield.db | ||
private_key: ${workdir}/var/key | ||
workers: 3 | ||
max_timeout: 10 | ||
EOF | ||
|
||
mkdir ${workdir}/var | ||
ssh-keygen -t rsa -f ${workdir}/var/key -N '' >/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 |