eliminate SOURCE_DIR

This commit is contained in:
Disassembler 2018-10-25 22:22:36 +02:00
parent 7df7428acf
commit 396653c9a6
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
26 changed files with 166 additions and 166 deletions

View File

@ -4,31 +4,31 @@ set -e
# For production builds change to DEBUG=0 or comment the line entirely
export DEBUG=1
SOURCE_DIR=$(realpath $(dirname "${0}"))
cd $(realpath $(dirname "${0}"))
# Install shared packages and perform OS customization
${SOURCE_DIR}/basic.sh
${SOURCE_DIR}/basic-runtimes.sh
./basic.sh
./basic-runtimes.sh
# Install applications
${SOURCE_DIR}/ckan.sh
# ${SOURCE_DIR}/crisiscleanup.sh
# ${SOURCE_DIR}/cts.sh
${SOURCE_DIR}/frontlinesms.sh
${SOURCE_DIR}/gnuhealth.sh
${SOURCE_DIR}/kanboard.sh
${SOURCE_DIR}/mifosx.sh
${SOURCE_DIR}/motech.sh
${SOURCE_DIR}/opendatakit-build.sh
${SOURCE_DIR}/opendatakit.sh
${SOURCE_DIR}/openmapkit.sh
${SOURCE_DIR}/pandora.sh
${SOURCE_DIR}/sahana.sh
${SOURCE_DIR}/sahana-demo.sh
${SOURCE_DIR}/sambro.sh
${SOURCE_DIR}/seeddms.sh
${SOURCE_DIR}/sigmah.sh
${SOURCE_DIR}/ushahidi.sh
./ckan.sh
# ./crisiscleanup.sh
# ./cts.sh
./frontlinesms.sh
./gnuhealth.sh
./kanboard.sh
./mifosx.sh
./motech.sh
./opendatakit-build.sh
./opendatakit.sh
./openmapkit.sh
./pandora.sh
./sahana.sh
./sahana-demo.sh
./sambro.sh
./seeddms.sh
./sigmah.sh
./ushahidi.sh
# Perform cleanup only if DEBUG mode is not set
[ ${DEBUG:-0} -eq 1 ] && exit 0

View File

@ -1,12 +1,12 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Configure ActiveMQ
mkdir -p /srv/activemq/data
chown -R 61616:61616 /srv/activemq/data
# Create service
cp ${SOURCE_DIR}/etc/init.d/activemq /etc/init.d/activemq
cp etc/init.d/activemq /etc/init.d/activemq
rc-update -u

View File

@ -1,17 +1,17 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Configure CKAN DataPusher
mkdir -p /srv/ckan-datapusher/conf /srv/ckan-datapusher/data
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
cp srv/ckan-datapusher/conf/datapusher.wsgi /srv/ckan-datapusher/conf/datapusher.wsgi
cp srv/ckan-datapusher/conf/datapusher_settings.py /srv/ckan-datapusher/conf/datapusher_settings.py
chown -R 8004:8004 /srv/ckan-datapusher/data
# Install service
cp ${SOURCE_DIR}/etc/init.d/ckan-datapusher /etc/init.d/ckan-datapusher
cp 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
cp srv/ckan-datapusher/update-conf.sh /srv/ckan-datapusher/update-conf.sh

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
@ -11,12 +11,12 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Create database
export CKAN_PWD=$(head -c 18 /dev/urandom | base64)
export CKAN_DS_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Configure CKAN Solr core
lxc-attach -u 8983 -g 8983 solr -- solr create -p 8983 -c ckan
cp ${SOURCE_DIR}/srv/solr/data/ckan/conf/schema.xml /srv/solr/data/ckan/conf/schema.xml
cp ${SOURCE_DIR}/srv/solr/data/ckan/conf/solrconfig.xml /srv/solr/data/ckan/conf/solrconfig.xml
cp srv/solr/data/ckan/conf/schema.xml /srv/solr/data/ckan/conf/schema.xml
cp srv/solr/data/ckan/conf/solrconfig.xml /srv/solr/data/ckan/conf/solrconfig.xml
chown 8983:8983 /srv/solr/data/ckan/conf/schema.xml
service solr restart
@ -24,8 +24,8 @@ service solr restart
mkdir -p /srv/ckan/conf /srv/ckan/data
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
cp ${SOURCE_DIR}/srv/ckan/conf/who.ini /srv/ckan/conf/who.ini
envsubst <srv/ckan/conf/ckan.ini >/srv/ckan/conf/ckan.ini
cp srv/ckan/conf/who.ini /srv/ckan/conf/who.ini
chown -R 8003:8003 /srv/ckan/data
# Set "production values" (increases performance) only if the DEBUG environment variable is not set
@ -45,18 +45,18 @@ export CKAN_ADMIN_APIKEY=$(cat /proc/sys/kernel/random/uuid)
export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export CKAN_ADMIN_HASH=$(lxc-execute ckan -- python -c "from passlib.hash import pbkdf2_sha512;print pbkdf2_sha512.encrypt('${CKAN_ADMIN_PWD}')")
export CKAN_ADMIN_EMAIL="admin@example.com"
envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql ckan
envsubst <adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql ckan
vmmgr update-login ckan "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}"
# Install cron job
cp ${SOURCE_DIR}/etc/periodic/hourly/ckan /etc/periodic/hourly/ckan
cp etc/periodic/hourly/ckan /etc/periodic/hourly/ckan
# Install service
cp ${SOURCE_DIR}/etc/init.d/ckan /etc/init.d/ckan
cp 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
cp srv/ckan/update-conf.sh /srv/ckan/update-conf.sh
# Stop services required for setup
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,14 +1,14 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create database
export CRISISCLEANUP_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Copy existing config files into persistent storage
mkdir -p /srv/crisiscleanup/conf
@ -19,23 +19,23 @@ cp -r /var/lib/lxc/crisiscleanup/crisiscleanup/srv/crisiscleanup/config/. /srv/c
export CRISISCLEANUP_ADMIN_USER="Admin"
export CRISISCLEANUP_ADMIN_EMAIL="admin@example.com"
export CRISISCLEANUP_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/srv/crisiscleanup/conf/database.yml >/srv/crisiscleanup/conf/database.yml
cp ${SOURCE_DIR}/srv/crisiscleanup/conf/boot.rb /srv/crisiscleanup/conf/boot.rb
cp ${SOURCE_DIR}/srv/crisiscleanup/conf/initializers/devise.rb /srv/crisiscleanup/conf/initializers/devise.rb
cp ${SOURCE_DIR}/srv/crisiscleanup/conf/environments/production.rb /srv/crisiscleanup/conf/environments/production.rb
envsubst <srv/crisiscleanup/conf/database.yml >/srv/crisiscleanup/conf/database.yml
cp srv/crisiscleanup/conf/boot.rb /srv/crisiscleanup/conf/boot.rb
cp srv/crisiscleanup/conf/initializers/devise.rb /srv/crisiscleanup/conf/initializers/devise.rb
cp srv/crisiscleanup/conf/environments/production.rb /srv/crisiscleanup/conf/environments/production.rb
vmmgr update-login crisiscleanup "${CRISISCLEANUP_ADMIN_EMAIL}" "${CRISISCLEANUP_ADMIN_PWD}"
# Populate database
envsubst <${SOURCE_DIR}/srv/crisiscleanup/db/seeds.rb >/var/lib/lxc/crisiscleanup/crisiscleanup/srv/crisiscleanup/db/seeds.rb
envsubst <srv/crisiscleanup/db/seeds.rb >/var/lib/lxc/crisiscleanup/crisiscleanup/srv/crisiscleanup/db/seeds.rb
lxc-execute crisiscleanup -- rake db:schema:load
lxc-execute crisiscleanup -- rake db:seed
# Install service
cp ${SOURCE_DIR}/etc/init.d/crisiscleanup /etc/init.d/crisiscleanup
cp 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
cp srv/crisiscleanup/update-conf.sh /srv/crisiscleanup/update-conf.sh
# Stop services required for setup
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,14 +1,14 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create database
export CTS_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Copy existing config files into persistent storage
mkdir -p /srv/cts/conf
@ -16,7 +16,7 @@ cp /var/lib/lxc/cts/cts/srv/cts/cts/settings/base.py /srv/cts/conf
# Configure CTS
export CTS_SECRET=$(head -c 26 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/srv/cts/conf/spotter.py >/srv/cts/conf/spotter.py
envsubst <srv/cts/conf/spotter.py >/srv/cts/conf/spotter.py
touch /srv/cts/conf/__init__.py
# Set "production values" (increases performance) only if the DEBUG environment variable is not set
@ -32,15 +32,15 @@ export CTS_ADMIN_EMAIL=admin@example.com
export CTS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export CTS_ADMIN_HASH=$(lxc-execute cts -- python -c "from django.contrib.auth.hashers import make_password; print make_password('${CTS_ADMIN_PWD}')")
export CTS_ADMIN_SECRET=$(head -c 12 /dev/urandom | sha256sum | cut -c1-13)
envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql cts
envsubst <adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql cts
vmmgr update-login cts "${CTS_ADMIN_EMAIL}" "${CTS_ADMIN_PWD}"
# Install service
cp ${SOURCE_DIR}/etc/init.d/cts /etc/init.d/cts
cp 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
cp srv/cts/update-conf.sh /srv/cts/update-conf.sh
# Stop services required for setup
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Configure FrontlineSMS
mkdir -p /srv/frontlinesms/data
@ -9,10 +9,10 @@ export FRONTLINESMS_ADMIN_USER="admin"
export FRONTLINESMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export FRONTLINESMS_ADMIN_USER_HASH=$(echo -n "${FRONTLINESMS_ADMIN_USER}" | base64)
export FRONTLINESMS_ADMIN_PWD_HASH=$(echo -n "${FRONTLINESMS_ADMIN_PWD}" | base64)
envsubst <${SOURCE_DIR}/srv/frontlinesms/data/app-settings.properties >/srv/frontlinesms/data/app-settings.properties
envsubst <srv/frontlinesms/data/app-settings.properties >/srv/frontlinesms/data/app-settings.properties
chown -R 8018:8018 /srv/frontlinesms/data
vmmgr update-login frontlinesms "${FRONTLINESMS_ADMIN_USER}" "${FRONTLINESMS_ADMIN_PWD}"
# Install service
cp ${SOURCE_DIR}/etc/init.d/frontlinesms /etc/init.d/frontlinesms
cp etc/init.d/frontlinesms /etc/init.d/frontlinesms
rc-update -u

View File

@ -1,18 +1,18 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create databases
export GNUHEALTH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '/+=')
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Configure GNU Health
mkdir -p /srv/gnuhealth/conf/
envsubst <${SOURCE_DIR}/srv/gnuhealth/conf/trytond.conf >/srv/gnuhealth/conf/trytond.conf
envsubst <srv/gnuhealth/conf/trytond.conf >/srv/gnuhealth/conf/trytond.conf
# Populate database
export GNUHEALTH_ADMIN_USER="admin"
@ -28,11 +28,11 @@ zcat /tmp/gnuhealth_demo.sql.gz | lxc-attach -u 5432 -g 5432 postgres -- sh -c "
rm -f /tmp/gnuhealth_demo.sql.gz
# Install service
cp ${SOURCE_DIR}/etc/init.d/gnuhealth /etc/init.d/gnuhealth
cp 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
cp srv/gnuhealth/update-conf.sh /srv/gnuhealth/update-conf.sh
# Stop services required for setup
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,35 +1,35 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Populate database
export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
cat /var/lib/lxc/kanboard/kanboard/srv/kanboard/app/Schema/Sql/postgres.sql | lxc-attach -u 5432 -g 5432 postgres -- sh -c "PGPASSWORD=${KANBOARD_PWD} psql kanboard kanboard"
# Configure Kanboard
mkdir -p /srv/kanboard/conf /srv/kanboard/data
chown -R 8009:8009 /srv/kanboard/data
envsubst <${SOURCE_DIR}/srv/kanboard/conf/config.php >/srv/kanboard/conf/config.php
envsubst <srv/kanboard/conf/config.php >/srv/kanboard/conf/config.php
export KANBOARD_ADMIN_USER=admin
export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export KANBOARD_ADMIN_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('${KANBOARD_ADMIN_PWD}'.encode(), bcrypt.gensalt()).decode().replace('2b', '2y'))")
envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql kanboard
envsubst <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
cp etc/periodic/daily/kanboard /etc/periodic/daily/kanboard
# Install service
cp ${SOURCE_DIR}/etc/init.d/kanboard /etc/init.d/kanboard
cp etc/init.d/kanboard /etc/init.d/kanboard
rc-update -u
# Install config update script
cp ${SOURCE_DIR}/srv/kanboard/update-conf.sh /srv/kanboard/update-conf.sh
cp srv/kanboard/update-conf.sh /srv/kanboard/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Create MariaDB instance
mkdir -p /srv/mariadb/conf /srv/mariadb/data
@ -9,7 +9,7 @@ chown 3306:3306 /srv/mariadb/data
lxc-execute mariadb -- mysql_install_db --user=mysql
# Configure MariaDB
cp ${SOURCE_DIR}/srv/mariadb/conf/my.cnf /srv/mariadb/conf/my.cnf
cp srv/mariadb/conf/my.cnf /srv/mariadb/conf/my.cnf
# Enable query logging. Only if the DEBUG environment variable is set
if [ ${DEBUG:-0} -eq 1 ]; then
@ -17,10 +17,10 @@ if [ ${DEBUG:-0} -eq 1 ]; then
fi
# Install service
cp ${SOURCE_DIR}/etc/init.d/mariadb /etc/init.d/mariadb
cp etc/init.d/mariadb /etc/init.d/mariadb
rc-update -u
# Configure MariaDB admin
service mariadb start
cat ${SOURCE_DIR}/adminpwd.sql | lxc-attach mariadb -- mysql
cat adminpwd.sql | lxc-attach mariadb -- mysql
service mariadb stop

View File

@ -1,26 +1,26 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1
# Create databases
export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach mariadb -- mysql
envsubst <createdb.sql | lxc-attach mariadb -- mysql
# Populate database
cat /var/lib/lxc/mifosx/mifosx/tmp/mifospltaform-tenants-first-time-install.sql | lxc-attach mariadb -- mysql mifosplatform-tenants
envsubst <${SOURCE_DIR}/schemapwd.sql | lxc-attach mariadb -- mysql mifosplatform-tenants
envsubst <schemapwd.sql | lxc-attach mariadb -- mysql mifosplatform-tenants
# Configure Mifos X
mkdir -p /srv/mifosx/conf
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
envsubst <srv/mifosx/conf/context.xml >/srv/mifosx/conf/context.xml
cp srv/mifosx/conf/server.xml /srv/mifosx/conf/server.xml
# Install service
cp ${SOURCE_DIR}/etc/init.d/mifosx /etc/init.d/mifosx
cp etc/init.d/mifosx /etc/init.d/mifosx
rc-update -u
# Populate database
@ -38,11 +38,11 @@ export MIFOSX_ADMIN_USER=admin
export MIFOSX_ADMIN_EMAIL=admin@example.com
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 | lxc-attach mariadb -- mysql mifostenant-default
envsubst <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
cp srv/mifosx/update-conf.sh /srv/mifosx/update-conf.sh
# Stop services required for setup
[ ! -z ${STOP_MARIADB} ] && service mariadb stop

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/activemq ] && service activemq start && STOP_ACTIVEMQ=1
@ -9,18 +9,18 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Create database
export MOTECH_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Configure Motech
mkdir -p /srv/motech/conf/config/org.motechproject.motech-platform-email
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
cp ${SOURCE_DIR}/srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties /srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties
envsubst <srv/motech/conf/config/bootstrap.properties >/srv/motech/conf/config/bootstrap.properties
cp srv/motech/conf/config-locations.properties /srv/motech/conf/config-locations.properties
cp srv/motech/conf/config/motech-settings.properties /srv/motech/conf/config/motech-settings.properties
cp srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties /srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties
chown -R 8013:8013 /srv/motech/conf
# Install service
cp ${SOURCE_DIR}/etc/init.d/motech /etc/init.d/motech
cp etc/init.d/motech /etc/init.d/motech
rc-update -u
# Populate database and create admin account
@ -38,7 +38,7 @@ 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
cp srv/motech/update-conf.sh /srv/motech/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_ACTIVEMQ} ] && service activemq stop

View File

@ -1,23 +1,23 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create databases
export OPENDATAKITBUILD_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres psql
# Configure OpenDataKit Build
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
envsubst <srv/opendatakit-build/conf/config.yml >/srv/opendatakit-build/conf/config.yml
lxc-execute opendatakit-build -- sh -c 'cd /srv/opendatakit-build; rake db:migrate'
# Install service
cp ${SOURCE_DIR}/etc/init.d/opendatakit-build /etc/init.d/opendatakit-build
cp etc/init.d/opendatakit-build /etc/init.d/opendatakit-build
rc-update -u
# Stop services required for build

View File

@ -1,26 +1,26 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create databases
export OPENDATAKIT_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Configure OpenDataKit
mkdir -p /srv/opendatakit/conf
export OPENDATAKIT_ADMIN_USER=admin
export OPENDATAKIT_ADMIN_REALM=spotter
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
envsubst <srv/opendatakit/conf/jdbc.properties >/srv/opendatakit/conf/jdbc.properties
envsubst <srv/opendatakit/conf/security.properties >/srv/opendatakit/conf/security.properties
cp srv/opendatakit/conf/server.xml /srv/opendatakit/conf/server.xml
chown -R 8015:8015 /srv/opendatakit/conf
# Install service
cp ${SOURCE_DIR}/etc/init.d/opendatakit /etc/init.d/opendatakit
cp etc/init.d/opendatakit /etc/init.d/opendatakit
rc-update -u
# Populate database
@ -35,11 +35,11 @@ export OPENDATAKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export OPENDATAKIT_ADMIN_SALT=$(head -c 4 /dev/urandom | hexdump -e '"%x"') # Must be 8 characters
export OPENDATAKIT_ADMIN_BASIC_HASH=$(echo -n "${OPENDATAKIT_ADMIN_PWD}{${OPENDATAKIT_ADMIN_SALT}}" | sha1sum | tr -d " -")
export OPENDATAKIT_ADMIN_DIGEST_HASH=$(echo -n "${OPENDATAKIT_ADMIN_USER}:${OPENDATAKIT_ADMIN_REALM}:${OPENDATAKIT_ADMIN_PWD}" | md5sum | tr -d " -")
envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql opendatakit
envsubst <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
cp srv/opendatakit/update-conf.sh /srv/opendatakit/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Configure OpenMapKit
export OPENMAPKIT_ADMIN_USER="admin"
@ -9,9 +9,9 @@ export OPENMAPKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
mkdir -p /srv/openmapkit/conf /srv/openmapkit/data
chown -R 8007:8007 /srv/openmapkit/data
cp -rp /var/lib/lxc/openmapkit/openmapkit/srv/openmapkit/data/. /srv/openmapkit/data
envsubst <${SOURCE_DIR}/srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js
envsubst <srv/openmapkit/conf/settings.js >/srv/openmapkit/conf/settings.js
vmmgr update-login openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}"
# Install service
cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit
cp etc/init.d/openmapkit /etc/init.d/openmapkit
rc-update -u

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
@ -9,7 +9,7 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
# Create PostgreSQL user and database
export PANDORA_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Configure RabbitMQ
export PANDORA_RABBIT_PWD=$(head -c 18 /dev/urandom | base64 | tr -d "/")
@ -22,13 +22,13 @@ mkdir -p /srv/pandora/conf /srv/pandora/data
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
cp ${SOURCE_DIR}/srv/pandora/conf/config.jsonc /srv/pandora/conf
cp srv/pandora/conf/config.jsonc /srv/pandora/conf
else
chown 8002:8002 /srv/pandora/conf
cp /var/lib/lxc/pandora/pandora/srv/pandora/pandora/config.pandora.jsonc /srv/pandora/conf
fi
cp ${SOURCE_DIR}/srv/pandora/conf/gunicorn_config.py /srv/pandora/conf/gunicorn_config.py
envsubst <${SOURCE_DIR}/srv/pandora/conf/local_settings.py >/srv/pandora/conf/local_settings.py
cp srv/pandora/conf/gunicorn_config.py /srv/pandora/conf/gunicorn_config.py
envsubst <srv/pandora/conf/local_settings.py >/srv/pandora/conf/local_settings.py
# Set "production values" (increases performance) only if the DEBUG environment variable is not set
if [ ${DEBUG:-0} -eq 0 ]; then
@ -46,15 +46,15 @@ export PANDORA_ADMIN_USER=admin
export PANDORA_ADMIN_EMAIL=admin@example.com
export PANDORA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export PANDORA_ADMIN_HASH=$(lxc-execute pandora -- sh -c "DJANGO_SETTINGS_MODULE=srv.pandora.pandora.settings python3 -c \"from django.contrib.auth.hashers import make_password; print(make_password('${PANDORA_ADMIN_PWD}'))\"")
envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql pandora
envsubst <adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql pandora
vmmgr update-login pandora "${PANDORA_ADMIN_USER}" "${PANDORA_ADMIN_PWD}"
# Install service
cp ${SOURCE_DIR}/etc/init.d/pandora /etc/init.d/pandora
cp 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
cp srv/pandora/update-conf.sh /srv/pandora/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Create Postgres instance
mkdir -p /srv/postgres/data
@ -10,8 +10,8 @@ chmod 700 /srv/postgres/data
lxc-execute -n postgres -- initdb -D /var/lib/postgresql
# Configure Postgres
cp ${SOURCE_DIR}/srv/postgres/data/postgresql.conf /srv/postgres/data/postgresql.conf
cp ${SOURCE_DIR}/srv/postgres/data/pg_hba.conf /srv/postgres/data/pg_hba.conf
cp srv/postgres/data/postgresql.conf /srv/postgres/data/postgresql.conf
cp srv/postgres/data/pg_hba.conf /srv/postgres/data/pg_hba.conf
# Enable query logging. Only if the DEBUG environment variable is set
if [ ${DEBUG:-0} -eq 1 ]; then
@ -20,5 +20,5 @@ if [ ${DEBUG:-0} -eq 1 ]; then
fi
# Install service
cp ${SOURCE_DIR}/etc/init.d/postgres /etc/init.d/postgres
cp etc/init.d/postgres /etc/init.d/postgres
rc-update -u

View File

@ -1,12 +1,12 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Create RabbitMQ directory structure
mkdir -p /srv/rabbitmq/data
chown 5672:5672 /srv/rabbitmq/data
# Install service
cp ${SOURCE_DIR}/etc/init.d/rabbitmq /etc/init.d/rabbitmq
cp etc/init.d/rabbitmq /etc/init.d/rabbitmq
rc-update -u

View File

@ -1,13 +1,13 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Configure Redis
mkdir -p /srv/redis/conf /srv/redis/data
cp ${SOURCE_DIR}/srv/redis/conf/redis.conf /srv/redis/conf/redis.conf
cp srv/redis/conf/redis.conf /srv/redis/conf/redis.conf
chown -R 6379:6379 /srv/redis/data
# Install service
cp ${SOURCE_DIR}/etc/init.d/redis /etc/init.d/redis
cp etc/init.d/redis /etc/init.d/redis
rc-update -u

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
export TEMPLATE=${TEMPLATE:-"default"}
# Check prerequisites
@ -9,7 +9,7 @@ export TEMPLATE=${TEMPLATE:-"default"}
# Create PostgreSQL user and database
export SAHANADEMO_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# 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}
@ -21,8 +21,8 @@ cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/modules/templates
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)
envsubst <${SOURCE_DIR}/srv/sahana-demo/conf/000_config.py >/srv/sahana-demo/conf/000_config.py
envsubst <${SOURCE_DIR}/masterUsers.csv >/var/lib/lxc/sahana/sahana/tmp/masterUsers.csv
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
vmmgr update-login sahana-demo "${SAHANADEMO_ADMIN_USER}" "${SAHANADEMO_ADMIN_PWD}"
# Replace template in LXC container mount definition
@ -33,11 +33,11 @@ lxc-execute -u 8001 -g 8001 sahana-demo -- sh -c 'cd /srv/web2py; cp /tmp/master
rm /var/lib/lxc/sahana/sahana/tmp/masterUsers.csv
# Install service
envsubst <${SOURCE_DIR}/etc/init.d/sahana-demo >/etc/init.d/sahana-demo
envsubst <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
cp srv/sahana-demo/update-conf.sh /srv/sahana-demo/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,14 +1,14 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create PostgreSQL user and database
export SAHANA_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Prepare persistent directory structure
mkdir -p /srv/sahana/conf /srv/sahana/data/databases /srv/sahana/data/uploads
@ -16,16 +16,16 @@ chown -R 8001:8001 /srv/sahana/conf
cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/models/. /srv/sahana/conf
# Copy Spotter template
cp -r ${SOURCE_DIR}/srv/sahana/data/Spotter /srv/sahana/data/
cp -r srv/sahana/data/Spotter /srv/sahana/data/
chown -R 8001:8001 /srv/sahana/data
# Configure Sahana
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)
envsubst <${SOURCE_DIR}/srv/sahana/conf/000_config.py >/srv/sahana/conf/000_config.py
envsubst <${SOURCE_DIR}/srv/sahana/data/Spotter/masterUsers.csv >/srv/sahana/data/Spotter/masterUsers.csv
cp ${SOURCE_DIR}/srv/sahana/conf/00_settings.py /srv/sahana/conf/00_settings.py
envsubst <srv/sahana/conf/000_config.py >/srv/sahana/conf/000_config.py
envsubst <srv/sahana/data/Spotter/masterUsers.csv >/srv/sahana/data/Spotter/masterUsers.csv
cp srv/sahana/conf/00_settings.py /srv/sahana/conf/00_settings.py
vmmgr update-login sahana "${SAHANA_ADMIN_USER}" "${SAHANA_ADMIN_PWD}"
# Populate database
@ -39,11 +39,11 @@ if [ ${DEBUG:-0} -eq 0 ]; then
fi
# Install service
cp ${SOURCE_DIR}/etc/init.d/sahana /etc/init.d/sahana
cp 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
cp srv/sahana/update-conf.sh /srv/sahana/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,14 +1,14 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create PostgreSQL user and database
export SAMBRO_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Prepare persistent directory structure
mkdir -p /srv/sambro/conf /srv/sambro/data/databases /srv/sambro/data/uploads /srv/sambro/data/SAMBRO
@ -20,10 +20,10 @@ cp -rp /var/lib/lxc/sahana/sahana/srv/web2py/applications/eden/modules/templates
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)
envsubst <${SOURCE_DIR}/srv/sambro/conf/000_config.py >/srv/sambro/conf/000_config.py
envsubst <${SOURCE_DIR}/masterUsers.csv >/var/lib/lxc/sahana/sahana/tmp/masterUsers.csv
cp ${SOURCE_DIR}/srv/sambro/conf/00_settings.py /srv/sambro/conf/00_settings.py
cp ${SOURCE_DIR}/srv/sambro/data/SAMBRO/config.py /srv/sambro/data/SAMBRO/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
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
vmmgr update-login sambro "${SAMBRO_ADMIN_USER}" "${SAMBRO_ADMIN_PWD}"
# Populate database
@ -38,11 +38,11 @@ if [ ${DEBUG:-0} -eq 0 ]; then
fi
# Install service
cp ${SOURCE_DIR}/etc/init.d/sambro /etc/init.d/sambro
cp 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
cp srv/sambro/update-conf.sh /srv/sambro/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,16 +1,16 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Populate database
export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
cat /var/lib/lxc/seeddms/seeddms/srv/seeddms/create_tables-postgres.sql | lxc-attach postgres -- sh -c "PGPASSWORD=${SEEDDMS_PWD} psql seeddms seeddms"
cat ${SOURCE_DIR}/custom.sql | lxc-attach -u 5432 -g 5432 postgres -- psql seeddms
cat custom.sql | lxc-attach -u 5432 -g 5432 postgres -- psql seeddms
# Copy existing files into persistent storage
mkdir -p /srv/seeddms/conf /srv/seeddms/data
@ -19,23 +19,23 @@ cp -rp /var/lib/lxc/seeddms/seeddms/srv/seeddms/data/. /srv/seeddms/data
chown -R 8010:8010 /srv/seeddms/data
# Configure SeedDMS
envsubst <${SOURCE_DIR}/srv/seeddms/conf/settings.xml >/srv/seeddms/conf/settings.xml
envsubst <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)
export SEEDDMS_ADMIN_EMAIL=admin@example.com
envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql seeddms
envsubst <adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql seeddms
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
cp etc/periodic/hourly/seeddms /etc/periodic/hourly/seeddms
# Install service
cp ${SOURCE_DIR}/etc/init.d/seeddms /etc/init.d/seeddms
cp etc/init.d/seeddms /etc/init.d/seeddms
rc-update -u
# Install config update script
cp ${SOURCE_DIR}/srv/seeddms/update-conf.sh /srv/seeddms/update-conf.sh
cp srv/seeddms/update-conf.sh /srv/seeddms/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,20 +1,20 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Create database
export SIGMAH_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Configure Sigmah
mkdir -p /srv/sigmah/conf /srv/sigmah/data/files /srv/sigmah/data/archives
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
envsubst <srv/sigmah/conf/persistence.xml >/srv/sigmah/conf/persistence.xml
cp srv/sigmah/conf/sigmah.properties /srv/sigmah/conf/sigmah.properties
cp /var/lib/lxc/sigmah/sigmah/srv/tomcat/webapps/sigmah/sigmah/images/header/org-default-logo.png /srv/sigmah/data/files/logo.png
# Populate database
@ -38,11 +38,11 @@ rm -f /tmp/sigmah-MinimumDataKit.sql /tmp/sigmah-newOrganizationLaunchScript.sql
vmmgr update-login sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}"
# Install service
cp ${SOURCE_DIR}/etc/init.d/sigmah /etc/init.d/sigmah
cp 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
cp srv/sigmah/update-conf.sh /srv/sigmah/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Configure Solr
mkdir -p /srv/solr/data
@ -9,5 +9,5 @@ cp /var/lib/lxc/solr/solr/opt/solr/server/solr/solr.xml /srv/solr/data/solr.xml
chown -R 8983:8983 /srv/solr/data
# Install service
cp ${SOURCE_DIR}/etc/init.d/solr /etc/init.d/solr
cp etc/init.d/solr /etc/init.d/solr
rc-update -u

View File

@ -1,20 +1,20 @@
#!/bin/sh
set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
cd $(realpath $(dirname "${0}"))/setup
# Check prerequisites
[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1
# Create database
export USHAHIDI_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach mariadb -- mysql
envsubst <createdb.sql | lxc-attach mariadb -- mysql
# Configure Ushahidi
mkdir -p /srv/ushahidi/conf /srv/ushahidi/data
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
envsubst <srv/ushahidi/conf/env >/srv/ushahidi/conf/env
cp srv/ushahidi/conf/config.json /srv/ushahidi/conf/config.json
# Populate database
lxc-execute ushahidi -- /srv/ushahidi/platform/bin/phinx migrate -c /srv/ushahidi/platform/application/phinx.php
@ -23,18 +23,18 @@ lxc-execute ushahidi -- /srv/ushahidi/platform/bin/phinx migrate -c /srv/ushahid
export USHAHIDI_ADMIN_USER=admin@example.com
export USHAHIDI_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export USHAHIDI_ADMIN_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('${USHAHIDI_ADMIN_PWD}'.encode(), bcrypt.gensalt()).decode().replace('2b', '2y'))")
envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach mariadb -- mysql ushahidi
envsubst <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
cp etc/periodic/15min/ushahidi /etc/periodic/15min/ushahidi
# Install service
cp ${SOURCE_DIR}/etc/init.d/ushahidi /etc/init.d/ushahidi
cp etc/init.d/ushahidi /etc/init.d/ushahidi
rc-update -u
# Install config update script
cp ${SOURCE_DIR}/srv/ushahidi/update-conf.sh /srv/ushahidi/update-conf.sh
cp srv/ushahidi/update-conf.sh /srv/ushahidi/update-conf.sh
# Stop services required for build
[ ! -z ${STOP_MARIADB} ] && service mariadb stop