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

31 lines
967 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 <srv/ecogis/conf/config.php >/srv/ecogis/conf/config.php
2019-10-03 20:09:58 +02:00
chown -R 108020:108020 /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data
# Stop services required for build
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