Page tree
Skip to end of metadata
Go to start of metadata

Outdated

As of March 2017, the resources mentioned on this page are outdated/ no longer maintained. The OpenMRS SDK is now the preferred method for launching a local instance of the Reference Application.

 

Introduction

Developers have the ability to deploy and test changes to any of the Reference Application's modules before pushing those changes to GitHub.  The mechanism makes use of Vagrant and Puppet to provision test environments on the developer's workstation with one command.

Requirements

NOTE FOR WINDOWS USERS:  Make sure you clone your repository with the git config option core.autocrlf=false to preserve Unix-style line breaks in scripts and properties files.

The following software will need to be installed on your system.

Details on virtual machine

WIP

Process to launch an instance with latest code from HEAD

  1. Clone / Pull the Reference Application's Distro repository.  https://github.com/openmrs/openmrs-distro-referenceapplication.git
  2. CD to the base directory of that clone.
  3. Run the command 'mvn clean package' to create a zip file of the war and omods for the Reference Application.

  4. Run the command 'vagrant up'

  5. Browse to http://localhost:8080/openmrs to access the application
  6. OPTIONAL: When done testing run 'vagrant halt' to stop the virtual machine.

NOTES

  • The first time you run vagrant up the command will attempt to download a virtual machine image that is ~270MB in size.  This download will only happen once and the image will be preserved on your system afterwards. If your situation requires you to use a download manager, you can download the box at http://goo.gl/8kWkm. Once downloaded, you have to add the box to your vagrant setup using the following command before 'vagrant up' in the steps above: 

    vagrant box add openMRSBase THE_LOCATION_OF_THE_DOWNLOADED_FILE

    For example, you could use the following location for Windows:

    vagrant box add openMRSBase C:/Users/admin/Downloads/UbuntuServer12.04amd64.box

    Note that we use forward slashes '/' instead of back slashes '/' in the file location.

  • The first time you run vagrant up puppet will install necessary software (e.g. java, tomcat7, mysql) on the virtual machine.  This process will take some time (~15 mins depending on your network speed), but is also a one time occurrence.
  • If you already have tomcat running on your local workstation (or some other service using port 8080) the test application url above will not work, but port 2200 will.  If possible shutdown the other process using port 8080.

Process to update an instance with work in progress (aka uncommitted) code changes

  1. Run a 'mvn clean install' under the module to which you want to test changes.

  2. CD to the base directory of the Reference Application's Distro module.
  3. Run the command 'mvn clean package'
  4. Run the command 'vagrant provision' (if your test machine is already running) or 'vagrant up' if your test machine is "powered off."
  5. OPTIONAL: When done testing run 'vagrant halt' to stop the virtual machine.

NOTES

  • Assuming you previously ran through the initial setup of a test machine you will not be asked to update your database.
  • If you already have tomcat running on your local workstation (or some other service using port 8080) the test application url above will not work, but port 2200 will.  If possible shutdown the other process using port 8080.

An explanation of useful vagrant commands.

  • vagrant up               - used to create a new test environment or power up one that has been halted.
  • vagrant halt           - used to power off a test environment.  
  • vagrant provision - used to reapply puppet recipes and redeploy the Reference Application (or changes to it) on an already running test environment.
  • vagrant destroy     - used to remove a test environment entirely from your system including the virtual disks.  This is safe to do but will require time for puppet to re-provision things the next time you "vagrant up" a machine.
  • vagrant ssh             - used to make an ssh connection to a running test environment.
  • No labels

3 Comments

  1. I got the following failure:

    $ vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    There are errors in the configuration of this machine. Please fix
    the following errors and try again:
    vm:
    * The 'extra' flag on synced folders is now 'mount_options'

    Vagrant 1.5.1
    VirtualBox 4.3.10

    1. After some Googling, I discovered this solution:

      Edit Vagrantfile and change this line:

        config.vm.synced_folder ".", "/vagrant", :extra => "dmode=755,fmode=755"

      to this:

        config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=755", "fmode=755"]

      (basically, just replacing the word "extra" with "mount_options")

      Update 2014-06-15: this change was committed to master

  2. Another tip: as of 28 March 2014, the username/password for the vagrant OpenMRS instance is admin/test (not admin/Admin123)