Fix Sahana install scripts

This commit is contained in:
Disassembler 2018-10-28 13:29:01 +01:00
parent 6bafd28e3e
commit cb2a3d65d8
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
28 changed files with 38 additions and 36 deletions

View File

@ -2,5 +2,5 @@
set -e set -e
# Remove service # Remove service
rm /etc/init.d/activemq rm -f /etc/init.d/activemq
rc-update -u rc-update -u

View File

@ -2,5 +2,5 @@
set -e set -e
# Remove service # Remove service
rm /etc/init.d/ckan-datapusher rm -f /etc/init.d/ckan-datapusher
rc-update -u rc-update -u

View File

@ -6,7 +6,7 @@ rm /etc/periodic/hourly/ckan
# Remove service # Remove service
rc-update del ckan || true rc-update del ckan || true
rm /etc/init.d/ckan rm -f /etc/init.d/ckan
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del crisiscleanup || true rc-update del crisiscleanup || true
rm /etc/init.d/crisiscleanup rm -f /etc/init.d/crisiscleanup
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del cts || true rc-update del cts || true
rm /etc/init.d/cts rm -f /etc/init.d/cts
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,5 +3,5 @@ set -e
# Remove service # Remove service
rc-update del frontlinesms || true rc-update del frontlinesms || true
rm /etc/init.d/frontlinesms rm -f /etc/init.d/frontlinesms
rc-update -u rc-update -u

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del gnuhealth || true rc-update del gnuhealth || true
rm /etc/init.d/gnuhealth rm -f /etc/init.d/gnuhealth
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -6,7 +6,7 @@ rm /etc/periodic/daily/kanboard
# Remove service # Remove service
rc-update del kanboard || true rc-update del kanboard || true
rm /etc/init.d/kanboard rm -f /etc/init.d/kanboard
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -2,5 +2,5 @@
set -e set -e
# Remove service # Remove service
rm /etc/init.d/mariadb rm -f /etc/init.d/mariadb
rc-update -u rc-update -u

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del mifosx || true rc-update del mifosx || true
rm /etc/init.d/mifosx rm -f /etc/init.d/mifosx
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del motech || true rc-update del motech || true
rm /etc/init.d/motech rm -f /etc/init.d/motech
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del opendatakit-build || true rc-update del opendatakit-build || true
rm /etc/init.d/opendatakit-build rm -f /etc/init.d/opendatakit-build
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del opendatakit || true rc-update del opendatakit || true
rm /etc/init.d/opendatakit rm -f /etc/init.d/opendatakit
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del openmapkit || true rc-update del openmapkit || true
rm /etc/init.d/openmapkit rm -f /etc/init.d/openmapkit
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del pandora || true rc-update del pandora || true
rm /etc/init.d/pandora rm -f /etc/init.d/pandora
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -2,5 +2,5 @@
set -e set -e
# Remove service # Remove service
rm /etc/init.d/postgres rm -f /etc/init.d/postgres
rc-update -u rc-update -u

View File

@ -2,5 +2,5 @@
set -e set -e
# Remove service # Remove service
rm /etc/init.d/rabbitmq rm -f /etc/init.d/rabbitmq
rc-update -u rc-update -u

View File

@ -2,5 +2,5 @@
set -e set -e
# Remove service # Remove service
rm /etc/init.d/redis rm -f /etc/init.d/redis
rc-update -u rc-update -u

View File

@ -14,23 +14,24 @@ envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Prepare persistent directory structure # Prepare persistent directory structure
mkdir -p /srv/sahana-demo/conf /srv/sahana-demo/data/databases /srv/sahana-demo/data/uploads /srv/sahana-demo/data/${TEMPLATE} mkdir -p /srv/sahana-demo/conf /srv/sahana-demo/data/databases /srv/sahana-demo/data/uploads /srv/sahana-demo/data/${TEMPLATE}
chown -R 8001:8001 /srv/sahana-demo/conf /srv/sahana-demo/data chown -R 8001:8001 /srv/sahana-demo/conf /srv/sahana-demo/data
cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/models/. /srv/sahana-demo/conf cp -rp /var/lib/lxc/shared/sahana/srv/web2py/applications/eden/models/. /srv/sahana-demo/conf
cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/modules/templates/${TEMPLATE}/. /srv/sahana-demo/data/${TEMPLATE} cp -rp /var/lib/lxc/shared/sahana/srv/web2py/applications/eden/modules/templates/${TEMPLATE}/. /srv/sahana-demo/data/${TEMPLATE}
# Configure Sahana # Configure Sahana
export SAHANADEMO_HMAC=$(head -c 18 /dev/urandom | base64) export SAHANADEMO_HMAC=$(head -c 18 /dev/urandom | base64)
export SAHANADEMO_ADMIN_USER=admin@example.com export SAHANADEMO_ADMIN_USER=admin@example.com
export SAHANADEMO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export SAHANADEMO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
envsubst <srv/sahana-demo/conf/000_config.py >/srv/sahana-demo/conf/000_config.py envsubst <srv/sahana-demo/conf/000_config.py >/srv/sahana-demo/conf/000_config.py
envsubst <masterUsers.csv >/var/lib/lxc/sahana/sahana/tmp/masterUsers.csv mkdir -p /var/lib/lxc/sahana-demo/sahana-demo/srv/web2py/applications/eden/modules/templates/default/users
chown -R 8001:8001 /var/lib/lxc/sahana-demo/sahana-demo/srv/web2py
envsubst <masterUsers.csv >/var/lib/lxc/sahana-demo/sahana-demo/srv/web2py/applications/eden/modules/templates/default/users/masterUsers.csv
vmmgr update-login sahana-demo "${SAHANADEMO_ADMIN_USER}" "${SAHANADEMO_ADMIN_PWD}" vmmgr update-login sahana-demo "${SAHANADEMO_ADMIN_USER}" "${SAHANADEMO_ADMIN_PWD}"
# Replace template in LXC container mount definition # Replace template in LXC container mount definition
sed -i "s/default/${TEMPLATE}/g" /var/lib/lxc/sahana-demo/config sed -i "s/default/${TEMPLATE}/g" /var/lib/lxc/sahana-demo/config
# Populate database # Populate database
lxc-execute -u 8001 -g 8001 sahana-demo -- sh -c 'cd /srv/web2py; cp /tmp/masterUsers.csv applications/eden/modules/templates/default/users/masterUsers.csv; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py' lxc-execute -u 8001 -g 8001 sahana-demo -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py'
rm /var/lib/lxc/sahana/sahana/tmp/masterUsers.csv
# Install service # Install service
envsubst <etc/init.d/sahana-demo >/etc/init.d/sahana-demo envsubst <etc/init.d/sahana-demo >/etc/init.d/sahana-demo

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del sahana-demo || true rc-update del sahana-demo || true
rm /etc/init.d/sahana-demo rm -f /etc/init.d/sahana-demo
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -13,7 +13,7 @@ envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Prepare persistent directory structure # Prepare persistent directory structure
mkdir -p /srv/sahana/conf /srv/sahana/data/databases /srv/sahana/data/uploads mkdir -p /srv/sahana/conf /srv/sahana/data/databases /srv/sahana/data/uploads
chown -R 8001:8001 /srv/sahana/conf chown -R 8001:8001 /srv/sahana/conf
cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/models/. /srv/sahana/conf cp -rp /var/lib/lxc/shared/sahana/srv/web2py/applications/eden/models/. /srv/sahana/conf
# Copy Spotter template # Copy Spotter template
cp -r srv/sahana/data/Spotter /srv/sahana/data/ cp -r srv/sahana/data/Spotter /srv/sahana/data/

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del sahana || true rc-update del sahana || true
rm /etc/init.d/sahana rm -f /etc/init.d/sahana
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -13,22 +13,23 @@ envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Prepare persistent directory structure # Prepare persistent directory structure
mkdir -p /srv/sambro/conf /srv/sambro/data/databases /srv/sambro/data/uploads /srv/sambro/data/SAMBRO mkdir -p /srv/sambro/conf /srv/sambro/data/databases /srv/sambro/data/uploads /srv/sambro/data/SAMBRO
chown -R 8001:8001 /srv/sambro/conf /srv/sambro/data chown -R 8001:8001 /srv/sambro/conf /srv/sambro/data
cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/models/. /srv/sambro/conf cp -rp /var/lib/lxc/shared/sahana/srv/web2py/applications/eden/models/. /srv/sambro/conf
cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/modules/templates/SAMBRO/. /srv/sambro/data/SAMBRO cp -rp /var/lib/lxc/shared/sahana/srv/web2py/applications/eden/modules/templates/SAMBRO/. /srv/sambro/data/SAMBRO
# Configure SAMBRO # Configure SAMBRO
export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64) export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64)
export SAMBRO_ADMIN_USER=admin@example.com export SAMBRO_ADMIN_USER=admin@example.com
export SAMBRO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export SAMBRO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
envsubst <srv/sambro/conf/000_config.py >/srv/sambro/conf/000_config.py envsubst <srv/sambro/conf/000_config.py >/srv/sambro/conf/000_config.py
envsubst <masterUsers.csv >/var/lib/lxc/sahana/sahana/tmp/masterUsers.csv mkdir -p /var/lib/lxc/sambro/sambro/srv/web2py/applications/eden/modules/templates/default/users
chown -R 8001:8001 /var/lib/lxc/sambro/sambro/srv/web2py
envsubst <masterUsers.csv >/var/lib/lxc/sambro/sambro/srv/web2py/applications/eden/modules/templates/default/users/masterUsers.csv
cp srv/sambro/conf/00_settings.py /srv/sambro/conf/00_settings.py cp srv/sambro/conf/00_settings.py /srv/sambro/conf/00_settings.py
cp srv/sambro/data/SAMBRO/config.py /srv/sambro/data/SAMBRO/config.py cp srv/sambro/data/SAMBRO/config.py /srv/sambro/data/SAMBRO/config.py
vmmgr update-login sambro "${SAMBRO_ADMIN_USER}" "${SAMBRO_ADMIN_PWD}" vmmgr update-login sambro "${SAMBRO_ADMIN_USER}" "${SAMBRO_ADMIN_PWD}"
# Populate database # Populate database
lxc-execute -u 8001 -g 8001 sambro -- sh -c 'cd /srv/web2py; cp /tmp/masterUsers.csv applications/eden/modules/templates/default/users/masterUsers.csv; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py' lxc-execute -u 8001 -g 8001 sambro -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py'
rm /var/lib/lxc/sahana/sahana/tmp/masterUsers.csv
# Set "production values" (increases performance) only if the DEBUG environment variable is not set # Set "production values" (increases performance) only if the DEBUG environment variable is not set
if [ ${DEBUG:-0} -eq 0 ]; then if [ ${DEBUG:-0} -eq 0 ]; then

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del sambro || true rc-update del sambro || true
rm /etc/init.d/sambro rm -f /etc/init.d/sambro
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -6,7 +6,7 @@ set -e
# Remove service # Remove service
rc-update del seeddms || true rc-update del seeddms || true
rm /etc/init.d/seeddms rm -f /etc/init.d/seeddms
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -3,7 +3,7 @@ set -e
# Remove service # Remove service
rc-update del sigmah || true rc-update del sigmah || true
rm /etc/init.d/sigmah rm -f /etc/init.d/sigmah
rc-update -u rc-update -u
# Drop database and user # Drop database and user

View File

@ -2,5 +2,5 @@
set -e set -e
# Remove service # Remove service
rm /etc/init.d/solr rm -f /etc/init.d/solr
rc-update -u rc-update -u

View File

@ -6,7 +6,7 @@ rm /etc/periodic/15min/ushahidi
# Remove service # Remove service
rc-update del ushahidi || true rc-update del ushahidi || true
rm /etc/init.d/ushahidi rm -f /etc/init.d/ushahidi
rc-update -u rc-update -u
# Drop database and user # Drop database and user