#!/bin/sh set -ev # Create MariaDB instance mkdir -p /srv/mifosx/mariadb_conf /srv/mifosx/mariadb_data chown 103306:103306 /srv/mifosx/mariadb_data cp mariadb_conf/my.cnf /srv/mifosx/mariadb_conf/my.cnf chown -R 100000:100000 /srv/mifosx/mariadb_conf lxc-execute mifosx-mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --auth-root-socket-user=mysql --skip-test-db # Create databases export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') service lxc-mifosx-mariadb start envsubst /srv/mifosx/mifosx_conf/context.xml cp mifosx_conf/server.xml /srv/mifosx/mifosx_conf/server.xml chown -R 100000:100000 /srv/mifosx/mifosx_conf # Populate database lxc-execute mifosx -- cat /tmp/mifospltaform-tenants-first-time-install.sql | lxc-attach mifosx-mariadb -- mysql -u mysql mifosplatform-tenants envsubst