diff --git a/00-install.sh b/00-install.sh index a74a09f..091c614 100755 --- a/00-install.sh +++ b/00-install.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e # For production builds change to DEBUG=0 or comment the line entirely export DEBUG=1 diff --git a/activemq.sh b/activemq.sh index f2910dc..2335f31 100755 --- a/activemq.sh +++ b/activemq.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/activemq diff --git a/basic-runtimes.sh b/basic-runtimes.sh index 2b137d9..8e27f51 100755 --- a/basic-runtimes.sh +++ b/basic-runtimes.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/basic-runtimes diff --git a/basic.sh b/basic.sh index 44b9f49..92c7df9 100755 --- a/basic.sh +++ b/basic.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/basic diff --git a/ckan-datapusher.sh b/ckan-datapusher.sh index 45c9931..23baea2 100755 --- a/ckan-datapusher.sh +++ b/ckan-datapusher.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/ckan-datapusher diff --git a/ckan.sh b/ckan.sh index 2ed65ca..17398cb 100755 --- a/ckan.sh +++ b/ckan.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/ckan @@ -60,3 +61,8 @@ spotter-appmgr update-login ckan "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}" # Install cron job cp ${SOURCE_DIR}/etc/periodic/hourly/ckan /etc/periodic/hourly/ckan + +# Stop services required for build +service solr stop +service redis stop +service postgres stop diff --git a/crisiscleanup.sh b/crisiscleanup.sh index 69f0e29..b8c1b04 100755 --- a/crisiscleanup.sh +++ b/crisiscleanup.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/crisiscleanup @@ -37,3 +38,6 @@ envsubst <${SOURCE_DIR}/srv/crisiscleanup/db/seeds.rb >/tmp/seeds.rb docker run --rm -h crisiscleanup --link postgres -v /srv/crisiscleanup/conf:/srv/crisiscleanup/config crisiscleanup rake db:schema:load docker run --rm -h crisiscleanup --link postgres -v /srv/crisiscleanup/conf:/srv/crisiscleanup/config -v /tmp/seeds.rb:/srv/crisiscleanup/db/seeds.rb crisiscleanup rake db:seed rm /tmp/seeds.rb + +# Stop services required for build +service postgres stop diff --git a/cts.sh b/cts.sh index 6e0fc67..2db03fa 100755 --- a/cts.sh +++ b/cts.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/cts @@ -39,3 +40,6 @@ export CTS_ADMIN_HASH=$(docker run --rm -h cts -v /srv/cts/conf:/srv/cts/cts/set export CTS_ADMIN_SECRET=$(head -c 12 /dev/urandom | sha256sum | cut -c1-13) envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql cts spotter-appmgr update-login cts "${CTS_ADMIN_EMAIL}" "${CTS_ADMIN_PWD}" + +# Stop services required for build +service postgres stop diff --git a/frontlinesms.sh b/frontlinesms.sh index b2f8725..62262c1 100755 --- a/frontlinesms.sh +++ b/frontlinesms.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/frontlinesms diff --git a/gnuhealth.sh b/gnuhealth.sh index 601799a..a781b23 100755 --- a/gnuhealth.sh +++ b/gnuhealth.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/gnuhealth @@ -32,3 +33,6 @@ spotter-appmgr update-login gnuhealth "${GNUHEALTH_ADMIN_USER}" "${GNUHEALTH_ADM wget http://health.gnu.org/downloads/postgres_dumps/gnuhealth-32-demo.sql.gz -O /tmp/gnuhealth_demo.sql.gz zcat /tmp/gnuhealth_demo.sql.gz | docker exec -i -e PGPASSWORD=${GNUHEALTH_PWD} postgres psql gnuhealth_demo gnuhealth rm -f /tmp/gnuhealth_demo.sql.gz + +# Stop services required for build +service postgres stop diff --git a/kanboard.sh b/kanboard.sh index 3530738..ab70a95 100755 --- a/kanboard.sh +++ b/kanboard.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/kanboard @@ -29,3 +30,6 @@ spotter-appmgr update-login kanboard "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_ # Install cron job cp ${SOURCE_DIR}/etc/periodic/daily/kanboard /etc/periodic/daily/kanboard + +# Stop services required for build +service postgres stop diff --git a/mariadb.sh b/mariadb.sh index 0f852a2..00f9062 100755 --- a/mariadb.sh +++ b/mariadb.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/mariadb @@ -23,3 +24,4 @@ fi # Configure MariaDB admin service mariadb start cat ${SOURCE_DIR}/adminpwd.sql | docker exec -i mariadb mysql +service mariadb stop diff --git a/mifosx.sh b/mifosx.sh index 83e672c..99020d8 100755 --- a/mifosx.sh +++ b/mifosx.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/mifosx @@ -32,6 +33,7 @@ echo `date` '- Waiting for database to be populated. This should take about a mi until docker logs mifosx 2>&1 | grep -q 'Migrating schema `mifostenant-default` to version 5000'; do sleep 1 done +service mifosx stop # Update admin account export MIFOSX_ADMIN_USER=admin @@ -40,3 +42,7 @@ export MIFOSX_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d "+") export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{print $1}') envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i mariadb mysql mifostenant-default spotter-appmgr update-login mifosx "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}" + +# Stop services required for build +service mariadb stop +service postfix stop diff --git a/motech.sh b/motech.sh index 3860edb..1603c42 100755 --- a/motech.sh +++ b/motech.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/motech @@ -37,4 +38,9 @@ export MOTECH_ADMIN_USER="admin" export MOTECH_ADMIN_EMAIL="admin@example.com" export MOTECH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) curl -H "Content-Type: application/json" -X POST -d "{\"adminLogin\":\"${MOTECH_ADMIN_USER}\",\"adminEmail\":\"${MOTECH_ADMIN_EMAIL}\",\"adminPassword\":\"${MOTECH_ADMIN_PWD}\",\"adminConfirmPassword\":\"${MOTECH_ADMIN_PWD}\",\"language\":\"cs\",\"providerName\":\"\",\"providerUrl\":\"\",\"schedulerUrl\":\"\"}" http://${MOTECH_IP}:8080/module/server/startup/ +service motech stop spotter-appmgr update-login motech "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}" + +# Stop services required for build +service activemq stop +service postgres stop diff --git a/opendatakit-build.sh b/opendatakit-build.sh index 4b9f597..60985c6 100755 --- a/opendatakit-build.sh +++ b/opendatakit-build.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/opendatakit-build @@ -20,3 +21,6 @@ export OPENDATAKITBUILD_COOKIE_SECRET=$(head -c 8 /dev/urandom | hexdump -e '"%x mkdir -p /srv/opendatakit-build/conf envsubst <${SOURCE_DIR}/srv/opendatakit-build/conf/config.yml >/srv/opendatakit-build/conf/config.yml docker run --rm -h opendatakit-build --link postgres -v /srv/opendatakit-build/conf/config.yml:/srv/opendatakit-build/config.yml -w /srv/opendatakit-build opendatakit-build rake db:migrate + +# Stop services required for build +service postgres stop diff --git a/opendatakit.sh b/opendatakit.sh index 620a740..de20f7a 100755 --- a/opendatakit.sh +++ b/opendatakit.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/opendatakit @@ -31,6 +32,7 @@ service opendatakit start until docker logs opendatakit 2>&1 | grep -q 'org.apache.catalina.startup.Catalina.start'; do sleep 1 done +service opendatakit stop # Update admin account export OPENDATAKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) @@ -39,3 +41,7 @@ export OPENDATAKIT_ADMIN_BASIC_HASH=$(echo -n "${OPENDATAKIT_ADMIN_PWD}{${OPENDA export OPENDATAKIT_ADMIN_DIGEST_HASH=$(echo -n "${OPENDATAKIT_ADMIN_USER}:${OPENDATAKIT_ADMIN_REALM}:${OPENDATAKIT_ADMIN_PWD}" | md5sum | tr -d " -") envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql opendatakit spotter-appmgr update-login opendatakit "${OPENDATAKIT_ADMIN_USER}" "${OPENDATAKIT_ADMIN_PWD}" + +# Stop services required for build +service postgres stop +service postfix stop diff --git a/openmapkit.sh b/openmapkit.sh index 1049fea..542755e 100755 --- a/openmapkit.sh +++ b/openmapkit.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/openmapkit diff --git a/pandora.sh b/pandora.sh index 158c589..ddce635 100755 --- a/pandora.sh +++ b/pandora.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/pandora @@ -55,3 +56,7 @@ export PANDORA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export PANDORA_ADMIN_HASH=$(docker run --rm -h pandora -e DJANGO_SETTINGS_MODULE=pandora.settings -v /srv/pandora/conf:/srv/pandora/conf pandora python3 -c "from django.contrib.auth.hashers import make_password; print(make_password('${PANDORA_ADMIN_PWD}'))") envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql pandora spotter-appmgr update-login pandora "${PANDORA_ADMIN_USER}" "${PANDORA_ADMIN_PWD}" + +# Stop services required for build +service rabbitmq stop +service postgres stop diff --git a/postfix.sh b/postfix.sh index 7e8ff88..b5fe698 100755 --- a/postfix.sh +++ b/postfix.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/postfix diff --git a/postgres.sh b/postgres.sh index 1141014..048abac 100755 --- a/postgres.sh +++ b/postgres.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/postgres diff --git a/rabbitmq.sh b/rabbitmq.sh index 719f472..7a01a9e 100755 --- a/rabbitmq.sh +++ b/rabbitmq.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/rabbitmq diff --git a/redis.sh b/redis.sh index 337ee4f..b106185 100755 --- a/redis.sh +++ b/redis.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/redis diff --git a/sahana-demo.sh b/sahana-demo.sh index aed3065..43df4f9 100755 --- a/sahana-demo.sh +++ b/sahana-demo.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/sahana-demo export TEMPLATE=${TEMPLATE:-"default"} @@ -35,3 +36,6 @@ spotter-appmgr update-login sahana-demo "${SAHANADEMO_ADMIN_USER}" "${SAHANADEMO # Populate database docker run --rm -h sahana-demo --link postgres -v /srv/sahana-demo/conf:/srv/web2py/applications/eden/models -v /srv/sahana-demo/data/databases:/srv/web2py/applications/eden/databases -v /tmp/masterUsers.csv:/srv/web2py/applications/eden/modules/templates/default/users/masterUsers.csv sahana su - sahana -c "./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py" rm /tmp/masterUsers.csv + +# Stop services required for build +service postgres stop diff --git a/sahana.sh b/sahana.sh index 46a9f06..fbb202f 100755 --- a/sahana.sh +++ b/sahana.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/sahana @@ -44,3 +45,6 @@ if [ ${DEBUG:-0} -eq 0 ]; then sed -i 's/settings.base.debug = True/settings.base.debug = False/' /srv/sahana/conf/000_config.py sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' /srv/sahana/conf/000_config.py fi + +# Stop services required for build +service postgres stop diff --git a/sambro.sh b/sambro.sh index a77ae2c..4518ddd 100755 --- a/sambro.sh +++ b/sambro.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/sambro @@ -43,3 +44,6 @@ if [ ${DEBUG:-0} -eq 0 ]; then sed -i 's/settings.base.debug = True/settings.base.debug = False/' /srv/sambro/conf/000_config.py sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' /srv/sambro/conf/000_config.py fi + +# Stop services required for build +service postgres stop diff --git a/seeddms.sh b/seeddms.sh index f919156..df2a0d5 100755 --- a/seeddms.sh +++ b/seeddms.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/seeddms @@ -34,3 +35,6 @@ spotter-appmgr update-login seeddms "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD # Install cron job cp ${SOURCE_DIR}/etc/periodic/hourly/seeddms /etc/periodic/hourly/seeddms + +# Stop services required for build +service postgres stop diff --git a/sigmah.sh b/sigmah.sh index 1ea8c7c..6e02069 100755 --- a/sigmah.sh +++ b/sigmah.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/sigmah @@ -44,3 +45,6 @@ cat /tmp/sigmah-MinimumDataKit.sql | docker exec -i -e PGPASSWORD=${SIGMAH_PWD} cat /tmp/sigmah-newOrganizationLaunchScript.sql | docker exec -i -e PGPASSWORD=${SIGMAH_PWD} postgres psql -U sigmah sigmah rm -f /tmp/sigmah-MinimumDataKit.sql /tmp/sigmah-newOrganizationLaunchScript.sql spotter-appmgr update-login sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" + +# Stop services required for build +service postgres stop diff --git a/solr.sh b/solr.sh index 14a9069..fdf23a3 100755 --- a/solr.sh +++ b/solr.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/solr diff --git a/ushahidi.sh b/ushahidi.sh index 4e94fb8..293561d 100755 --- a/ushahidi.sh +++ b/ushahidi.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e SOURCE_DIR=$(realpath $(dirname "${0}"))/ushahidi @@ -35,3 +36,6 @@ spotter-appmgr update-login ushahidi "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_ # Install cron job cp ${SOURCE_DIR}/etc/periodic/15min/ushahidi /etc/periodic/15min/ushahidi + +# Stop services required for build +service mariadb stop diff --git a/zz-cleanup.sh b/zz-cleanup.sh index 9421cbb..e87dc09 100755 --- a/zz-cleanup.sh +++ b/zz-cleanup.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -e # Remove packages not necessary for release apk --no-cache del .useful