Book Image

ADempiere 3.6 Cookbook

Book Image

ADempiere 3.6 Cookbook

Overview of this book

Table of Contents (16 chapters)
ADempiere 3.6 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

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 user adempiere.

How to do it...

  1. 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 folder

    • Copy the default folder to adempiere360lts_2. You may have any name for your server

    • Modify 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 the deploy-name from Adempiere_trunk to Adempiere_360_2 (you may have any name or your choice)

    • Go to Eclipse and refresh the adempiere_360_2 project

    • Follow the steps mentioned in Debugging ADempiere server application recipe to add a new JBoss server pointing to <JBOSS_HOME>\server\adempiere360lts_2 and deploy Adempiere_360_2 to it. Make sure, your PropertyFile VM argument points to the Adempiere.properties created in<ADEMPIERE_SVN>\tags\adempiere360lts_2 folder and ADEMPIERE_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 have Adempiere_360_2 deployed

  2. 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 see Adempiere_trunk listed under the Configured items and Adempiere_360_2 listed under the Available items

    • Add Adempiere_360_2 to the Configured list and click on the Finish button

    • Right-click on the JBoss server entry and click Publish to deploy Adempiere_360_2. Adempiere_360_2 will be the context for this ADempiere instance

    • Right-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:

      http://localhost:8080/Adempiere_trunk/

      http://localhost:8080/ Adempiere_360_2/

  • 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