#!/bin/sh set -ev # Create Postgres instance mkdir -p /srv/decidim/postgres_data chown -R 105432:105432 /srv/decidim/postgres_data chmod 700 /srv/decidim/postgres_data lxc-execute -n decidim-postgres -- initdb -D /var/lib/postgresql # Configure Postgres cp postgres_data/postgresql.conf /srv/decidim/postgres_data/postgresql.conf cp postgres_data/pg_hba.conf /srv/decidim/postgres_data/pg_hba.conf # Create database export DECIDIM_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') service decidim-postgres start envsubst /srv/decidim/decidim_conf/application.yml # Populate database lxc-execute decidim -- sh -c 'cd /srv/decidim-app; bin/rails db:migrate' # Create admin account export DECIDIM_ADMIN_EMAIL=admin@example.com export DECIDIM_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') envsubst