Can I run multiple copies of openmrs in the same tomcat instance?

One gripe I have is to install multiple OpenMRS instances can be installed on a single Tomcat container I should be able to have openmrs.war, ugandaemr.war and mycustomemr.war all pointing to different databases.

This means that the global configurations are insulated from each other, therefore the application becomes self contained.

1 Like

I believe this is already possible for later versions of OpenMRS

@wyclif I am currently using 2.0.6 and its still still the same … Did this change in 2.1 or 2.2?

You are saying this is not possible with say 1.11.x versions? I was under the impression this is possible!

What exactly are you trying to do? Help me understand because I think what you want is very possible.

@ssmusoke unless you mean some other issue which possibly you need to explain and give the error you get, otherwise you should be able to run multiple openmrs war files with different names in the same tomcat instance.

@ssmusoke I split this into its own thread. I do think it’s possible to run multiple copies of OpenMRS in one tomcat instance. It looks in a different place for the runtime properties file and application dir depending on the webapp name.

1 Like

@darius I am going to try to simulate the issue again, it was not a runtime properties issue but some internal services, probably JMS.

Need to setup Tomcat which I removed now that I am using the SDK exclusively for development

@ssmusoke I have done this on several occasions with the 1.11.x release line, i actually was still able to run 1.6.7 (in the default ~/.OpenMRS) and 1.11.x (stored in any other place) in the same tomcat container, as @darius mentioned, prepare your war file names to be uniquely named to match your properties files (keep copies in ~/.OpenMRS or its equivalent as well as in pointed to data folders) that point to where your different pieces such as databases, data folders are for all your instances respectively.

This should work since i have used it before without any issues

@psmatsinhe this thread describes how to run multiple openmrs in one tomcat instance, please invite Horacio form FHI into this space

Hi @k.joseph,

And how do you access them on the browser, are you suppossed to do any modifications in the server.xml of the tomcat? looks like those projects are NOT being started by default, it needs someone to get in and start them manually. Is there anything you did such that when you write serverIp:8080/project_name it works automatically, or some changes need to be made?

Thanks

i think if all the project war files exist in tomcat, they should auto deploy, else manually start them in tomcat one after the other

You just have to make sure the war files have different names, to access them in the browser you need to use their respective names as the root context paths. E.g if you deployed 2 openmrs war files named openmrs1.war and openmrs2.war on your machine, to access them you would need to to navigate to http://localhost:8080/openmrs1 and http://localhost:8080/openmrs2 respectively.

Thanks @wyclif, we already have those working, but my concern was NOT all the web apps are starting when tomcat is started, some start but others fail, forcing someone to open the manager GUI to start them manually. For instance, I set up 10 openmrs instances and observed only 5 out of ten starts automatically on tomcat restart. So the question is, is there a setting in tomcat that need to be made for them to start when the server starts or this is an openmrs limitation? am on java7 and tomcat7.

probably running to the logs would help u know why those 5 aren’t starting, i don’t think it’s tomcat just ignoring to start all of them!

I highly doubt if you can run that many OpenMRS instances on the same machine, you most likely just can’t have enough memory to keep up, and that must be the reason why some instances fail to start.

Hi @ningosi not sure if still relevant, the way I found to do it was to modify the WEB-INF/web.xml and add context to each instance with different param-value

<context-param>
   <param-name>webAppRootKey</param-name>
   <param-value>instance.1</param-value>
</context-param>

With this you can add as many instance in the same tomcat instance without having to initiate manually, it may go slow depending on your machine capabilities…

2 Likes

Hello, Many thanks for this. Can you kindly guide me on how to edit WEB-INF/web.xml and add the ?