#!/bin/sh set -ev # Volumes POSTGRES_DATA="${VOLUMES_DIR}/motech/postgres_data" ACTIVEMQ_CONF="${VOLUMES_DIR}/motech/activemq_conf" ACTIVEMQ_DATA="${VOLUMES_DIR}/motech/activemq_data" MOTECH_CONF="${VOLUMES_DIR}/motech/motech_conf" # Create Postgres instance install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} spoc-container exec motech-postgres -- initdb -D /var/lib/postgresql # Configure Postgres 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 # Configure ActiveMQ install -o 161616 -g 161616 -m 750 -d ${ACTIVEMQ_CONF} install -o 161616 -g 161616 -m 750 -d ${ACTIVEMQ_DATA} install -o 161616 -g 161616 -m 640 activemq_conf/activemq.xml ${ACTIVEMQ_CONF}/activemq.xml # Create database export MOTECH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') spoc-container start motech-postgres envsubst