Add Sahana update scripts, remove unused DEBUG envvar

This commit is contained in:
Disassembler 2020-06-21 20:10:21 +02:00
parent 09b7ce481f
commit af7be5c1be
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
10 changed files with 125 additions and 30 deletions

View File

@ -40,12 +40,10 @@ install -o 108080 -g 108080 -m 640 sahana_data/SAFIRE/config.py ${SAHANA_DATA}/S
# Populate database # 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' 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 # Set production values to increases performance
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.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.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
sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' ${SAHANA_CONF}/000_config.py
fi
# Stop services required for setup # Stop services required for setup
spoc-container stop safire-postgres spoc-container stop safire-postgres

21
lxc-apps/safire/update.sh Executable file
View File

@ -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

View File

@ -37,12 +37,10 @@ envsubst <masterUsers.csv | install -o 108080 -g 108080 -m 640 /dev/stdin ${SAHA
# Populate database # Populate database
spoc-container exec -u sahana sahana-demo -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py' spoc-container exec -u sahana sahana-demo -- 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 # Set production values to increases performance
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.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.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
sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' ${SAHANA_CONF}/000_config.py
fi
# Stop services required for setup # Stop services required for setup
spoc-container stop sahana-demo-postgres spoc-container stop sahana-demo-postgres

21
lxc-apps/sahana-demo/update.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
set -ev
# Volumes
SAHANA_CONF="${VOLUMES_DIR}/sahana-demo/sahana_conf"
SAHANA_DATA="${VOLUMES_DIR}/sahana-demo/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 sahana-demo-postgres
spoc-container exec -u sahana sahana-demo -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py'
spoc-container stop sahana-demo-postgres
# Disable database migrations
sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' ${SAHANA_CONF}/000_config.py

View File

@ -42,12 +42,10 @@ install -o 108080 -g 108080 -m 640 sahana_conf/00_settings.py ${SAHANA_CONF}/00_
# Populate database # Populate database
spoc-container exec -u sahana sahana -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py' spoc-container exec -u sahana sahana -- 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 # Set production values to increases performance
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.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.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
sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' ${SAHANA_CONF}/000_config.py
fi
# Stop services required for setup # Stop services required for setup
spoc-container stop sahana-postgres spoc-container stop sahana-postgres

21
lxc-apps/sahana/update.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
set -ev
# Volumes
SAHANA_CONF="${VOLUMES_DIR}/sahana/sahana_conf"
SAHANA_DATA="${VOLUMES_DIR}/sahana/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 sahana-postgres
spoc-container exec -u sahana sahana -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py'
spoc-container stop sahana-postgres
# Disable database migrations
sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' ${SAHANA_CONF}/000_config.py

View File

@ -40,12 +40,10 @@ install -o 108080 -g 108080 -m 640 sahana_data/SAMBRO/config.py ${SAHANA_DATA}/S
# Populate database # Populate database
spoc-container exec -u sahana sambro -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py' spoc-container exec -u sahana sambro -- 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 # Set production values to increases performance
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.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.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
sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' ${SAHANA_CONF}/000_config.py
fi
# Stop services required for setup # Stop services required for setup
spoc-container stop sambro-postgres spoc-container stop sambro-postgres

21
lxc-apps/sambro/update.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
set -ev
# Volumes
SAHANA_CONF="${VOLUMES_DIR}/sambro/sahana_conf"
SAHANA_DATA="${VOLUMES_DIR}/sambro/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 sambro-postgres
spoc-container exec -u sahana sambro -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py'
spoc-container stop sambro-postgres
# Disable database migrations
sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' ${SAHANA_CONF}/000_config.py

View File

@ -40,12 +40,10 @@ install -o 108080 -g 108080 -m 640 sahana_data/SHARE/config.py ${SAHANA_DATA}/SH
# Populate database # Populate database
spoc-container exec -u sahana share -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py' spoc-container exec -u sahana share -- 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 # Set production values to increases performance
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.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.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
sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' ${SAHANA_CONF}/000_config.py
fi
# Stop services required for setup # Stop services required for setup
spoc-container stop share-postgres spoc-container stop share-postgres

21
lxc-apps/share/update.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
set -ev
# Volumes
SAHANA_CONF="${VOLUMES_DIR}/share/sahana_conf"
SAHANA_DATA="${VOLUMES_DIR}/share/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 share-postgres
spoc-container exec -u sahana share -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py'
spoc-container stop share-postgres
# Disable database migrations
sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' ${SAHANA_CONF}/000_config.py