Running multiple instances on a single server
In this recipe, the focus is on running multiple instances of ADempiere on a single server. This is a very practical requirement when you want to host ADempiere for multiple clients on a single server. Even though each instance of ADempiere is meant to handle multiple clients and organizations, there may be a scenario where you may have to put up multiple instances of ADempiere not only from the technical perspective, but also from an operational perspective. For example, one instance is to be run on PostgreSQL whereas the other instance is to be run on Oracle. And, if you have that scenario, this recipe will try to address it.
Here, we are going to cover two deployment topologies. In one, we will have 1-1-1 mapping between JBoss, ADempiere, and Database, that is, one instance of JBoss server hosting one instance of ADempiere, which is connecting to one database. The following image depicts the 1-1-1 setup.
In the second instance, we will have 1-N-1 mapping where one instance of the JBoss server will host multiple instances of ADempiere instances and each one of them will connect to a single database. The following image depicts the 1-N-1 setup:
Getting ready
These steps are common to 1-1-1 as well as 1-N-1 setup.
Copy the
<ADEMPIERE_SVN>\tags\adempiere360lts
to<ADEMPIERE_SVN>\tags\adempiere360lts_2
.Change the project name to
adempiere_360_2
in the<ADEMPIERE_SVN>\tags\adempiere360lts_2\.project
file.Import the
<ADEMPIERE_SVN>\tags\adempiere360lts_2
project into Eclipse.Create the
adempiere360_2
database in PostgreSQL and set up the schema and the initial data by following the steps mentioned in the Installing ADempiere recipe. Remember to use the already created useradempiere
.
How to do it...
1. Running instance with 1-1-1 Setup.
Here we will set up one more JBoss and ADempiere instance.
Go to the
<JBOSS_HOME>\server
folderCopy the default folder to
adempiere360lts_2
. You may have any name for your serverModify the port numbers in the following files so that they are not shared with the default server ports and they are available on your system:
< JBOSS_HOME>\server\ adempiere360lts_2\conf\jboss-service.xml:
Modify the following ports—8083, 1099, 1098, 4444, 4445
< JBOSS_HOME>\server\ adempiere360lts_2\deploy\ejb3.deployer\META-INF\jboss-service.xml:
Modify the following port—3873
< JBOSS_HOME>\server\ adempiere360lts_2\deploy\jms\uil2-service.xml:
Modify the following port—8093
< JBOSS_HOME>\server\ adempiere360lts_2\deploy\jboss-web.deployer\server.xml:
Modify the following ports—8080, 8443, 8009
Open the
<ADEMPIERE_SVN>\tags\adempiere360lts_2\.settings\org.eclipse.wst.common.component
file and change thedeploy-name
fromAdempiere_trunk
toAdempiere_360_2
(you may have any name or your choice)Go to Eclipse and refresh the
adempiere_360_2
projectFollow the steps mentioned in Debugging ADempiere server application recipe to add a new JBoss server pointing to
<JBOSS_HOME>\server\adempiere360lts_2
and deployAdempiere_360_2
to it. Make sure, yourPropertyFile
VM argument points to theAdempiere.properties
created in<ADEMPIERE_SVN>\tags\adempiere360lts_2
folder andADEMPIERE_HOME VM
argument points to<ADEMPIERE_SVN>\tags\adempiere360lts_2
Now, run the JBoss default server, where you had
Adempiere_trunk
deployed, and also run the second JBoss server where you haveAdempiere_360_2
deployed
2. Running an instance with 1-N-1 Setup.
Go to Eclipse
Right-click on the JBoss server entry in the Servers view, which we had created with the default configuration and to which
Adempiere_trunk
was deployed, and click Add and Remove. You will seeAdempiere_trunk
listed under the Configured items andAdempiere_360_2
listed under the Available itemsAdd
Adempiere_360_2
to the Configured list and click on the Finish buttonRight-click on the JBoss server entry and click Publish to deploy
Adempiere_360_2. Adempiere_360_2
will be the context for this ADempiere instanceRight-click on the JBoss server entry and click on Start the server with two instances of ADempiere deployed. You can now access the two instances by accessing the following URLs:
Both ADempiere instances will be pointing to the same database as the database connection detail is mentioned in the Adempiere.properties file and a common property file is used in the VM arguments of the JBoss server.
How it works...
In order to have an instance with 1-1-1 setup, important point to make is making sure that we are able to run multiple instances of the JBoss server on a single machine. This requires us to make changes to the different port numbers, which one or another service in JBoss uses. If this is not done, some or some other service would not run and that would lead to an error while we try to deploy and run the application.
In the 1-N-1 setup, JBoss ports are not of concern as we will be running a single instance of it. However, the important point here is the deployment name for the multiple instances of the ADempiere application. Uniqueness must be maintained across ADempiere instances in terms of deploy-name
, otherwise the deployment of one instance will overwrite the deployment of a second instance, as it uses the deploy-name
as the WAR filename.
See also
Creating an installer from the source code
Installing ADempiere