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

@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

@raff, can you please make sure to document this on the appropriate wiki page?

1 Like

Maurya, Sorry for delayed response. I made the change to web.xml and recompiled the core. It generated a unique folder according to what I put in web.xml. Thank you.

Raff, Where is the file where I can locate “OPENMRS_APPLICATION_DATA_DIRECTORY”?

Darius, Not sure about the method Raff said as I cannot find the file he mentioned. But Maurya’s suggestion is documented in an openMRS doc (very very brief) - I found it after Maurya tipped me.

Hi, I would like to use MySQL workbench instead of using standalone MYSQL. I am using Reference Application Standalone 2.8.0 I was trying to access MYSQLDUMP but failed, since I don’t see MYSQLDUMP in bin folder. looking for support…

Did you get a chance to look at this? https://wiki.openmrs.org/display/docs/OpenMRS+Standalone

Yes I did read, and connected and access the database of standalone MYSQL, however I am facing challenge when it comes to export the data. MYSQLDUMP command is missing from bin file. Any idea?

For the standalone, if all you want is backup, you can just backup the database folder, as some sites are doing in Nigeria. Using the OpenMRS Standalone version in production!

Thank a lot, will do the same.