From af7be5c1be1774bd895b8784ef33fd88a31e7dfe Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 21 Jun 2020 20:10:21 +0200 Subject: [PATCH] Add Sahana update scripts, remove unused DEBUG envvar --- lxc-apps/safire/install.sh | 10 ++++------ lxc-apps/safire/update.sh | 21 +++++++++++++++++++++ lxc-apps/sahana-demo/install.sh | 10 ++++------ lxc-apps/sahana-demo/update.sh | 21 +++++++++++++++++++++ lxc-apps/sahana/install.sh | 10 ++++------ lxc-apps/sahana/update.sh | 21 +++++++++++++++++++++ lxc-apps/sambro/install.sh | 10 ++++------ lxc-apps/sambro/update.sh | 21 +++++++++++++++++++++ lxc-apps/share/install.sh | 10 ++++------ lxc-apps/share/update.sh | 21 +++++++++++++++++++++ 10 files changed, 125 insertions(+), 30 deletions(-) create mode 100755 lxc-apps/safire/update.sh create mode 100755 lxc-apps/sahana-demo/update.sh create mode 100755 lxc-apps/sahana/update.sh create mode 100755 lxc-apps/sambro/update.sh create mode 100755 lxc-apps/share/update.sh diff --git a/lxc-apps/safire/install.sh b/lxc-apps/safire/install.sh index f3ef5c8..5da5bc7 100755 --- a/lxc-apps/safire/install.sh +++ b/lxc-apps/safire/install.sh @@ -40,12 +40,10 @@ install -o 108080 -g 108080 -m 640 sahana_data/SAFIRE/config.py ${SAHANA_DATA}/S # Populate database spoc-container exec -u sahana safire -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py' -# Set "production values" (increases performance) only if the DEBUG environment variable is not set -if [ ${DEBUG:-0} -eq 0 ]; then - sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' ${SAHANA_CONF}/000_config.py - sed -i 's/settings.base.debug = True/settings.base.debug = False/' ${SAHANA_CONF}/000_config.py - sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' ${SAHANA_CONF}/000_config.py -fi +# Set production values to increases performance +sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' ${SAHANA_CONF}/000_config.py +sed -i 's/settings.base.debug = True/settings.base.debug = False/' ${SAHANA_CONF}/000_config.py +sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' ${SAHANA_CONF}/000_config.py # Stop services required for setup spoc-container stop safire-postgres diff --git a/lxc-apps/safire/update.sh b/lxc-apps/safire/update.sh new file mode 100755 index 0000000..5b9bab1 --- /dev/null +++ b/lxc-apps/safire/update.sh @@ -0,0 +1,21 @@ +#!/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 diff --git a/lxc-apps/sahana-demo/install.sh b/lxc-apps/sahana-demo/install.sh index 505a381..27bf2d5 100755 --- a/lxc-apps/sahana-demo/install.sh +++ b/lxc-apps/sahana-demo/install.sh @@ -37,12 +37,10 @@ envsubst