To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / extra / soundsoftware / scripted-deploy / docker / start.sh @ 1583:0dcd4f8c2b8a
History | View | Annotate | Download (1 KB)
| 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 |
|