Wednesday, October 22, 2014

Quickly Install Mifos X 1.25 on Debian/Ubuntu

I'm pleased to announce that Mifos X version 1.25, the world's leading platform for financial inclusion now can be installed automatically in minutes on Debian/Ubuntu or any similar distribution, using a deb package. I recently packaged Mifos X 1.25 into a Debian package and also setup a Debian repository for the same to facilitate this quick installation. For the impatient, jump straight to the section "Installing Mifos X 1.25 on Debian/Ubuntu". If you're still with me, read on for the back story..

This contribution came as a result of a recurring itch which I've been feeling for a long time now. This summer, I first tried to install the new Mifos X platform. At that time, I was new to Amazon Web Services and since I have a VPS with ample resources, plus a few Virtual Machines my preferred mode was manual installation on Ubuntu/Debian server. Following the steps in and after the couple of hiccups, got it working on a Ubuntu VM and then installed an online demo on my Debian VPS. Over the months and weeks that followed, I often thought about improving this installation process and also found others on the mailing list facing problems getting stuck at some stage of manual installation. On a couple of Mifos users meetups Ed from the Mifos Initiative a lot of people run Mifos from Debian and Ubuntu though they did not have any concrete statistics on this. So finally I decided to answer this need and build the package and repository.

Mifos X is the world's leading Platform for Financial Inclusion with a great community, awesome architecture and cutting edge technology. Mifos X has always been available as Open Source and the repository is hosted on and stable releases are available on Despite Mifos X availability, there was always the challenge of following the entire process documented in the INSTALL document. This process involves several steps:

  1. Installing Tomcat7
  2. Installing MySQL Server
  3. Installing JDK (via the OpenJDK 7 package on Debian/Ubuntu)
  4. Downloading and extracting the Mifos X release zip file
  5. Setting up and initializing the mifosplatform-tenants database
  6. Setting up and initializing the mifostenant-default database
  7. Creating a keystore with SSL private & public key pair
  8. Configuring Tomcat server.xml
  9. Dropping the mifosng-provider.war into the tomcat webapps directory
  10. Copying the community-app and api-docs folders into webapps/ROOT

After following all these steps there were a couple of issues I faced. First the MySQL root password had to be mysql. If it was something else, it wouldn't work. Second, the recent Mifos X releases require the use of JDK 7 but the default setting for Tomcat is to use JDK 6, so the /etc/default/tomcat7 needs to be modified to use JDK 7. Then, with the recent release, there was also the increase in memory requirement for Tomcat which needed to be configured in /etc/default/tomcat7. Apart from doing the steps mentioned above, I also ensured the deb package installation takes care of the above caveats, so now this installation process takes care of everything and gives you a working Mifos X setup with the provider app in the backend and the community app running on Tomcat.

Installing Mifos X 1.25 on Debian/Ubuntu

To install Mifos X 1.25 on Debian simply run these lines as root:
# echo deb stable main > /etc/apt/sources.list.d/mifosx.list
# apt-get update
# apt-get install mifosx
For Ubuntu, the steps are:
$ echo deb stable main |
                  sudo tee /etc/apt/sources.list.d/mifosx.list
$ sudo apt-get update
$ sudo apt-get install mifosx
That's it! You'll be prompted for the MySQL root password, which is used to create the 2 databases, and the username and password of the account to access Mifos. You'll also be asked for information to generate the SSL keys since Mifos X community Application runs on HTTPS (HTTP over SSL). It is our hope that many more people will be able to get started quickly with MifosX through this effort. Spread the word and join us in the fight against poverty.

Report your experiences to the Mifos X mailing list
Check out the github repo at
Send feedback to

UPDATE: Here's a YouTube screencast of the live installation process:

Wednesday, October 15, 2014

MifosX Messenger - automated SMS notification app

As mentioned in my previous blog post, the architecture of MifosX makes it play very nicely with heterogenous technologies using the REST API and Webhooks to communicate. To fulfill my client's requirement, I started working on a SMS sending application to notify group members about financial transactions like loan repayments, and deposits and withdrawals to savings accounts.
I used the Sinatra framework of the ruby programming language because of it's simplicity. Though not as famous as Rails, it's elder brother, Sinatra is perfect for quickly writing great applications without enforcing a directory structure on the programmer. A simple application in sinatra can be as few as 5 lines. Your hello world in sinatra would look like (you won't believe this):

require 'sinatra'

get '/hi' do
  "Hello World!"

Having several years experience developing Web Applications, I've used several kinds of frameworks for different tasks. MVC frameworks like perl-Catalyst, ruby-on-Rails and python-django are great for developing modular applications. However, as the above code snippet shows, it's possible to get cracking with a much leaner and meaner application with a intuitive block for each request path and request type. I had the joy of using another microframework like Sinatra before: perl's Dancer framework. Dancer proved great for implementing a webhook handler app. With the help of CPAN's great array of libraries and modules, I could quickly develop an application with a few lines of code.

Having emphasized the simplicity and speed of developing with microframeworks like Sinatra, it's flexibility with directory structure shouldn't deter those looking to write maintainable applications. Since ruby itself is object oriented and provides neat ways to organize a growing project, it's possible to write a perfectly modular and well organized and maintainable application with Sinatra. In fact, MifosX Messenger uses a handful of classes which specialize in the different functionalities required to get the app working. The workflow starts when a financial transaction is recorded in MifosX.

As the above sequence diagram shows (click for full size view), MifosX Messenger gets notified when any financial transaction it has subscribed to is performed. It parses the JSON in the POST request data received and uses the clientId, loanId and resourceId to fetch information from Mifos via the REST API. Once it has collected the necessary information, it uses a MessageTemplate class to construct the SMS and sends it to the mobile number of the client.

Falling in love with MifosX

I've been a Free and Open Source Software(FOSS) enthusiast and programmer for several years now. Recently I got the opportunity to work on my dream project: MifosX, the world's leading FOSS platform for financial inclusion. Being excited about the scope of the work is one thing, the fact that what you do helps transform lives of so many people, giving them hope and a future. That's what this is all about - using software as a means to help MicroFinance Institutions (MFIs) scale up to reach many more poor with minimal increase in their organizational cost. In case you're new to Mifos, here's a video that demonstrates the power of this platform with a case study of how it can help a MFI:

I had worked on Mifos earlier too, and was surprised to see that the old application I had contributed to had given way to a completely new rewrite as an SPA (single page application) written in AngularJS with a neatly separated REST backend provider application. While it was a considerable change for me, coming from the old application, I feel very excited because the new architecture makes it possible to have different kind of front-end application or module talk to the backend app. It is therefore much easier to build tools which can talk to Mifos backend and leverage the comprehensive API with functionality for an incredibly wide array of functionality covering a host of financial and supporting services. Another new development in MifosX which I'm very excited about is the Webhooks functionality using which an independent web service can be notified when different kinds of financial transactions, etc are recorded. This makes it possible to integrate with Mifos X, systems that can perform actions in real time when financial transactions are recorded.

A classic application of this webhooks functionality is to send automatic SMS to clients when financial transactions are recorded. In a normal software application, one would need to modify the backend application itself to do anything like this, but with Mifos X webhooks, an independent application can be used for this purpose. Since I had previous experience writing application for webhooks for github repository, I started the MifosX Messenger project to integrate a couple of Indian Bulk SMS providers to send automatic SMS using their services. MifosX Messenger can work with multiple SMS providers and can be extended very easily to add more providers, by just adding a new subclass for the provider.

Therefore, MifosX has facilitated development of application in any platform enabling a heterogeneous system with components in different technologies working in unison using the web requests to communicate effectively. This gives rise to endless possibilities.