annotate extra/soundsoftware/scripted-deploy/vagrant/start.sh @ 1581:ae8043b014c7 dockerise

Updates, fixes, and tidying to scripted deployment stuff
author Chris Cannam
date Tue, 15 Aug 2017 13:33:56 +0100
parents
children d0d59d12db94
rev   line source
Chris@1581 1 #!/bin/bash
Chris@1581 2
Chris@1581 3 dbpwd="$1"
Chris@1581 4 if [ -z "$dbpwd" ]; then
Chris@1581 5 echo "Usage: $0 <database-password>" 1>&2
Chris@1581 6 exit 2
Chris@1581 7 fi
Chris@1581 8
Chris@1581 9 set -eu
Chris@1581 10
Chris@1581 11 deploydir=./extra/soundsoftware/scripted-deploy
Chris@1581 12 if [ ! -d "$deploydir" ]; then
Chris@1581 13 echo "Run this script from the root of a working copy of soundsoftware-site"
Chris@1581 14 exit 2
Chris@1581 15 fi
Chris@1581 16
Chris@1581 17 managerdir="$deploydir/vagrant"
Chris@1581 18 if [ ! -d "$managerdir" ]; then
Chris@1581 19 echo "ERROR: Required directory $managerdir not found"
Chris@1581 20 exit 2
Chris@1581 21 fi
Chris@1581 22
Chris@1581 23 configdir="$deploydir/config"
Chris@1581 24 if [ ! -d "$configdir" ]; then
Chris@1581 25 echo "ERROR: Required directory $configdir not found"
Chris@1581 26 exit 2
Chris@1581 27 fi
Chris@1581 28
Chris@1581 29 if [ ! -f "postgres-dumpall" ]; then
Chris@1581 30 echo "ERROR: I expect to find a Postgres SQL multi-db dump file in ./postgres-dumpall"
Chris@1581 31 exit 2
Chris@1581 32 fi
Chris@1581 33
Chris@1581 34 for f in database.yml code.conf ; do
Chris@1581 35 cat "$configdir/$f" |
Chris@1581 36 sed 's/INSERT_POSTGRES_PASSWORD_HERE/'"$dbpwd"'/g' > \
Chris@1581 37 "$configdir/$f.interpolated"
Chris@1581 38 done
Chris@1581 39
Chris@1581 40 cd "$managerdir"
Chris@1581 41
Chris@1581 42 vagrant up
Chris@1581 43