comparison extra/soundsoftware/scripted-deploy/docker/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 extra/soundsoftware/dockertest/start.sh@7b23adecd963
children d0d59d12db94
comparison
equal deleted inserted replaced
1580:fa3d9c22497c 1581:ae8043b014c7
1 #!/bin/bash
2
3 dbpwd="$1"
4 if [ -z "$dbpwd" ]; then
5 echo "Usage: $0 <database-password>" 1>&2
6 exit 2
7 fi
8
9 set -eu
10
11 deploydir=./extra/soundsoftware/scripted-deploy
12 if [ ! -d "$deploydir" ]; then
13 echo "Run this script from the root of a working copy of soundsoftware-site"
14 exit 2
15 fi
16
17 managerdir="$deploydir/docker"
18 if [ ! -d "$managerdir" ]; then
19 echo "ERROR: Required directory $managerdir not found"
20 exit 2
21 fi
22
23 configdir="$deploydir/config"
24 if [ ! -d "$configdir" ]; then
25 echo "ERROR: Required directory $configdir not found"
26 exit 2
27 fi
28
29 if [ ! -f "postgres-dumpall" ]; then
30 echo "ERROR: I expect to find a Postgres SQL multi-db dump file in ./postgres-dumpall"
31 exit 2
32 fi
33
34 for f in database.yml code.conf ; do
35 cat "$configdir/$f" |
36 sed 's/INSERT_POSTGRES_PASSWORD_HERE/'"$dbpwd"'/g' > \
37 "$configdir/$f.interpolated"
38 done
39
40 dockertag="cannam/soundsoftware-site"
41
42 sudo docker build -t "$dockertag" -f "$managerdir/Dockerfile" .
43 sudo docker run -p 8080:80 -d "$dockertag"
44