#!/bin/sh set -ev cd $(realpath $(dirname "${0}"))/install # 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 export ECOGIS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') service ecogis-postgres start envsubst /srv/ecogis/conf/config.php chown -R 108080:108080 /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data # Stop services required for setup service ecogis-postgres stop # Register application vmmgr register-app ecogis ecogis