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

32 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/sh
set -ev
2020-03-17 10:43:46 +01:00
# Volumes
POSTGRES_DATA="${VOLUMES_DIR}/ecogis/postgres_data"
ECOGIS_CONF="${VOLUMES_DIR}/ecogis/ecogis_conf"
ECOGIS_DATA="${VOLUMES_DIR}/ecogis/ecogis_data"
2019-10-03 20:09:58 +02:00
# Create Postgres instance
2020-03-17 10:43:46 +01:00
install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA}
spoc-container exec cts-postgres -- initdb -D /var/lib/postgresql
2019-10-03 20:09:58 +02:00
# Configure Postgres
2020-03-17 10:43:46 +01:00
install -o 105432 -g 105432 -m 600 postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf
install -o 105432 -g 105432 -m 600 postgres_data/pg_hba.conf ${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 '+/=')
2020-03-17 10:43:46 +01:00
spoc-container start ecogis-postgres
envsubst <createdb.sql | spoc-container exec ecogis-postgres -- psql
# Configure EcoGIS
2020-03-17 10:43:46 +01:00
install -o 108080 -g 108080 -m 750 ${ECOGIS_CONF}
install -o 108080 -g 108080 -m 750 ${ECOGIS_DATA}
envsubst <ecogis_conf/config.php | install -o 108080 -g 108080 -m 640 /dev/stdin ${ECOGIS_CONF}/config.php
2019-10-03 21:41:02 +02:00
# Stop services required for setup
2020-03-17 10:43:46 +01:00
spoc-container stop ecogis-postgres
# Register application
2019-02-26 21:12:41 +01:00
vmmgr register-app ecogis ecogis