Running Two Containers on One Computer

Before running multiple containers on one computer, there are two resource conflicts that need to be resolved.

  • The location of GENII_USER_DIR - the directory that containers use to store information on disk.
  • Which deployment to use.
  • (optionally) - the Bootstrap.xml file.

Getting Started

Each container *does not* need its own copy of the Genesis II program. Note that this is a change from previous statements. In Eclipse

If you are running the containers from Eclipse, obtain a copy of the Genesis II source and create corresponding Ant build file and Run/Debug profiles. Outside of Eclipse

Obtain a copy of Genesis II.


Changing GENII_USER_DIR

GENII_USER_DIR is an environment variable that needs to be changed per container as it stores the state of each container. In Eclipse

If you are running your containers from Eclipse, you can change this location in the Run/Debug profile for each container. Open up the profile for the container. Under the Environment tab, make a new variable with name GENII_USER_DIR. For the value specify where you would like to store the files associated with that container. For example, C:\.genesisII-SecondCopy. Make sure that this is a unique location for each container. Outside of Eclipse

Before starting up a container, we can change the GENII_USER_DIR for that container by editing the .bat file. The best way to do this is to create (by copying the original) some number of runContainer.bat files and edit the first line so that they call:

 SET GENII_USER_DIR=<path>

For <path> specify where you would like to store the files associated with that container. For example, C:\.genesisII-SecondCopy. Make sure that this is a unique location for each container.

Then start the container.

Note, setting GENII_USER_DIR globally will not fix the problem as there will still be conflicts between each container. also, if you have set this variable, then you will have to manually delete the .genesisII directory to achieve a wipestate.


Changing the Deployment

GenesisII now uses a deployment scheme. In order to create different containers we need to create different "deployments" per container. The best way to do this is to copy the "defualt" deployment and use it as a model. Let's call your two deployments DepA and DepB which will be in deployments/DepA and deployments/DepB respectively.

You will now need to open the server_config.xml file in each deployments/Dep?/configuration such that you change the listen_port from 18080 to different unique numbers. You now have two different deployments with two unique port numbers.

Finally, you need to edit the "Run" line such that it calls the corresponding deployment. To do this outside of Eclipse, open the .bat files and just add on the line that calls the container the name of the deployment. If you are running your containers from Eclipse, you can change this location in the Run/Debug profile for each container. Open up the profile for the container. Under the Arguments tab, add the name of the deployment you want to use (DepX) under Program Arguments.


(Optional)Editing the Bootstrap files

If you want to run two different bootstrapped containers, you must edit the bootstrap.xml files in both the configuration directories of the new deployments you have created such that you change the deployment (at the top) to the correct name and change all instances of 18080(the default port number) to the correct port. Note that these bootstrap files are no longer in the root of your GenesisII directory and are now more deeply rooted in the file hierarchy.


Attaching Containers

Once all containers are up and bootstrapped, you can easily attach them to each other if they are running the same version of Genesis II. Just use the attach command.

This is accurate as of 03/04/08