How do I force a 2nd installation of OpenMRS to a specific directory?

There are modules that only run in older versions of openMRS and some running only in newer version of openMRS. So I wanted to run 2 versions of openMRS on the same windows based laptop. I am not able to do it. I have named openMRS war of different versions as openMRSXXX. No problem with installing the first openMRS core (V1.9.9). Database setup OK. Added a few modules. I installed the lastest openMRS (V1.11.4). No problem with running the setup & creating its database. But I did notice a worry display at the second last screen of the setup wizard. It said for the run time properties path, it listed as “C:\Application Data\OpenMRS\openmrs1114-runtime.properties”. I knew this installation will fail to run as I intended. When I opened up this second version (V1.11.4) it automatically shown I already have modules installed (the same modules that I installed for V1.9.9) The reason is the run time properties path for these 2 version of openMRS pointed to the same file directory "C:\Application Data\OpenMRS" Inside this file directory there is a sub-folder named “modules”. So the second copy (& different version in my case) of openmrs automatically looks into this folder and thought these are the modules installed. My question is: How do I force the second installation of a different version of openMRS to be installed in a different folder in "C:\Application Data"? BTW, I did look and play around with the discussions in the following thread:

The suggestion there and from other postings in various openMRS forum only works if I want to install different versions of openMRS which share the same modules. In my case, I won’t. Some modules won’t work for the newer openMRS core. Please advise. Thanks.

I am still struggling to understand why you just do not use the standalone https://wiki.openmrs.org/display/docs/OpenMRS+Standalone. For it is the easiest way of doing this as you are simply troubleshooting the behavior of the same modules in different versions of openmrs.

Hello dkayiwa

Because 1/ For the standalone sandbox approach, it takes a long time to start (booting up its tomcat, mysql etc). 2/ I want to examine the database structures between versions using MySQL workbench. Not going to be easy if using the sandbox approach.

Thanks for responding here. You are everywhere!!

This is not a supported configuration.

Michael, Thank you. I guess that is the final word & what dkaiwa probably hinted to me yesterday in the chat room. Time to move on.

If all you want to do is examine the DB, would the following work?

  1. Install Version A
  2. Do a mysqldump of the Version A database to a file
  3. Remove Version A and install Version B
  4. Do a mysqldump of the Version B database to a different file
  5. (Optionally) remove Version B
  6. Install a “traditional” MySQL database if necessary, and import the two schemas side-by-side in the separate MySQL installation.

You could then use various tools to examine and compare the two schemas…

Michael, Thank you

@sorcerer,

Now now, All hope is not lost.

true that this is not a supported configuration but, there is a workaround. This is not recommended in a production environment but, if you are just testing this would do the trick.

I see that you followed different posts but, you haven’t followed them closely. If you want two different installations on two different databases, you should have two different OpenMRS war files. You can use the normal war of whichever version you are using. Secondly, for the second installation make this edit in https://github.com/openmrs/openmrs-core/blob/master/webapp/src/main/webapp/WEB-INF/web.xml

<context-param>
        <param-name>application.data.directory</param-name>
       <param-value>/Users/{your user name}/.OpenMRS2/</param-value>(or any other folder you wish)
    </context-param>

and build a war again.

This will create a different application directory when you load it in tomcat and save all openmrs modules in the folder you specified. Allowing two different instances.

And also, having two installations is actually supported in 1.12 version of OpenMRS, i’m not sure if your modules will work on that though.

Hello Maurya, I don’t use openMRS in any production environment. I want to learn the concept of EMR by using this open source project.

I did something like what you said to web.xml (as the link I listed said something similar). I definitely made a mistake somewhere. The link actually said I need to add 2 changes to this xml file.

Let me double check the xml file and work with it again shortly. Keep you posted the outcome. Thank you very much for you feedback.

Hello Maurya, A couple of modules I am interested in won’t work beyond V1.9.9 hence I want to have 2 different versions of core openMRS working side by side. I thought the latest available version is V1.11.4 as of last Friday. Anyway…

I tried your approach. Ran into problems. The section of web.xml I added/modified is below:

            <param-name>webAppRootKey</param-name>

            <param-value>OpenMRS199</param-value>
             <param-name>application.data.directory</param-name>

             <param-value>/Users/sorcerer/MyWorld/Application Data/openmrs199/</param-value>
            <param-name>webAppRootKey</param-name>

            <param-value>OpenMRS1114</param-value>
            <param-name>application.data.directory</param-name>

            <param-value>/Users/sorcerer/MyWorld/Application Data/OpenMRS1114/</param-value>

In the script, MyWorld is the alias for C:/

Before I reinstall, I uninstalled the database corresponding to any previous successful install of openMRS, clean out the folder Application Data which when successfully installed, openMRS will dump a bunch of folders in & I cleaned the cache and restarted Tomcat - short of rebooting system.

Problems: 1/ Now when I typed in localhost:8080/openmrs199/ Chrome browser gave me a 404.

2/ When I typed in localhost:8080/openmrs1114/ Chrome browser went through the install. But as soon as the install started, a folder named OpenMRS was automatically created in C:/Application Data folder (as if the above script has no effect at all). When I went through the install, in the 2nd last page of the Installation Wizard, the runttime properties file parth was pointing to c:\Application Data\OpenMRS\openmrs1114-runtime.properties

Can you suggest how I can resolve this situation? Thanks in advance.

Apologies for not remembering that you are on a windows based machine, if the path you specified is something the system cant find then it will default to using the normal application folder.

I think your path should be something similar to

C:/Application Data/.OpenMRS10/ (i’m not sure about the forward or backward slashes, try with both)

Just for the sake of completeness, you can easily use the MySQL workbench to connect to your various standalone instances. I do it all day long. :slight_smile: Each standalone instance will be running at a different MySQL port. So point your workbench to the port.

The booting time for the standalone is not any longer than the non standalone components. It is actually faster because they are in memory. :slight_smile:

I keep having various standalone instances running at the same time to investigate things in different versions of OpenMRS. I have never come up with an easier approach than these. But if you want the harder way of doing it, have fun! :slight_smile:

1 Like

Hello dkayiwa, Like I said yesterday in chat, sandboxing is my last resort. Sandbox has its advantages - very clean & easy to remove. But I want to explore alternative paths & try new things (most often hard). Problem with boot time is when windows starts up, tomcat, mysql threads are running. Doing it sandbox, is like watching window boot up again - very annoying. Regards S

Hello Maurya, Originally, you said:

application.data.directory /Users/{your user name}/.OpenMRS2/(or any other folder you wish)

Why there is a period in from of OpenMRS2 in your? When I used it, I noticed there is a folder created somewhere but not in “Application Data” folder.

I used application.data.directory /Users/sorcerer/c:/Application Data/OpenMRS2/

Does it look right to you? Is enough right? I am not sure about “c:/” & the spacing in “Application Data”. The above did not work. So I was defaulted to the normal setup.

Regards, S

I think your path should be something similar to

C:/Application Data/.OpenMRS10/ (i’m not sure about the forward or backward slashes, try with both)

as there will be no path with /Users/sorcerer/c:/Application Data/OpenMRS2/ in your file system.

Hello Maurya, I want to make sure which web.xml I should be editing. It dawn on me that I may have edited the wrong file to begin with. There are at least 4 web.xml in Tomcat folder (by default) and more depending on what has been installed. The one I need to modified is in the folder “webapps/host-manager/WEB-INF/”. Correct?

@sorcerer,

I think it would be easier to edit the files even before you generate the war before you deploy it in tomcat, as I mentioned earlier. And it should be edited in the file I mentioned in the previous post.

Hello Maurya, Got it. Make sense. Thank you. S

1 Like

It is actually possible to change the OpenMRS application data directory location, thus run many instances of OpenMRS. It’s not documented, but it’s what the sdk uses. You can set the OPENMRS_APPLICATION_DATA_DIRECTORY property when running a server. For jetty it would be mvn jetty:run -DOPENMRS_APPLICATION_DATA_DIRECTORY=“c:\openmrs”

If it’s just for development, I would suggest simply using the sdk.

1 Like