Make MifosX SPOC-compatible

This commit is contained in:
Disassembler 2020-03-18 16:51:21 +01:00
parent d8d9f5431e
commit ff3d37517f
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
8 changed files with 53 additions and 53 deletions

28
lxc-apps/mifosx/app Normal file
View File

@ -0,0 +1,28 @@
{
"version": "18.03.01-200313",
"meta": {
"title": "Mifos X",
"desc-cs": "Mikrofinancování rozvojových projektů",
"desc-en": "Development projects microfinancing",
"license": "GPL"
},
"containers": {
"mifosx": {
"image": "mifosx_18.03.01-200313",
"depends": [
"mifosx-mariadb"
],
"mounts": {
"mifosx/mifosx_conf/server.xml": "srv/tomcat/conf/server.xml:file",
"mifosx/mifosx_conf/context.xml": "srv/tomcat/webapps/fineract-provider/META-INF/context.xml:file"
}
},
"mifosx-mariadb": {
"image": "mariadb_10.4.12-200313",
"mounts": {
"mifosx/mariadb_conf/my.cnf": "etc/my.cnf:file",
"mifosx/mariadb_data": "var/lib/mysql"
}
}
}
}

View File

@ -1,5 +1,5 @@
IMAGE mifosx_18.03.01-190620 IMAGE mifosx_18.03.01-200313
FROM alpine3.9-tomcat8.5_8.5.41-190620 FROM alpine3.11-tomcat8.5_8.5.51-200313
RUN EOF RUN EOF
# Install full-featured wget to work around sourceforge bugs # Install full-featured wget to work around sourceforge bugs
@ -22,7 +22,7 @@ RUN EOF
EOF EOF
# s6 required for single service due to hanging threads # s6 required for single service due to hanging threads
COPY lxc COPY image.d
RUN EOF RUN EOF
# Update Czech translation of community-app # Update Czech translation of community-app

View File

@ -1,50 +1,50 @@
#!/bin/sh #!/bin/sh
set -ev set -ev
# Volumes
MARIADB_CONF="${VOLUMES_DIR}/mifosx/mariadb_conf"
MARIADB_DATA="${VOLUMES_DIR}/mifosx/mariadb_data"
MIFOSX_CONF="${VOLUMES_DIR}/mifosx/mifosx_conf"
# Create MariaDB instance # Create MariaDB instance
mkdir -p /srv/mifosx/mariadb_conf /srv/mifosx/mariadb_data install -o 100000 -g 100000 -m 755 -d ${MARIADB_CONF}
chown 103306:103306 /srv/mifosx/mariadb_data install -o 103306 -g 103306 -m 750 -d ${MARIADB_DATA}
cp mariadb_conf/my.cnf /srv/mifosx/mariadb_conf/my.cnf install -o 100000 -g 100000 -m 644 mariadb_conf/my.cnf ${MARIADB_CONF}/my.cnf
chown -R 100000:100000 /srv/mifosx/mariadb_conf spoc-container exec mifosx-mariadb -- mysql_install_db --user=mysql --datadir=/var/lib/mysql --auth-root-authentication-method=socket --auth-root-socket-user=mysql --skip-test-db
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 # Create databases
export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
service lxc-mifosx-mariadb start spoc-container start mifosx-mariadb
envsubst <createdb.sql | lxc-attach mifosx-mariadb -- mysql -u mysql envsubst <createdb.sql | spoc-container exec mifosx-mariadb -- mysql -u mysql
# Configure Mifos X # Configure Mifos X
mkdir -p /srv/mifosx/mifosx_conf install -o 100000 -g 100000 -m 755 -d ${MIFOSX_CONF}
envsubst <mifosx_conf/context.xml >/srv/mifosx/mifosx_conf/context.xml envsubst <mifosx_conf/context.xml | install -o 100000 -g 100000 -m 644 /dev/stdin ${MIFOSX_CONF}/context.xml
cp mifosx_conf/server.xml /srv/mifosx/mifosx_conf/server.xml install -o 100000 -g 100000 -m 644 mifosx_conf/server.xml ${MIFOSX_CONF}/server.xml
chown -R 100000:100000 /srv/mifosx/mifosx_conf
# Populate database # Populate database
lxc-execute mifosx -- cat /tmp/mifospltaform-tenants-first-time-install.sql | lxc-attach mifosx-mariadb -- mysql -u mysql mifosplatform-tenants spoc-container exec mifosx -- cat /tmp/mifospltaform-tenants-first-time-install.sql | spoc-container exec mifosx-mariadb -- mysql -u mysql mifosplatform-tenants
envsubst <schemapwd.sql | lxc-attach mifosx-mariadb -- mysql -u mysql mifosplatform-tenants envsubst <schemapwd.sql | spoc-container exec mifosx-mariadb -- mysql -u mysql mifosplatform-tenants
# Populate database # Populate database
service lxc-mifosx start spoc-container start mifosx
until grep -q 'org.apache.catalina.startup.Catalina.start Server startup' /var/log/lxc/mifosx.log; do until grep -q 'org.apache.catalina.startup.Catalina.start Server startup' /var/log/lxc/mifosx.log; do
sleep 1 sleep 1
done done
service lxc-mifosx stop spoc-container stop mifosx
# Fix missing previous_run_status column # Fix missing previous_run_status column
echo 'ALTER TABLE `scheduled_email_campaign` ADD `previous_run_status` VARCHAR(10) NULL;' | lxc-attach mifosx-mariadb -- mysql -u mysql mifostenant-default echo 'ALTER TABLE `scheduled_email_campaign` ADD `previous_run_status` VARCHAR(10) NULL;' | spoc-container exec mifosx-mariadb -- mysql -u mysql mifostenant-default
# Update admin account # Update admin account
export MIFOSX_ADMIN_USER=admin export MIFOSX_ADMIN_USER=admin
export MIFOSX_ADMIN_EMAIL=admin@example.com export MIFOSX_ADMIN_EMAIL=admin@example.com
export MIFOSX_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') 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}') export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{print $1}')
envsubst <adminpwd.sql | lxc-attach mifosx-mariadb -- mysql -u mysql mifostenant-default envsubst <adminpwd.sql | spoc-container exec mifosx-mariadb -- mysql -u mysql mifostenant-default
# Install config update script
cp update-conf.sh /srv/mifosx/update-conf.sh
# Stop services required for setup # Stop services required for setup
service lxc-mifosx-mariadb stop spoc-container stop mifosx-mariadb
# Register application # Register application
vmmgr register-app mifosx mifosx "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}" vmmgr register-app mifosx mifosx "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}"

View File

@ -1,28 +0,0 @@
{
"version": "18.03.01-190620",
"meta": {
"title": "Mifos X",
"desc-cs": "Mikrofinancování rozvojových projektů",
"desc-en": "Development projects microfinancing",
"license": "GPL"
},
"containers": {
"mifosx": {
"image": "mifosx_18.03.01-190620",
"depends": [
"mifosx-mariadb"
],
"mounts": [
["FILE", "/srv/mifosx/mifosx_conf/server.xml", "/srv/tomcat/conf/server.xml"],
["FILE", "/srv/mifosx/mifosx_conf/context.xml", "/srv/tomcat/webapps/fineract-provider/META-INF/context.xml"]
]
},
"mifosx-mariadb": {
"image": "mariadb_10.3.15-190620",
"mounts": [
["FILE", "/srv/mifosx/mariadb_conf/my.cnf", "/etc/my.cnf"],
["DIR", "/srv/mifosx/mariadb_data", "/var/lib/mysql"]
]
}
}
}

View File

@ -2,7 +2,7 @@
set -ev set -ev
# Remove persistent data # Remove persistent data
rm -rf /srv/mifosx rm -rf "${VOLUME_DIR}/mifosx"
# Unregister application # Unregister application
vmmgr unregister-app mifosx vmmgr unregister-app mifosx