#!/bin/sh set -ev # Create Postgres instance mkdir -p /srv/seeddms/postgres_data chown -R 105432:105432 /srv/seeddms/postgres_data chmod 700 /srv/seeddms/postgres_data lxc-execute -n seeddms-postgres -- initdb -D /var/lib/postgresql # Configure Postgres cp postgres_data/postgresql.conf /srv/seeddms/postgres_data/postgresql.conf cp postgres_data/pg_hba.conf /srv/seeddms/postgres_data/pg_hba.conf # Populate database export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') service lxc-seeddms-postgres start envsubst /srv/seeddms/seeddms_conf/settings.xml export SEEDDMS_ADMIN_USER=admin export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') export SEEDDMS_ADMIN_EMAIL=admin@example.com envsubst