Spotter-VM/lxc-apps/safire/update.sh

22 lines
798 B
Bash
Executable File

#!/bin/sh
set -ev
# Volumes
SAHANA_CONF="${VOLUMES_DIR}/safire/sahana_conf"
SAHANA_DATA="${VOLUMES_DIR}/safire/sahana_data"
# Add new persistent volumes - added in 1.0.3-200504
install -o 108080 -g 108080 -m 750 -d ${SAHANA_DATA}/errors
install -o 108080 -g 108080 -m 750 -d ${SAHANA_DATA}/sessions
# Enable database migrations
sed -i 's/settings.base.migrate = False/settings.base.migrate = True/' ${SAHANA_CONF}/000_config.py
# Run database migration
spoc-container start safire-postgres
spoc-container exec -u sahana safire -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py'
spoc-container stop safire-postgres
# Disable database migrations
sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' ${SAHANA_CONF}/000_config.py