...
This article applies to Geronimo 2.0 and later.
...
A feature that helps with running multiple servers, whether or not they are sharing a repository, is the configuration substitution property facility. config.xml can have expressions of the form
...
etc. These expressions are evaluated with jexl using values set from:
...
- Create a plan (say repo2.xml) for your repository module.
Code Block xml xmlborderStyle solidtitle repo2.xml<?xml version="1.0" encoding="UTF-8"?> <module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <environment> <moduleId> <groupId>org.example.configs</groupId> <artifactId>myrepo</artifactId> <version>2.0.1</version> <type>car</type> </moduleId> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>j2ee-system</artifactId> <version>2.0.1</version> <type>car</type> </dependency> </dependencies> <hidden-classes/> <non-overridable-classes/> </environment> <!--Repository--> <gbean name="Repo2" class="org.apache.geronimo.system.repository.Maven2Repository"> <attribute name="root">repo2s/</attribute> <attribute name="resolveToServer">true</attribute> <reference name="ServerInfo"> <name>ServerInfo</name> </reference> </gbean> <!--Configuration Store service--> <gbean name="Local2" class="org.apache.geronimo.system.configuration.RepositoryConfigurationStore"> <reference name="Repository"> <name>Repo2</name> </reference> </gbean> </module> - Create the repository's root directory via
mkdir <geronimo_home>/repo2s
- The directory is specified by the
root
attribute of the Maven2Repository GBean,repo2s/
in the above example. It is a path relative to the base directory <geronimo_home>. - The
resolveToServer
attribute specifies the repository's location.true
means this path is relative to baseServer, which is useful with multiple server instances.false
means this path is relative to the base directory <geronimo_home>.
- The directory is specified by the
- Deploy the repository module by deploying
repo2.xml
viadeploy deploy repo2.xml
. tipThe
deploy
command is the script <geronimo_home>/bin/deploy.{bat,sh}, depending on your operating system. It is invoked by typing simplydeploy
either from the <geronimo_home>/bin directory, or by having that directory in your path.
Using the new repository
Using the new repository is a little tricky, and is only supported from the command line currently. The essence is to use the --targets
option of the deploy
command to target your module to deploy in your new repository. First, use the deployer list-targets command to see the repositories. The target names are long and cumbersome:
...
The use of environment variables is recommended for command-line use. For example, set REPO2= org.example.configs/myrepo/2.0-SNAPSHOT/car?ServiceModule=org.example.configs/myrepo/2.0-SNAPSHOT/car,j2eeType=ConfigurationStore,name=Local2
.
...
The syntax to undeploy from a repo is: deploy undeploy "%REPO2%|geronimo/jsp-examples/1.1.1/war"
.
...
...
Note the | character separates the repository name from the module name. The " quotes are used around the entire parameter to escape this special character from command shell interpretation.
...
...
If no --targets
are given on the deploy command, the module is deployed to all repositories. This certainly seems undesirable. If you only want to put the module in one repository, be sure to use the --targets
option!
...
Multiple Server Instances, each with its own repository(ies)
...
What's lacking is console support for multiple repositories, and support for hot deployment and plugins.
...
...
An interesting wrinkle here is in what repository is the new repository deployed? It's clear that the second repository (say repo2.xml
above) will be deployed in the first repository. Thus, making this first repository read-only will not work for dynamically adding repositories. Perhaps a second repository is added to contain these server-unique repositories. The second repository must be shared and read-write, so it does not fit nicely in the use case.