Spotter-VM/lxc-apps/ecogis/install.sh

27 lines
688 B
Bash
Raw Normal View History

#!/bin/sh
set -ev
cd $(realpath $(dirname "${0}"))/install
# Check prerequisites
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
# Populate database
2019-06-05 18:55:15 +02:00
export ECOGIS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
# Configure EcoGIS
mkdir -p /srv/ecogis/conf
envsubst <srv/ecogis/conf/config.php >/srv/ecogis/conf/config.php
chown -R 8020:8020 /srv/ecogis/conf
# Install service
cp etc/init.d/ecogis /etc/init.d/ecogis
rc-update -u
# Stop services required for build
[ ! -z ${STOP_POSTGRES} ] && service postgres stop
# Register application
2019-02-26 21:12:41 +01:00
vmmgr register-app ecogis ecogis