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

31 lines
963 B
Bash
Raw Normal View History

#!/bin/sh
set -ev
cd $(realpath $(dirname "${0}"))/install
2019-10-03 20:09:58 +02:00
# Create Postgres instance
mkdir -p /srv/ecogis/postgres_data
chown -R 105432:105432 /srv/ecogis/postgres_data
chmod 700 /srv/ecogis/postgres_data
lxc-execute -n ecogis-postgres -- initdb -D /var/lib/postgresql
# Configure Postgres
cp postgres_data/postgresql.conf /srv/ecogis/postgres_data/postgresql.conf
cp postgres_data/pg_hba.conf /srv/ecogis/postgres_data/pg_hba.conf
# Populate database
2019-06-05 18:55:15 +02:00
export ECOGIS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
2019-10-03 20:09:58 +02:00
service ecogis-postgres start
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 ecogis-postgres -- psql
# Configure EcoGIS
2019-10-03 20:09:58 +02:00
mkdir -p /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data
envsubst <ecogis_conf/config.php >/srv/ecogis/conf/config.php
chown -R 108080:108080 /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data
2019-10-03 21:41:02 +02:00
# Stop services required for setup
2019-10-03 20:09:58 +02:00
service ecogis-postgres stop
# Register application
2019-02-26 21:12:41 +01:00
vmmgr register-app ecogis ecogis