comparison extra/soundsoftware/scripted-deploy/docker/start.sh @ 1586:d0d59d12db94 dockerise

Add some cron scripts, update
author Chris Cannam
date Wed, 16 Aug 2017 16:58:22 +0100
parents ae8043b014c7
children
comparison
equal deleted inserted replaced
1585:37d4559a9fce 1586:d0d59d12db94
1 #!/bin/bash 1 #!/bin/bash
2
3 mydir=$(dirname "$0")
2 4
3 dbpwd="$1" 5 dbpwd="$1"
4 if [ -z "$dbpwd" ]; then 6 if [ -z "$dbpwd" ]; then
5 echo "Usage: $0 <database-password>" 1>&2 7 echo "Usage: $0 <database-password>" 1>&2
6 exit 2 8 exit 2
7 fi 9 fi
8 10
9 set -eu 11 set -eu
10 12
11 deploydir=./extra/soundsoftware/scripted-deploy 13 sswdir="$mydir/../.."
14 rootdir="$sswdir/../.."
15
16 deploydir="$sswdir"/scripted-deploy
12 if [ ! -d "$deploydir" ]; then 17 if [ ! -d "$deploydir" ]; then
13 echo "Run this script from the root of a working copy of soundsoftware-site" 18 echo "ERROR: Unexpected repository layout - expected directory at $deploydir"
14 exit 2 19 exit 2
15 fi 20 fi
16 21
17 managerdir="$deploydir/docker" 22 managerdir="$deploydir/docker"
18 if [ ! -d "$managerdir" ]; then 23 if [ ! -d "$managerdir" ]; then
24 if [ ! -d "$configdir" ]; then 29 if [ ! -d "$configdir" ]; then
25 echo "ERROR: Required directory $configdir not found" 30 echo "ERROR: Required directory $configdir not found"
26 exit 2 31 exit 2
27 fi 32 fi
28 33
29 if [ ! -f "postgres-dumpall" ]; then 34 if [ ! -f "$rootdir/postgres-dumpall" ]; then
30 echo "ERROR: I expect to find a Postgres SQL multi-db dump file in ./postgres-dumpall" 35 echo "ERROR: I expect to find a Postgres SQL multi-db dump file in $rootdir/postgres-dumpall"
36 exit 2
37 fi
38
39 fontdir="$rootdir"/public/themes/soundsoftware/stylesheets/fonts
40 if [ ! -f "$fontdir/24BC0E_0_0.woff" ]; then
41 echo "ERROR: I expect to find necessary webfonts in $fontdir"
31 exit 2 42 exit 2
32 fi 43 fi
33 44
34 for f in database.yml code.conf ; do 45 for f in database.yml code.conf ; do
35 cat "$configdir/$f" | 46 cat "$configdir/$f" |
36 sed 's/INSERT_POSTGRES_PASSWORD_HERE/'"$dbpwd"'/g' > \ 47 sed 's/INSERT_POSTGRES_PASSWORD_HERE/'"$dbpwd"'/g' > \
37 "$configdir/$f.interpolated" 48 "$configdir/$f.interpolated"
38 done 49 done
39 50
51 cd "$rootdir"
52
40 dockertag="cannam/soundsoftware-site" 53 dockertag="cannam/soundsoftware-site"
41 54
42 sudo docker build -t "$dockertag" -f "$managerdir/Dockerfile" . 55 sudo docker build -t "$dockertag" -f "$managerdir/Dockerfile" .
43 sudo docker run -p 8080:80 -d "$dockertag" 56 sudo docker run -p 8080:80 -d "$dockertag"
44 57