annotate deploy/provision.d/080-database-load.sh @ 1621:3a510bf6a9bc

Merge from live branch
author Chris Cannam
date Fri, 13 Jul 2018 10:44:33 +0100
parents 89d3095ddc70
children
rev   line source
Chris@1577 1 #!/bin/bash
Chris@1577 2
Chris@1577 3 set -e
Chris@1577 4
Chris@1589 5 # Start the database and if a dump file is found, load it. The dump
Chris@1589 6 # file is then deleted so that the db won't be overwritten on
Chris@1589 7 # subsequent runs. (The original repo contains no dump file, so it
Chris@1589 8 # should exist only if you have provided some data to load.)
Chris@1589 9
Chris@1577 10 /etc/init.d/postgresql start
Chris@1577 11
Chris@1611 12 dumpdir="/code-to-deploy"
Chris@1611 13 if [ ! -d "$dumpdir" ]; then
Chris@1611 14 dumpdir=/var/www/code
Chris@1611 15 fi
Chris@1611 16
Chris@1611 17 cd "$dumpdir"
Chris@1577 18
Chris@1577 19 if [ -f postgres-dumpall ]; then
Chris@1577 20 chmod ugo+r postgres-dumpall
Chris@1577 21 sudo -u postgres psql -f postgres-dumpall postgres
Chris@1589 22 rm postgres-dumpall
Chris@1577 23 fi
Chris@1577 24