start/stop prepreqs

This commit is contained in:
Disassembler 2018-09-13 20:42:11 +02:00
parent 86f4f940c7
commit b7aedad589
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
5 changed files with 16 additions and 32 deletions

View File

@ -4,10 +4,9 @@ set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Check prerequisites
# TODO: Have setup prereqs in a manifest file
for SERVICE in postgres redis solr; do
[ ! -e /run/openrc/started/${SERVICE} ] && service ${SERVICE} start && STOP_SERVICES="${STOP_SERVICES} ${SERVICE}"
done
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
[ ! -e /run/openrc/started/redis ] && service redis start && STOP_REDIS=1
[ ! -e /run/openrc/started/solr ] && service solr start && STOP_SOLR=1
# Create database
export CKAN_PWD=$(head -c 18 /dev/urandom | base64)
@ -57,6 +56,6 @@ cp ${SOURCE_DIR}/etc/init.d/ckan /etc/init.d/ckan
rc-update -u
# Stop services required for setup
for SERVICE in ${STOP_SERVICES}; do
service ${SERVICE} stop
done
[ ! -z ${STOP_POSTGRES} ] && service postgres stop
[ ! -z ${STOP_REDIS} ] && service redis stop
[ ! -z ${STOP_SOLR} ] && service solr stop

View File

@ -4,10 +4,7 @@ set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Check prerequisites
# TODO: Have setup prereqs in a manifest file
for SERVICE in postgres; do
[ ! -e /run/openrc/started/${SERVICE} ] && service ${SERVICE} start && STOP_SERVICES="${STOP_SERVICES} ${SERVICE}"
done
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create database
export CRISISCLEANUP_PWD=$(head -c 18 /dev/urandom | base64)
@ -39,6 +36,4 @@ cp ${SOURCE_DIR}/etc/init.d/crisiscleanup /etc/init.d/crisiscleanup
rc-update -u
# Stop services required for setup
for SERVICE in ${STOP_SERVICES}; do
service ${SERVICE} stop
done
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -4,10 +4,7 @@ set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Check prerequisites
# TODO: Have setup prereqs in a manifest file
for SERVICE in postgres; do
[ ! -e /run/openrc/started/${SERVICE} ] && service ${SERVICE} start && STOP_SERVICES="${STOP_SERVICES} ${SERVICE}"
done
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create database
export CTS_PWD=$(head -c 18 /dev/urandom | base64)
@ -43,6 +40,4 @@ cp ${SOURCE_DIR}/etc/init.d/cts /etc/init.d/cts
rc-update -u
# Stop services required for setup
for SERVICE in ${STOP_SERVICES}; do
service ${SERVICE} stop
done
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -4,10 +4,7 @@ set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Check prerequisites
# TODO: Have setup prereqs in a manifest file
for SERVICE in postgres; do
[ ! -e /run/openrc/started/${SERVICE} ] && service ${SERVICE} start && STOP_SERVICES="${STOP_SERVICES} ${SERVICE}"
done
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create databases
export GNUHEALTH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '/+=')
@ -27,7 +24,7 @@ vmmgr update-login gnuhealth "${GNUHEALTH_ADMIN_USER}" "${GNUHEALTH_ADMIN_PWD}"
# Populate demo database
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 | lxc-attach -u 5432 -g 5432 postgres -- sh -c 'PGPASSWORD=${GNUHEALTH_PWD} psql gnuhealth_demo gnuhealth'
zcat /tmp/gnuhealth_demo.sql.gz | lxc-attach -u 5432 -g 5432 postgres -- sh -c "PGPASSWORD=${GNUHEALTH_PWD} psql gnuhealth_demo gnuhealth"
rm -f /tmp/gnuhealth_demo.sql.gz
# Install service
@ -35,6 +32,4 @@ cp ${SOURCE_DIR}/etc/init.d/gnuhealth /etc/init.d/gnuhealth
rc-update -u
# Stop services required for setup
for SERVICE in ${STOP_SERVICES}; do
service ${SERVICE} stop
done
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -16,9 +16,9 @@ ${SOURCE_DIR}/solr/setup.sh
${SOURCE_DIR}/ckan/setup.sh
${SOURCE_DIR}/crisiscleanup/setup.sh
${SOURCE_DIR}/cts/setup.sh
#${SOURCE_DIR}/frontlinesms/setup.sh
#${SOURCE_DIR}/gnuhealth/setup.sh
#${SOURCE_DIR}/kanboard/setup.sh
${SOURCE_DIR}/frontlinesms/setup.sh
${SOURCE_DIR}/gnuhealth/setup.sh
${SOURCE_DIR}/kanboard/setup.sh
#${SOURCE_DIR}/opendatakit/setup.sh
#${SOURCE_DIR}/opendatakit-build/setup.sh
#${SOURCE_DIR}/openmapkit/setup.sh