Rework MifosX
This commit is contained in:
parent
990a9dcb71
commit
57cd65115d
@ -28,11 +28,6 @@ export CTS_SECRET=$(head -c 26 /dev/urandom | base64 | tr -d '+/=')
|
|||||||
envsubst <cts_conf/spotter.py >/srv/cts/cts_conf/spotter.py
|
envsubst <cts_conf/spotter.py >/srv/cts/cts_conf/spotter.py
|
||||||
touch /srv/cts/cts_conf/__init__.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
|
# Populate database
|
||||||
lxc-execute cts -- manage.py migrate
|
lxc-execute cts -- manage.py migrate
|
||||||
|
|
||||||
|
@ -43,5 +43,5 @@ CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
|
|||||||
TIME_ZONE = 'Europe/Prague'
|
TIME_ZONE = 'Europe/Prague'
|
||||||
LANGUAGE_CODE = 'cs'
|
LANGUAGE_CODE = 'cs'
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = False
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
@ -3,49 +3,49 @@ set -ev
|
|||||||
|
|
||||||
cd $(realpath $(dirname "${0}"))/install
|
cd $(realpath $(dirname "${0}"))/install
|
||||||
|
|
||||||
# Check prerequisites
|
# Create MariaDB instance
|
||||||
[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1
|
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
|
# Create databases
|
||||||
export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
||||||
envsubst <createdb.sql | lxc-attach mariadb -- mysql
|
service mifosx-mariadb start
|
||||||
|
envsubst <createdb.sql | lxc-attach mifosx-mariadb -- mysql
|
||||||
|
|
||||||
# Populate database
|
# Populate database
|
||||||
cat /var/lib/lxc/mifosx/mifosx/tmp/mifospltaform-tenants-first-time-install.sql | lxc-attach mariadb -- mysql mifosplatform-tenants
|
lxc-execute mifosx -- cat /tmp/mifospltaform-tenants-first-time-install.sql | lxc-attach mifosx-mariadb -- mysql mifosplatform-tenants
|
||||||
envsubst <schemapwd.sql | lxc-attach mariadb -- mysql mifosplatform-tenants
|
envsubst <schemapwd.sql | lxc-attach mifosx-mariadb -- mysql mifosplatform-tenants
|
||||||
|
|
||||||
# Configure Mifos X
|
# Configure Mifos X
|
||||||
mkdir -p /srv/mifosx/conf
|
mkdir -p /srv/mifosx_conf
|
||||||
envsubst <srv/mifosx/conf/context.xml >/srv/mifosx/conf/context.xml
|
envsubst <mifosx_conf/context.xml >/srv/mifosx/mifosx_conf/context.xml
|
||||||
cp srv/mifosx/conf/server.xml /srv/mifosx/conf/server.xml
|
cp mifosx_conf/server.xml /srv/mifosx/mifosx_conf/server.xml
|
||||||
|
|
||||||
# Install service
|
|
||||||
cp etc/init.d/mifosx /etc/init.d/mifosx
|
|
||||||
rc-update -u
|
|
||||||
|
|
||||||
# Populate database
|
# Populate database
|
||||||
>/var/log/lxc/mifosx.log
|
service start mifosx
|
||||||
lxc-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
|
||||||
lxc-stop mifosx
|
service 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 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
|
# 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 mariadb -- mysql mifostenant-default
|
envsubst <adminpwd.sql | lxc-attach mifosx-mariadb -- mysql mifostenant-default
|
||||||
|
|
||||||
# Install config update script
|
# Install config update script
|
||||||
cp srv/mifosx/update-conf.sh /srv/mifosx/update-conf.sh
|
cp update-conf.sh /srv/mifosx/update-conf.sh
|
||||||
|
|
||||||
# Stop services required for setup
|
# Stop services required for setup
|
||||||
[ ! -z ${STOP_MARIADB} ] && service mariadb stop
|
service mifosx-mariadb stop
|
||||||
|
|
||||||
# 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}"
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
description="Mifos X container"
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
need mariadb
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
lxc-start mifosx
|
|
||||||
}
|
|
||||||
|
|
||||||
start_post() {
|
|
||||||
vmmgr register-proxy mifosx
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_pre() {
|
|
||||||
vmmgr unregister-proxy mifosx
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
lxc-stop mifosx
|
|
||||||
}
|
|
24
lxc-apps/mifosx/install/mariadb_conf/my.cnf
Normal file
24
lxc-apps/mifosx/install/mariadb_conf/my.cnf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
[mysqld]
|
||||||
|
skip-external-locking
|
||||||
|
skip-name-resolve
|
||||||
|
key_buffer_size = 16M
|
||||||
|
max_allowed_packet = 1M
|
||||||
|
table_open_cache = 64
|
||||||
|
sort_buffer_size = 512K
|
||||||
|
net_buffer_length = 8K
|
||||||
|
read_buffer_size = 256K
|
||||||
|
read_rnd_buffer_size = 512K
|
||||||
|
myisam_sort_buffer_size = 8M
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
max_allowed_packet = 1M
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
no-auto-rehash
|
||||||
|
|
||||||
|
[myisamchk]
|
||||||
|
key_buffer_size = 20M
|
||||||
|
sort_buffer_size = 20M
|
||||||
|
read_buffer = 2M
|
||||||
|
write_buffer = 2M
|
0
lxc-apps/mifosx/install/srv/mifosx/update-conf.sh → lxc-apps/mifosx/install/update-conf.sh
Executable file → Normal file
0
lxc-apps/mifosx/install/srv/mifosx/update-conf.sh → lxc-apps/mifosx/install/update-conf.sh
Executable file → Normal file
@ -40,7 +40,4 @@ RUN EOF
|
|||||||
rm /tmp/locale-cs.patch
|
rm /tmp/locale-cs.patch
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
MOUNT FILE /srv/mifosx/conf/server.xml srv/tomcat/conf/server.xml
|
|
||||||
MOUNT FILE /srv/mifosx/conf/context.xml srv/tomcat/webapps/fineract-provider/META-INF/context.xml
|
|
||||||
|
|
||||||
CMD s6-svscan /etc/services.d
|
CMD s6-svscan /etc/services.d
|
||||||
|
28
lxc-apps/mifosx/meta
Normal file
28
lxc-apps/mifosx/meta
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"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"]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -ev
|
set -ev
|
||||||
|
|
||||||
# Remove service
|
# Remove persistent data
|
||||||
rm -f /etc/init.d/mifosx
|
rm -rf /srv/mifosx
|
||||||
rc-update -u
|
|
||||||
|
|
||||||
# Drop database and user
|
|
||||||
[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1
|
|
||||||
echo 'DROP DATABASE IF EXISTS `mifosplatform-tenants`; DROP DATABASE IF EXISTS `mifostenant-default`; DROP USER IF EXISTS `mifosx`;' | lxc-attach mariadb -- mysql
|
|
||||||
[ ! -z ${STOP_MARIADB} ] && service mariadb stop
|
|
||||||
|
|
||||||
# Unregister application
|
# Unregister application
|
||||||
vmmgr unregister-app mifosx
|
vmmgr unregister-app mifosx
|
||||||
|
Loading…
Reference in New Issue
Block a user