2019-02-26 20:24:02 +01:00
|
|
|
#!/bin/sh
|
|
|
|
set -ev
|
|
|
|
|
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
|
2019-02-26 20:24:02 +01:00
|
|
|
|
|
|
|
# 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
|
2019-02-26 20:24:02 +01:00
|
|
|
|
|
|
|
# Configure EcoGIS
|
2019-10-03 20:09:58 +02:00
|
|
|
mkdir -p /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data
|
2019-10-03 20:35:51 +02:00
|
|
|
envsubst <ecogis_conf/config.php >/srv/ecogis/conf/config.php
|
2019-10-14 07:59:06 +02:00
|
|
|
chown -R 108080:108080 /srv/ecogis/ecogis_conf /srv/ecogis/ecogis_data
|
2019-02-26 20:24:02 +01:00
|
|
|
|
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
|
2019-02-26 20:24:02 +01:00
|
|
|
|
|
|
|
# Register application
|
2019-02-26 21:12:41 +01:00
|
|
|
vmmgr register-app ecogis ecogis
|