From 57cd65115dae2d722565c384287890fa1fee8bb0 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 3 Oct 2019 21:29:19 +0200 Subject: [PATCH] Rework MifosX --- lxc-apps/cts/install.sh | 5 --- lxc-apps/cts/install/cts_conf/spotter.py | 2 +- lxc-apps/mifosx/install.sh | 38 +++++++++---------- lxc-apps/mifosx/install/etc/init.d/mifosx | 23 ----------- lxc-apps/mifosx/install/mariadb_conf/my.cnf | 24 ++++++++++++ .../mifosx/conf => mifosx_conf}/context.xml | 0 .../mifosx/conf => mifosx_conf}/server.xml | 0 .../install/{srv/mifosx => }/update-conf.sh | 0 lxc-apps/mifosx/lxcfile | 3 -- lxc-apps/mifosx/meta | 28 ++++++++++++++ lxc-apps/mifosx/uninstall.sh | 10 +---- 11 files changed, 74 insertions(+), 59 deletions(-) delete mode 100755 lxc-apps/mifosx/install/etc/init.d/mifosx create mode 100644 lxc-apps/mifosx/install/mariadb_conf/my.cnf rename lxc-apps/mifosx/install/{srv/mifosx/conf => mifosx_conf}/context.xml (100%) rename lxc-apps/mifosx/install/{srv/mifosx/conf => mifosx_conf}/server.xml (100%) rename lxc-apps/mifosx/install/{srv/mifosx => }/update-conf.sh (100%) mode change 100755 => 100644 create mode 100644 lxc-apps/mifosx/meta diff --git a/lxc-apps/cts/install.sh b/lxc-apps/cts/install.sh index f02d849..56ba078 100755 --- a/lxc-apps/cts/install.sh +++ b/lxc-apps/cts/install.sh @@ -28,11 +28,6 @@ export CTS_SECRET=$(head -c 26 /dev/urandom | base64 | tr -d '+/=') envsubst /srv/cts/cts_conf/spotter.py touch /srv/cts/cts_conf/__init__.py -# Set "production values" (increases performance) only if the DEBUG environment variable is not set -if [ ${DEBUG:-0} -eq 0 ]; then - sed -i 's/DEBUG = True/DEBUG = False/' /srv/cts/cts_conf/spotter.py -fi - # Populate database lxc-execute cts -- manage.py migrate diff --git a/lxc-apps/cts/install/cts_conf/spotter.py b/lxc-apps/cts/install/cts_conf/spotter.py index fe77949..b0ff6ca 100644 --- a/lxc-apps/cts/install/cts_conf/spotter.py +++ b/lxc-apps/cts/install/cts_conf/spotter.py @@ -43,5 +43,5 @@ CELERY_EAGER_PROPAGATES_EXCEPTIONS = True TIME_ZONE = 'Europe/Prague' LANGUAGE_CODE = 'cs' -DEBUG = True +DEBUG = False TEMPLATE_DEBUG = DEBUG diff --git a/lxc-apps/mifosx/install.sh b/lxc-apps/mifosx/install.sh index 949a95e..2a2a869 100755 --- a/lxc-apps/mifosx/install.sh +++ b/lxc-apps/mifosx/install.sh @@ -3,49 +3,49 @@ set -ev cd $(realpath $(dirname "${0}"))/install -# Check prerequisites -[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1 +# 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 --skip-test-db # Create databases export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -envsubst /srv/mifosx/conf/context.xml -cp srv/mifosx/conf/server.xml /srv/mifosx/conf/server.xml - -# Install service -cp etc/init.d/mifosx /etc/init.d/mifosx -rc-update -u +mkdir -p /srv/mifosx_conf +envsubst /srv/mifosx/mifosx_conf/context.xml +cp mifosx_conf/server.xml /srv/mifosx/mifosx_conf/server.xml # Populate database ->/var/log/lxc/mifosx.log -lxc-start mifosx +service start mifosx until grep -q 'org.apache.catalina.startup.Catalina.start Server startup' /var/log/lxc/mifosx.log; do sleep 1 done -lxc-stop mifosx +service stop mifosx # Fix missing previous_run_status column -echo 'ALTER TABLE `scheduled_email_campaign` ADD `previous_run_status` VARCHAR(10) NULL;' | lxc-attach mariadb -- mysql mifostenant-default +echo 'ALTER TABLE `scheduled_email_campaign` ADD `previous_run_status` VARCHAR(10) NULL;' | lxc-attach mifosx-mariadb -- mysql mifostenant-default # Update admin account export MIFOSX_ADMIN_USER=admin export MIFOSX_ADMIN_EMAIL=admin@example.com export MIFOSX_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{print $1}') -envsubst