Using Docker for faster dev environments (learning from Bahmni)

@rcrichton, do you have a variation on the mysql docker image that loads up some initial data (e.g. to create an initial openmrs db configuration so that container startup is faster)?

@darius unfortunately I donā€™t. I havenā€™t found a good way to do this all with the mysql image. What Iā€™ve just been doing is creating the image then executing commands against it using my local mysql client (not quite ideal, but works quick enough):

mysql -h 127.0.0.1 -u root -p<password> -e 'create database openmrs;'
mysql -h 127.0.0.1 -u root -p<password> openmrs < ~/tmp/openshr-dump-clean-full-ciel-no-caching-gp-optimisations-05-06-15.sql

Darius I think these use cases are quite on point. Personally I would like to be able to easily test the module I am developing against any version of OpenMRS I want.

I am thinking of creating docker images for the OpenMRS versions I am interested in but that would mean having to maintain multiple databases for each one of them. Moreover I would like to be able to revert the database to some clean state if the need be and I can imagine this might be the case when testing some module specific features or when attempting to fix bugs. One could think of running mysql & tomcat/jetty in the same instance but I donā€™t like this solution because I feel the app will be tightly coupled with the database it is running against, Not a desirable characteristic considering that you might need to run against a different instance of db at some point.

Here is what I am thinking of doing when I get the chance to try this.

  1. Create images for several OpenMRS instances I am interested in.
  2. Create one mysql image and load databases to this as necessary.
  3. Create a script to automatically build the modules, copy to the right directory, point to the right instance of database and spawn the appropriate containers when run.

@sunbiz I donā€™t think this should turn into a docker vs Vagrant debate as much as what would be the best way to achieve what we want. I have to declare that I am not an expert in any of these technologies but I am sure you can easily achieve what we want to do using either docker or vagrant. Nonetheless I think it is such a good opportunity for people to experiment with docker hopping that after sometime it would be easy to make an informed decision of what to choose between the two if it ever comes to that. In the end people will still have preferences and I donā€™t think we can stop that :smile:

1 Like

I just read through these posts after attending dev call today and think that docker provides a virtual environment (platform) to run and share applications anytime and anywhere regardless of OS environment and that in a way seems to standardize app development process but I agree with @darius as he mentioned about achieving certain tasks with docker since there could be applications already running easily in their native mode and that switching to docker might require changes in the infrastructure(integrating with openmrs system components) as per this documentation I came across while surfing: http://blog.docker.com/2015/06/runc/#more-6154.

I just thought of sharing/adding to this conversation but I am not so experienced with using diff platforms (linux/ubuntu) to practically give it a sense to the point I am making here!

Hey, since I posted this (primarily due to not wanting to fight anymore; and docker is just easier and less overhead (if on linux anyways; if not on linux, boot2docker exists) and went for Docker ā€“ Iā€™m currently just dockerizing dashboard ā€“ and will blog about itā€¦itā€™s a fun learning experience, if you donā€™t struggle, you donā€™t learn :smiley:

I have an architecture setup, itā€™s just a matter of getting all the pieces to work together and it is discussed here ā€“ primarily of concern to the dashboard team ā€“ but all infrastructure projects can benefit ā€“

We should (ideally) dockerize modulus as well ā€“ automated devops is better. Ideally, we should be shooting for (near) zero-downtme update deployments.

In addition, it gives a fast way for new developers to get started fast.

Update: Looks like modulus is already dockerizedā€¦but are we deploying from itā€¦it should (ideally) use something like docker-compose, so itā€™s less brittle and much easier to understand :slight_smile: