Wiki Spaces
Documentation
Projects
Resources
Get Help from Others
Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack
It is possible to run multiple instances of OpenMRS in the same servlet container instance. OpenMRS looks up database connection properties from the runtime properties file and so the different instances can connect to different databases. The runtime properties file lookup is based on the name of the webapp, so creating a second instance is (almost) as easy as renaming the war file and deploying it.
The application data dir is where openmrs stores temporary data, the omods loaded, and the runtime properties. This is ~/.OpenMRS on linux based machines and /home/user/Application Data/OpenMRS for windows based ones. You can change the location of the application data directory several ways. See the Application Data Directory page for details and methods.
By default the modules folder is stored in a folder named "modules" in the application data directory. If you change the app dir directory for each instance you don't need to change the modules folder. However, if you use the same app dir for each instance (not advised for production, ok for testing), you should change the folder where modules are stored using the setting (formerly Global Property from 1.8 downwards)module_repository_folder. You can use either a relative path (relative to the app dir) or an absolute path.
If you don't change either of those, data stored on the file system (like which modules to load at startup, cached data exports, etc.) will be shared by both instances.
You can easily have two or more standalone openmrs installations on server. All data is kept within that unzipped folder. When the standalone starts up, it will keep trying new ports for mysql and tomcat until one is found that is available.
The standard "mvn jetty:run" command in the webapp folder starts "openmrs" on port 8080. You can start a second instance of openmrs on a different port and with a different context path by using two Java properties: webapp.name and jetty.port:
mvn jetty:run -Dwebapp.name=openmrs2 -Djetty.port=8081
You might want to change the location of the application data directory using a runtime property. You can also change the folder where modules are stored using a setting (formerly Global Property from 1.8 downwards): module_repository_folder. You can use either a relative path or an absolute path.
2 Comments
Marcos Núñez
Changing the name of the war to openmrs_prod and creating the folder .OpenMRS_prod (with a modules_prod folder inside) won't do the trick. It still saves everything in .OpenMRS. How do I manually point the wizard to a .OpenMRS_prod folder?
WARN - OpenmrsUtil.getRuntimeProperties(2304) |2012-03-13 14:47:50,624| Unable to find properties file: /usr/share/tomcat6/.OpenMRS/openmrs_prod-runtime.properties
Deploying OMRS 1.8.3
Nadeeshani Hewage
Thanks for the guide! Got it done easily.