This applies to Fineract (not fineract CN)

Installation

If you want to install and run Apache Fineract locally, only a few steps are needed to prepare your system. 

Prerequisites

MySQL 5.6

Download MySQL 5.6 at http://dev.mysql.com/downloads/mysql/, and follow the installation guide for your OS.

Java 8

Download Java 8u102 at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, and follow the installation guide for you OS.

Tomcat 7

Download Tomcat 7.0.67 at https://tomcat.apache.org/download-70.cgi, and follow the installation guide for your OS.

Setting up the data base

Please first check if your MySQL 'root' user has the default 'mysql' password:

 $ mysql -u root -pmysql
mysql> 

For quick development, unless it's already the case, it is recommended that you change your MySQL 'root' user password to 'mysql'. For doing that you need to fire the following command:

$ mysqladmin -u root -p 'oldpassword' password newpassword

Or, if you don't have any password already for Root login as Root then follow the instructions:

update mysql.user SET password=PASSWORD('newpassword') WHERE user ='root';
flush privileges;

Apache Fineract has support for hosting multiple tenants so we use two database instances to start with:

  1. mifosplatform-tenants: which is responsible for persisting the tenant information which is used when deciding what schema each incoming request in the platform should route to. It acts as a registry which contains the details of all the tenant databases, and their connection information, which is used by Apache Fineract to connect to the appropriate tenant.
  2. mifostenant-default: All tenant specific schemas follow the pattern mifostenant-[name], out of the box the default schema is used to represent a demo

Create database named mifosplatform-tenants

You need to create the database 'mifosplatform-tenants':

create database `mifosplatform-tenants`;

Then open a console and go to [your project root]/fineract-provider and execute the following command:

$ ./gradlew migrateTenantListDB -PdbName=mifosplatform-tenants

This will populate all needed tables and some default data.

Create database named mifostenant-default

The last thing to do is creating the default tenant so you can test-drive the software:

create database `mifostenant-default`;

When Apache Fineract starts, all tables will be created or updated so you don't need to take any further action.

Deploying Fineract

Setup Tomcat

1. Ensure the following libraries are in the [TOMCAT_HOME]/lib folder:

2. Generate a new keystore using java keytool (if you havent already done this):

Open a command prompt and type:

JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA

Provide requested input and type 'y' for the last question to confirm. 

3. Update tomcat configuration files for SSL

Open the file server.xml located at [TOMCAT_HOME]/conf, and replace all content with:

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  <GlobalNamingResources>
       <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml"
       />
       <Resource type="javax.sql.DataSource"
            name="jdbc/mifosplatform-tenants"
            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/mifosplatform-tenants"
            username="root"
            password="[root mysql password]"
            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"
       />
  </GlobalNamingResources>
  <Service name="Catalina">
<Connector protocol="org.apache.coyote.http11.Http11Protocol"
           port="8443" maxThreads="200" scheme="https"
           secure="true" SSLEnabled="true"
           keystoreFile="/home/ubuntu/.keystore"
           keystorePass="testmifos"
           clientAuth="false" sslProtocol="TLS"
           URIEncoding="UTF-8"
           compression="force"
           compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css"/>
      <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
      </Realm>
      <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">
          <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".log"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
      </Host>
    </Engine>
  </Service>
</Server>

4) Drop the Apache Fineract WAR file into webapps

Open a console prompt and navigate the the folder fineract-provider, type:

./gradlew war

This will create a war file in the sub folder build/libs, copy this file and paste it to [TOMCAT_HOME]/webapps

5) Start Tomcat

Developer Environment

If you choose this solution, aside from Java 7 and your favored Java IDE nothing needs to be installed.

First step is to import Apache Fineract as a Gradle project into your IDE.

After you have imported Apache Fineract, edit the file gradle.properties:

env=dev
releaseVersion=SNAPSHOT

Now synchronize the IDE project to reflect the changes done for the Gradle project.

Once the synchronize has finished you can configure your IDE to use either the class ServerWithMariaDB4jApplication, if you don't want to install a MySQL server, or ServerApplication, if you have already installed a MySQL server. This will allow you ton run and/or debug Apache Fineract within your IDE.

In either case, an embedded Tomcat is started, using Spring Boot's capabilities.

  • No labels