view 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
line wrap: on
line source
#!/bin/bash

mydir=$(dirname "$0")

dbpwd="$1"
if [ -z "$dbpwd" ]; then
    echo "Usage: $0 <database-password>" 1>&2
    exit 2
fi

set -eu

sswdir="$mydir/../.."
rootdir="$sswdir/../.."

deploydir="$sswdir"/scripted-deploy
if [ ! -d "$deploydir" ]; then
    echo "ERROR: Unexpected repository layout - expected directory at $deploydir"
    exit 2
fi

managerdir="$deploydir/docker"
if [ ! -d "$managerdir" ]; then
    echo "ERROR: Required directory $managerdir not found"
    exit 2
fi

configdir="$deploydir/config"
if [ ! -d "$configdir" ]; then
    echo "ERROR: Required directory $configdir not found"
    exit 2
fi

if [ ! -f "$rootdir/postgres-dumpall" ]; then
    echo "ERROR: I expect to find a Postgres SQL multi-db dump file in $rootdir/postgres-dumpall"
    exit 2
fi

fontdir="$rootdir"/public/themes/soundsoftware/stylesheets/fonts
if [ ! -f "$fontdir/24BC0E_0_0.woff" ]; then
    echo "ERROR: I expect to find necessary webfonts in $fontdir"
    exit 2
fi

for f in database.yml code.conf ; do
    cat "$configdir/$f" |
        sed 's/INSERT_POSTGRES_PASSWORD_HERE/'"$dbpwd"'/g' > \
            "$configdir/$f.interpolated"
done

cd "$rootdir"

dockertag="cannam/soundsoftware-site"

sudo docker build -t "$dockertag" -f "$managerdir/Dockerfile" .
sudo docker run -p 8080:80 -d "$dockertag"