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

27 lines
674 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
export ECOGIS_PWD=$(head -c 18 /dev/urandom | base64)
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