Introduce Mifos X install script, closes #155

This commit is contained in:
Disassembler 2017-12-08 20:28:47 +01:00
parent aabbd4686a
commit 3af12505ef
10 changed files with 152 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View File

@ -201,13 +201,29 @@
</div> </div>
<div class="c" id="motech"> <div class="c" id="motech">
<h2><a href="#"><img src="img/Motech.png" alt="Motech" title="Motech">Motech</a></h2> <h2><a href="#"><img src="img/Motech.png" alt="Motech" title="Motech">Motech</a></h2>
<p>Integrace zdravotnických a komunikačních služeb.</p> <p>Integrace zdravotnických a komunikačních služeb.</p>
<ul> <ul>
<li><strong>Login:</strong> <span class="login"></span></li> <li><strong>Login:</strong> <span class="login"></span></li>
<li><strong>Heslo:</strong> <span class="password"></span></li> <li><strong>Heslo:</strong> <span class="password"></span></li>
</ul> </ul>
</div> </div>
<div class="c" id="mifosx">
<h2><a href="#"><img src="img/MifosX.png" alt="Mifos X" title="Mifos X">Mifos X</a></h2>
<p>Nástroj na rozvojovou, humanitární pomoc a mikrofinancování.</p>
<ul>
<li><strong>Login:</strong> <span class="login"></span></li>
<li><strong>Heslo:</strong> <span class="password"></span></li>
</ul>
</div>
<div class="c" id="mifosx-mobile">
<h2><a href="#"><img src="img/MifosX_Mobile.png" alt="Mifos X" title="Mifos X">Mifos X</a></h2>
<p>Mobilní aplikace<br>
<a href="https://play.google.com/store/apps/details?id=com.mifos.mifosxdroid"><img src="img/android.png" class="ico" alt="KanBoard">Mifos X client pro Android 3.0 a vyšší</a><br>
</p>
</div>
<div class="c" id="diaspora"> <div class="c" id="diaspora">
<h2><a href="#"><img src="img/Diaspora.png" alt="diaspora*" title="diaspora*">diaspora*</a></h2> <h2><a href="#"><img src="img/Diaspora.png" alt="diaspora*" title="diaspora*">diaspora*</a></h2>

55
mifosx.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}"))/mifosx
# Download Mifos X
mkdir -p /srv/mifosx/fineract-provider
wget https://sourceforge.net/projects/mifos/files/latest/download -O /tmp/mifosx.zip
unzip /tmp/mifosx.zip -d /tmp
unzip /tmp/fineractplatform-17.07.01.RELEASE/fineract-provider.war -d /srv/mifosx/fineract-provider
mv /tmp/fineractplatform-17.07.01.RELEASE/apps/community-app /srv/mifosx/community-app
rm -f /tmp/mifosx.zip
# Download Java library dependencies
wget http://central.maven.org/maven2/org/drizzle/jdbc/drizzle-jdbc/1.3/drizzle-jdbc-1.3.jar -O /var/lib/tomcat8/lib/drizzle-jdbc-1.3.jar
# Create databases
export MIFOSX_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/tmp/mifosx-createdb.sql >/tmp/mifosx-createdb.sql
mysql </tmp/mifosx-createdb.sql
rm -f /tmp/mifosx-createdb.sql
# Populate database
mysql mifosplatform-tenants </tmp/fineractplatform-17.07.01.RELEASE/database/mifospltaform-tenants-first-time-install.sql
envsubst <${SOURCE_DIR}/tmp/mifosx-schemapwd.sql >/tmp/mifosx-schemapwd.sql
mysql mifosplatform-tenants </tmp/mifosx-schemapwd.sql
rm -f /tmp/mifosx-schemapwd.sql
# 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)
export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{print $1}')
envsubst <${SOURCE_DIR}/tmp/mifosx-adminpwd.sql >>/srv/mifosx/fineract-provider/WEB-INF/classes/sql/migrations/core_db/V3__mifosx-permissions-and-authorisation-utf8.sql
# Configure Mifos X
envsubst <${SOURCE_DIR}/srv/mifosx/fineract-provider/META-INF/context.xml >/srv/mifosx/fineract-provider/META-INF/context.xml
cp ${SOURCE_DIR}/srv/mifosx/fineract-provider/WEB-INF/classes/application.properties /srv/mifosx/fineract-provider/WEB-INF/classes/application.properties
sed -i 's/requires-channel="https" //g' /srv/mifosx/fineract-provider/WEB-INF/classes/META-INF/spring/securityContext.xml
chown -R tomcat8:tomcat8 /srv/mifosx/fineract-provider
ln -s /srv/mifosx/fineract-provider /var/lib/tomcat8/webapps/fineract-provider
# Create nginx site definition
cp ${SOURCE_DIR}/etc/nginx/apps-available/mifosx /etc/nginx/apps-available/mifosx
ln -s /etc/nginx/apps-available/mifosx /etc/nginx/apps-enabled/mifosx
# Restart services
systemctl restart tomcat8
systemctl restart nginx
# Cleanup
rm -rf /tmp/fineractplatform-17.07.01.RELEASE
# Add portal application definition
portal-app-manager mifosx "/mifosx/" "${MIFOSX_ADMIN_USER}" "${MIFOSX_ADMIN_PWD}"
portal-app-manager mifosx-mobile

View File

@ -0,0 +1,10 @@
location /mifosx {
alias /srv/mifosx/community-app;
}
location /fineract-provider {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://127.0.0.1:9080;
}

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<Context>
<Resource type="javax.sql.DataSource" name="jdbc/mifosplatform-tenants"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="org.drizzle.jdbc.DrizzleDriver"
url="jdbc:mysql:thin://localhost:3306/mifosplatform-tenants"
username="mifosx" password="${MIFOSX_PWD}" initialSize="3" maxActive="10"
maxIdle="6" minIdle="3" validationQuery="SELECT 1"
testOnBorrow="true" testOnReturn="true" testWhileIdle="true"
timeBetweenEvictionRunsMillis="30000" minEvictableIdleTimeMillis="60000"
logAbandoned="true" suspectTimeout="60"
/>
</Context>

View File

@ -0,0 +1,21 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
spring.profiles.default=basicauth
server.port=9080

View File

@ -0,0 +1,2 @@
UPDATE m_appuser SET username = "${MIFOSX_ADMIN_USER}", password = "${MIFOSX_ADMIN_HASH}", email = "${MIFOSX_ADMIN_EMAIL}" WHERE id = 1;

View File

@ -0,0 +1,5 @@
CREATE USER 'mifosx'@'%' IDENTIFIED BY '${MIFOSX_PWD}';
CREATE DATABASE `mifosplatform-tenants` CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE `mifostenant-default` CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON `mifosplatform-tenants`.* TO 'mifosx'@'%';
GRANT ALL PRIVILEGES ON `mifostenant-default`.* TO 'mifosx'@'%';

View File

@ -0,0 +1 @@
UPDATE tenants SET schema_username = "mifosx", schema_password = "${MIFOSX_PWD}" WHERE identifier = "default";