From 96249760fdddaa21f3b8000c86d38ff52d54acfd Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 20 Sep 2018 15:45:00 +0200 Subject: [PATCH] Put config update script installation to the end of setup --- ckan-datapusher/setup.sh | 4 +++- ckan/setup.sh | 4 +++- crisiscleanup/setup.sh | 4 +++- cts/setup.sh | 4 +++- gnuhealth/setup.sh | 4 +++- kanboard/setup.sh | 8 +++++--- mifosx/setup.sh | 4 +++- mifosx/setup/srv/mifosx/update-conf.sh | 2 +- motech/setup.sh | 4 +++- opendatakit/setup.sh | 4 +++- pandora/setup.sh | 4 +++- sahana-demo/setup.sh | 4 +++- sahana/setup.sh | 4 +++- sambro/setup.sh | 4 +++- seeddms/setup.sh | 8 +++++--- sigmah/setup.sh | 4 +++- ushahidi/setup.sh | 8 +++++--- 17 files changed, 55 insertions(+), 23 deletions(-) diff --git a/ckan-datapusher/setup.sh b/ckan-datapusher/setup.sh index a8cf4bd..147289a 100755 --- a/ckan-datapusher/setup.sh +++ b/ckan-datapusher/setup.sh @@ -5,7 +5,6 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))/setup # Configure CKAN DataPusher mkdir -p /srv/ckan-datapusher/conf /srv/ckan-datapusher/data -cp ${SOURCE_DIR}/srv/ckan-datapusher/update-conf.sh /srv/ckan-datapusher/update-conf.sh cp ${SOURCE_DIR}/srv/ckan-datapusher/conf/datapusher.wsgi /srv/ckan-datapusher/conf/datapusher.wsgi cp ${SOURCE_DIR}/srv/ckan-datapusher/conf/datapusher_settings.py /srv/ckan-datapusher/conf/datapusher_settings.py chown -R 8004:8004 /srv/ckan-datapusher/data @@ -13,3 +12,6 @@ chown -R 8004:8004 /srv/ckan-datapusher/data # Install service cp ${SOURCE_DIR}/etc/init.d/ckan-datapusher /etc/init.d/ckan-datapusher rc-update -u + +# Install config update script +cp ${SOURCE_DIR}/srv/ckan-datapusher/update-conf.sh /srv/ckan-datapusher/update-conf.sh diff --git a/ckan/setup.sh b/ckan/setup.sh index 3f9f715..7b04060 100755 --- a/ckan/setup.sh +++ b/ckan/setup.sh @@ -22,7 +22,6 @@ service solr restart # Configure CKAN mkdir -p /srv/ckan/conf /srv/ckan/data -cp ${SOURCE_DIR}/srv/ckan/update-conf.sh /srv/ckan/update-conf.sh export CKAN_SECRET=$(head -c 18 /dev/urandom | base64) export CKAN_UUID=$(cat /proc/sys/kernel/random/uuid) envsubst <${SOURCE_DIR}/srv/ckan/conf/ckan.ini >/srv/ckan/conf/ckan.ini @@ -56,6 +55,9 @@ cp ${SOURCE_DIR}/etc/periodic/hourly/ckan /etc/periodic/hourly/ckan cp ${SOURCE_DIR}/etc/init.d/ckan /etc/init.d/ckan rc-update -u +# Install config update script +cp ${SOURCE_DIR}/srv/ckan/update-conf.sh /srv/ckan/update-conf.sh + # Stop services required for setup [ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_REDIS} ] && service redis stop diff --git a/crisiscleanup/setup.sh b/crisiscleanup/setup.sh index ed54eed..b640576 100755 --- a/crisiscleanup/setup.sh +++ b/crisiscleanup/setup.sh @@ -16,7 +16,6 @@ chown 8005:8005 /srv/crisiscleanup/conf cp -r /var/lib/lxc/crisiscleanup/crisiscleanup/srv/crisiscleanup/config/. /srv/crisiscleanup/conf # Configure CrisisCleanup -cp ${SOURCE_DIR}/srv/crisiscleanup/update-conf.sh /srv/crisiscleanup/update-conf.sh export CRISISCLEANUP_ADMIN_USER="Admin" export CRISISCLEANUP_ADMIN_EMAIL="admin@example.com" export CRISISCLEANUP_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) @@ -35,5 +34,8 @@ lxc-execute crisiscleanup -- rake db:seed cp ${SOURCE_DIR}/etc/init.d/crisiscleanup /etc/init.d/crisiscleanup rc-update -u +# Install config update script +cp ${SOURCE_DIR}/srv/crisiscleanup/update-conf.sh /srv/crisiscleanup/update-conf.sh + # Stop services required for setup [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/cts/setup.sh b/cts/setup.sh index 3c57745..c42b097 100755 --- a/cts/setup.sh +++ b/cts/setup.sh @@ -15,7 +15,6 @@ mkdir -p /srv/cts/conf cp /var/lib/lxc/cts/cts/srv/cts/cts/settings/base.py /srv/cts/conf # Configure CTS -cp ${SOURCE_DIR}/srv/cts/update-conf.sh /srv/cts/update-conf.sh export CTS_SECRET=$(head -c 26 /dev/urandom | base64) envsubst <${SOURCE_DIR}/srv/cts/conf/spotter.py >/srv/cts/conf/spotter.py touch /srv/cts/conf/__init__.py @@ -40,5 +39,8 @@ vmmgr update-login cts "${CTS_ADMIN_EMAIL}" "${CTS_ADMIN_PWD}" cp ${SOURCE_DIR}/etc/init.d/cts /etc/init.d/cts rc-update -u +# Install config update script +cp ${SOURCE_DIR}/srv/cts/update-conf.sh /srv/cts/update-conf.sh + # Stop services required for setup [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/gnuhealth/setup.sh b/gnuhealth/setup.sh index 5e5beaa..04e421f 100755 --- a/gnuhealth/setup.sh +++ b/gnuhealth/setup.sh @@ -12,7 +12,6 @@ envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- ps # Configure GNU Health mkdir -p /srv/gnuhealth/conf/ -cp ${SOURCE_DIR}/srv/gnuhealth/update-conf.sh /srv/gnuhealth/update-conf.sh envsubst <${SOURCE_DIR}/srv/gnuhealth/conf/trytond.conf >/srv/gnuhealth/conf/trytond.conf # Populate database @@ -32,5 +31,8 @@ rm -f /tmp/gnuhealth_demo.sql.gz cp ${SOURCE_DIR}/etc/init.d/gnuhealth /etc/init.d/gnuhealth rc-update -u +# Install config update script +cp ${SOURCE_DIR}/srv/gnuhealth/update-conf.sh /srv/gnuhealth/update-conf.sh + # Stop services required for setup [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/kanboard/setup.sh b/kanboard/setup.sh index 6e00955..d10e3cc 100755 --- a/kanboard/setup.sh +++ b/kanboard/setup.sh @@ -13,7 +13,6 @@ cat /var/lib/lxc/kanboard/kanboard/srv/kanboard/app/Schema/Sql/postgres.sql | lx # Configure Kanboard mkdir -p /srv/kanboard/conf /srv/kanboard/data -cp ${SOURCE_DIR}/srv/kanboard/update-conf.sh /srv/kanboard/update-conf.sh chown -R 8009:8009 /srv/kanboard/data envsubst <${SOURCE_DIR}/srv/kanboard/conf/config.php >/srv/kanboard/conf/config.php export KANBOARD_ADMIN_USER=admin @@ -22,12 +21,15 @@ export KANBOARD_ADMIN_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('${K envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql kanboard vmmgr update-login kanboard "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}" +# Install cron job +cp ${SOURCE_DIR}/etc/periodic/daily/kanboard /etc/periodic/daily/kanboard + # Install service cp ${SOURCE_DIR}/etc/init.d/kanboard /etc/init.d/kanboard rc-update -u -# Install cron job -cp ${SOURCE_DIR}/etc/periodic/daily/kanboard /etc/periodic/daily/kanboard +# Install config update script +cp ${SOURCE_DIR}/srv/kanboard/update-conf.sh /srv/kanboard/update-conf.sh # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/mifosx/setup.sh b/mifosx/setup.sh index 3e09ab2..6fb76cd 100755 --- a/mifosx/setup.sh +++ b/mifosx/setup.sh @@ -16,7 +16,6 @@ envsubst <${SOURCE_DIR}/schemapwd.sql | lxc-attach mariadb -- mysql mifosplatfor # Configure Mifos X mkdir -p /srv/mifosx/conf -cp ${SOURCE_DIR}/srv/mifosx/update-conf.sh /srv/mifosx/update-conf.sh envsubst <${SOURCE_DIR}/srv/mifosx/conf/context.xml >/srv/mifosx/conf/context.xml cp ${SOURCE_DIR}/srv/mifosx/conf/server.xml /srv/mifosx/conf/server.xml @@ -42,5 +41,8 @@ export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{ envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach mariadb -- mysql mifostenant-default vmmgr update-login mifosx "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}" +# Install config update script +cp ${SOURCE_DIR}/srv/mifosx/update-conf.sh /srv/mifosx/update-conf.sh + # Stop services required for setup [ ! -z ${STOP_MARIADB} ] && service mariadb stop diff --git a/mifosx/setup/srv/mifosx/update-conf.sh b/mifosx/setup/srv/mifosx/update-conf.sh index d4f338e..231ac61 100755 --- a/mifosx/setup/srv/mifosx/update-conf.sh +++ b/mifosx/setup/srv/mifosx/update-conf.sh @@ -3,5 +3,5 @@ sed -i "s|\(^\s\+proxyName=\).*|\1\"${DOMAIN}\"|" /srv/mifosx/conf/server.xml sed -i "s|\(^\s\+proxyPort=\).*|\1\"${PORT}\"|" /srv/mifosx/conf/server.xml -QUERY="UPDATE \`c_external_service_properties\` SET `value` = '${EMAIL}' WHERE \`external_service_id\` = 2 and \`name\` LIKE 'username'" +QUERY="UPDATE \`c_external_service_properties\` SET \`value\` = '${EMAIL}' WHERE \`external_service_id\` = 2 and \`name\` LIKE 'username'" lxc-attach mariadb -- mysql -e "${QUERY}" mifostenant-default diff --git a/motech/setup.sh b/motech/setup.sh index 183a762..7f83459 100755 --- a/motech/setup.sh +++ b/motech/setup.sh @@ -13,7 +13,6 @@ envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- ps # Configure Motech mkdir -p /srv/motech/conf/config/org.motechproject.motech-platform-email -cp ${SOURCE_DIR}/srv/motech/update-conf.sh /srv/motech/update-conf.sh envsubst <${SOURCE_DIR}/srv/motech/conf/config/bootstrap.properties >/srv/motech/conf/config/bootstrap.properties cp ${SOURCE_DIR}/srv/motech/conf/config-locations.properties /srv/motech/conf/config-locations.properties cp ${SOURCE_DIR}/srv/motech/conf/config/motech-settings.properties /srv/motech/conf/config/motech-settings.properties @@ -38,6 +37,9 @@ curl -H "Content-Type: application/json" -X POST -d "{\"adminLogin\":\"${MOTECH_ service motech stop vmmgr update-login motech "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}" +# Install config update script +cp ${SOURCE_DIR}/srv/motech/update-conf.sh /srv/motech/update-conf.sh + # Stop services required for build [ ! -z ${STOP_ACTIVEMQ} ] && service activemq stop [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/opendatakit/setup.sh b/opendatakit/setup.sh index 27773ac..802b929 100755 --- a/opendatakit/setup.sh +++ b/opendatakit/setup.sh @@ -12,7 +12,6 @@ envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- ps # Configure OpenDataKit mkdir -p /srv/opendatakit/conf -cp ${SOURCE_DIR}/srv/opendatakit/update-conf.sh /srv/opendatakit/update-conf.sh envsubst <${SOURCE_DIR}/srv/opendatakit/conf/jdbc.properties >/srv/opendatakit/conf/jdbc.properties envsubst <${SOURCE_DIR}/srv/opendatakit/conf/security.properties >/srv/opendatakit/conf/security.properties cp ${SOURCE_DIR}/srv/opendatakit/conf/server.xml /srv/opendatakit/conf/server.xml @@ -39,5 +38,8 @@ export OPENDATAKIT_ADMIN_DIGEST_HASH=$(echo -n "${OPENDATAKIT_ADMIN_USER}:${OPEN envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql opendatakit vmmgr update-login opendatakit "${OPENDATAKIT_ADMIN_USER}" "${OPENDATAKIT_ADMIN_PWD}" +# Install config update script +cp ${SOURCE_DIR}/srv/opendatakit/update-conf.sh /srv/opendatakit/update-conf.sh + # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/pandora/setup.sh b/pandora/setup.sh index 0c79398..36465d7 100755 --- a/pandora/setup.sh +++ b/pandora/setup.sh @@ -19,7 +19,6 @@ lxc-attach rabbitmq -- rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" # Configure Pandora mkdir -p /srv/pandora/conf /srv/pandora/data -cp ${SOURCE_DIR}/srv/pandora/update-conf.sh /srv/pandora/update-conf.sh chown 8002:8002 /srv/pandora/data # Copy customized configuration if VANILLA environment variable is not set, else use the default pandora config if [ ${VANILLA:-0} -eq 0 ]; then @@ -54,6 +53,9 @@ vmmgr update-login pandora "${PANDORA_ADMIN_USER}" "${PANDORA_ADMIN_PWD}" cp ${SOURCE_DIR}/etc/init.d/pandora /etc/init.d/pandora rc-update -u +# Install config update script +cp ${SOURCE_DIR}/srv/pandora/update-conf.sh /srv/pandora/update-conf.sh + # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop [ ! -z ${STOP_RABBITMQ} ] && service rabbitmq stop diff --git a/sahana-demo/setup.sh b/sahana-demo/setup.sh index 7c21092..384a8ea 100755 --- a/sahana-demo/setup.sh +++ b/sahana-demo/setup.sh @@ -18,7 +18,6 @@ cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/models/. /srv/sah cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/modules/templates/${TEMPLATE}/. /srv/sahana-demo/data/${TEMPLATE} # Configure Sahana -cp ${SOURCE_DIR}/srv/sahana-demo/update-conf.sh /srv/sahana-demo/update-conf.sh export SAHANADEMO_HMAC=$(head -c 18 /dev/urandom | base64) export SAHANADEMO_ADMIN_USER=admin@example.com export SAHANADEMO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) @@ -37,5 +36,8 @@ rm /var/lib/lxc/sahana/sahana/tmp/masterUsers.csv envsubst <${SOURCE_DIR}/etc/init.d/sahana-demo >/etc/init.d/sahana-demo chmod +x /etc/init.d/sahana-demo +# Install config update script +cp ${SOURCE_DIR}/srv/sahana-demo/update-conf.sh /srv/sahana-demo/update-conf.sh + # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/sahana/setup.sh b/sahana/setup.sh index 8b2775f..7ebb190 100755 --- a/sahana/setup.sh +++ b/sahana/setup.sh @@ -20,7 +20,6 @@ cp -r ${SOURCE_DIR}/srv/sahana/data/Spotter /srv/sahana/data/ chown -R 8001:8001 /srv/sahana/data # Configure Sahana -cp ${SOURCE_DIR}/srv/sahana/update-conf.sh /srv/sahana/update-conf.sh export SAHANA_HMAC=$(head -c 18 /dev/urandom | base64) export SAHANA_ADMIN_USER=admin@example.com export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) @@ -43,5 +42,8 @@ fi cp ${SOURCE_DIR}/etc/init.d/sahana /etc/init.d/sahana rc-update -u +# Install config update script +cp ${SOURCE_DIR}/srv/sahana/update-conf.sh /srv/sahana/update-conf.sh + # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/sambro/setup.sh b/sambro/setup.sh index 1d7e98d..46d702a 100755 --- a/sambro/setup.sh +++ b/sambro/setup.sh @@ -17,7 +17,6 @@ cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/models/. /srv/sah cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/modules/templates/SAMBRO/. /srv/sahana-demo/data/SAMBRO # Configure SAMBRO -cp ${SOURCE_DIR}/srv/sambro/update-conf.sh /srv/sambro/update-conf.sh export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64) export SAMBRO_ADMIN_USER=admin@example.com export SAMBRO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) @@ -42,5 +41,8 @@ fi cp ${SOURCE_DIR}/etc/init.d/sambro /etc/init.d/sambro rc-update -u +# Install config update script +cp ${SOURCE_DIR}/srv/sambro/update-conf.sh /srv/sambro/update-conf.sh + # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/seeddms/setup.sh b/seeddms/setup.sh index 5222dea..7513668 100755 --- a/seeddms/setup.sh +++ b/seeddms/setup.sh @@ -19,7 +19,6 @@ cp -rp /var/lib/lxc/seeddms/seeddms/srv/seeddms/data/. /srv/seeddms/data chown -R 8010:8010 /srv/seeddms/data # Configure SeedDMS -cp ${SOURCE_DIR}/srv/seeddms/update-conf.sh /srv/seeddms/update-conf.sh envsubst <${SOURCE_DIR}/srv/seeddms/conf/settings.xml >/srv/seeddms/conf/settings.xml export SEEDDMS_ADMIN_USER=admin export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) @@ -28,12 +27,15 @@ envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- ps chown -R 8010:8010 /srv/seeddms/conf vmmgr update-login seeddms "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}" +# Install cron job +cp ${SOURCE_DIR}/etc/periodic/hourly/seeddms /etc/periodic/hourly/seeddms + # Install service cp ${SOURCE_DIR}/etc/init.d/seeddms /etc/init.d/seeddms rc-update -u -# Install cron job -cp ${SOURCE_DIR}/etc/periodic/hourly/seeddms /etc/periodic/hourly/seeddms +# Install config update script +cp ${SOURCE_DIR}/srv/seeddms/update-conf.sh /srv/seeddms/update-conf.sh # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/sigmah/setup.sh b/sigmah/setup.sh index 406fba0..3ca113c 100755 --- a/sigmah/setup.sh +++ b/sigmah/setup.sh @@ -12,7 +12,6 @@ envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- ps # Configure Sigmah mkdir -p /srv/sigmah/conf /srv/sigmah/data/files /srv/sigmah/data/archives -cp ${SOURCE_DIR}/srv/sigmah/update-conf.sh /srv/sigmah/update-conf.sh chown -R 8011:8011 /srv/sigmah/data envsubst <${SOURCE_DIR}/srv/sigmah/conf/persistence.xml >/srv/sigmah/conf/persistence.xml cp ${SOURCE_DIR}/srv/sigmah/conf/sigmah.properties /srv/sigmah/conf/sigmah.properties @@ -42,5 +41,8 @@ vmmgr update-login sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" cp ${SOURCE_DIR}/etc/init.d/sigmah /etc/init.d/sigmah rc-update -u +# Install config update script +cp ${SOURCE_DIR}/srv/sigmah/update-conf.sh /srv/sigmah/update-conf.sh + # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/ushahidi/setup.sh b/ushahidi/setup.sh index 0ea34a2..196f086 100755 --- a/ushahidi/setup.sh +++ b/ushahidi/setup.sh @@ -12,7 +12,6 @@ envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach mariadb -- mysql # Configure Ushahidi mkdir -p /srv/ushahidi/conf /srv/ushahidi/data -cp ${SOURCE_DIR}/srv/ushahidi/update-conf.sh /srv/ushahidi/update-conf.sh chown 8014:8014 /srv/ushahidi/data envsubst <${SOURCE_DIR}/srv/ushahidi/conf/env >/srv/ushahidi/conf/env cp ${SOURCE_DIR}/srv/ushahidi/conf/config.json /srv/ushahidi/conf/config.json @@ -27,12 +26,15 @@ export USHAHIDI_ADMIN_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('${U envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach mariadb -- mysql ushahidi vmmgr update-login ushahidi "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}" +# Install cron job +cp ${SOURCE_DIR}/etc/periodic/15min/ushahidi /etc/periodic/15min/ushahidi + # Install service cp ${SOURCE_DIR}/etc/init.d/ushahidi /etc/init.d/ushahidi rc-update -u -# Install cron job -cp ${SOURCE_DIR}/etc/periodic/15min/ushahidi /etc/periodic/15min/ushahidi +# Install config update script +cp ${SOURCE_DIR}/srv/ushahidi/update-conf.sh /srv/ushahidi/update-conf.sh # Stop services required for build [ ! -z ${STOP_MARIADB} ] && service mariadb stop