Wiki Markup |
---|
{scrollbar} |
Excerpt |
---|
In this section we will illustrate how to assemble a custom server from the command line. |
Similarly you can use the GShell deploy/assemble command specifying the same information on the command line interactively. For more information about how to use deploy/assemble, please use --help as followed.
No Format | ||
---|---|---|
| ||
User@server:/>deploy/assemble -help
assemble
--
--secure |
This page introduces how to customize a server with plugins from the existing one to meet requirements of your application.
Table of Contents |
---|
Building a plugin.
By far the easiest way to build a Geronimo plugin is with maven using the car-maven-plugin to build a module. Any such module will include a geronimo-plugin.xml descriptor with at least minimal information. When possible, such as the description and license, this information is taken from the pom itself. Normally you will build the dependency list from the modules dependencies which are constructed from the maven dependencies plus whatever additional dependencies the deployers determine are needed. For instance an ejb application will have the openejb plugin added as a dependency by the openejb deployer. If necessary you can specify the dependencies for both the module and plugin descriptor explicitly in the car-maven-plugin configuration.
Here's an example of a car-maven-plugin configuration using maven dependencies and configuring most of the additional information possible:
Code Block | ||
---|---|---|
xml | xml | <plugin> <groupId>org.apache.geronimo.buildsupport</groupId> <artifactId>car-maven-plugin</artifactId> <configuration> Use <useMavenDependencies>secure channel -a (--artifact) VAL server <value>true</value>artifact name -f (--format) VAL zip <includeVersion>true</includeVersion>or tar.gz -g (--groupId) VAL server </useMavenDependencies>groupId -h (--help) <category>Tomcat</category> Display this <instance>help message <plugin-artifact> -l (--list) refresh plugin list <copy-filem relative-to="server" dest-dir="var/catalina">tomcat-base/</copy-file> (--mode) VAL custom assembly mode <config-xml-content> -p (--port) N Port, default 1099 -s <!(--hostname, --server) ToVAL disable accesslogging uncomment theHostname, followingdefault lineslocalhost -t (--path) VAL <gbean name="TomcatEngine">assembly location -u (--username) VAL <reference name="TomcatValveChain" />Username -v (--version) VAL </gbean>server version <gbean name="AccessLogValve" load="false"></gbean> --> -w (--password) VAL <gbean name="TomcatWebConnector"> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${HTTPPort + PortOffset}</attribute> <attribute name="redirectPort">${HTTPSPort + PortOffset}</attribute> <attribute name="maxHttpHeaderSize">8192</attribute> <attribute name="maxThreads">150</attribute> <attribute name="minSpareThreads">25</attribute> <attribute name="maxSpareThreads">75</attribute> <attribute name="enableLookups">false</attribute> <attribute name="acceptCount">100</attribute> <attribute name="connectionTimeout">${WebConnectorConTimeout}</attribute> <attribute name="disableUploadTimeout">true</attribute> </gbean> <gbean name="TomcatAJPConnector"> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${AJPPort + PortOffset}</attribute> <attribute name="redirectPort">${HTTPSPort + PortOffset}</attribute> <attribute name="minSpareThreads">25</attribute> <attribute name="maxSpareThreads">75</attribute> <attribute name="enableLookups">false</attribute> </gbean> <gbean name="TomcatWebSSLConnector"> <attribute name="host">${ServerHostname}</attribute>Password |
By default, target location of newly assembled server is directory /var/temp/assembly
, target packge format is tar.gz and version number is 1.0. User will have to input groupId and artifactId.
No Format | ||
---|---|---|
| ||
# run using ./bin/gsh
User@server:/>deploy/assemble -g org.apache.geronimo.asseblies -a testServer -v 1.0 -u system -w manager
|
Then GShell will ask you with a list of assembly modes.
No Format | ||
---|---|---|
| ||
Available custom assembly modes:
1: Function Centric
2: Application Centric
3: Expert Users
Please select a custom assembly mode [1,2,3]
|
- Choose 1 or 2 then you have to select the framework plugin group (Geronimo Plugin Group :: Framework) which includes several plugins used to start the server.
- Choose 3 to assemble a server using plugins as an experienced user. In order to get a working server you must include the plugin (Geronimo Assemblies :: Boilerplate) which includes several files used to start the server.
Note: look into Plugins Group for more details about differences between framework plugin group and boilerplate plugin.
After you input your choice, you will have to select plugin or plugins group you intend to install and click Enter. A few seconds later, your assembly will be ready for use.
No Format | ||
---|---|---|
| ||
**** Installation Complete!
Used existing: cglib/cglib-nodep/2.1_3/jar
...
Installed new: org.apache.geronimo.framework/jsr88-cli/2.2-SNAPSHOT/car
Downloaded 23085 kB in 25s (923 kB/s)
|
Go to <GERONIMO_HOME>/var/temp
, you will find the package of newly assembled server with minimizing footprint and the fewest components you need only. By copying and extracting the package to any places you like, you can start the assembly as an independent server. Startup duration and system modules loaded are greatly reduced. Here is a snapshot of an assembly only with framework plugin group selected after startup.
No Format | ||
---|---|---|
| ||
Booting Geronimo Kernel (in Java 1.6.0)... Module 1/11 org.apache.geronimo.framework/j2ee-system/2.2-SNAPSHOT/car started in <attribute name="port">${HTTPSPort + PortOffset}</attribute> <attribute name="maxHttpHeaderSize">8192</attribute> <attribute name="maxThreads">150</attribute> <attribute name="minSpareThreads">25</attribute>.000s Module 2/11 org.apache.geronimo.framework/transformer-agent/2.2-SNAPSHOT/car started in <attribute name="maxSpareThreads">75</attribute> <attribute name="enableLookups">false</attribute> <attribute name="acceptCount">100</attribute> <attribute name="disableUploadTimeout">false</attribute> <attribute name="clientAuth">false</attribute>.000s Module 3/11 org.apache.geronimo.framework/gshell-framework/2.2-SNAPSHOT/car started in <attribute name="algorithm">Default</attribute> <attribute name="sslProtocol">TLS</attribute> <attribute name="keystoreFile">var/security/keystores/geronimo-default</attribute>.000s Module 4/11 org.apache.geronimo.framework/gshell-geronimo/2.2-SNAPSHOT/car started in .000s Module <attribute name="keystorePass">secret</attribute> <attribute name="keystoreType">JKS</attribute> </gbean>5/11 org.apache.geronimo.framework/gshell-remote/2.2-SNAPSHOT/car <gbean name="TomcatHost"> <attribute name="initParams"> name=${ServerHostname}started in .000s Module 6/11 org.apache.geronimo.framework/jee-specs/2.2-SNAPSHOT/car started in appBase= workDir=work.000s Module 7/11 org.apache.geronimo.framework/rmi-naming/2.2-SNAPSHOT/car started in </attribute> </gbean> </config-xml-content> <config-substitution key="HTTPPort">8080</config-substitution> <config-substitution key="AJPPort">8009</config-substitution>.453s Module 8/11 org.apache.geronimo.plugins.classloaders/geronimo-javaee-deployment _1.1MR3_spec/2.2-SNAPSHOT/car started in .000s Module 9/11 org.apache.geronimo.framework/plugin/2.2-SNAPSHOT/car <config-substitution key="HTTPSPort">8443</config-substitution> started in .516s Module <config-substitution key="ServerHostname">0.0.0.0</config-substitution>10/11 org.apache.geronimo.framework/j2ee-security/2.2-SNAPSHOT/car <config-substitution key="WebConnectorConTimeout">20000</config-substitution> started in .140s Module <config-substitution key="webcontainer">TomcatWebContainer</config-substitution> <config-substitution key="webcontainerName">tomcat6</config-substitution> 11/11 org.apache.geronimo.framework/server-security-config/2.2-SNAPSHOT/c ar </plugin-artifact> started in </instance> </configuration> </plugin> |
As you use maven to build plugins, a geronimo-plugins.xml plugin catalog is automatically maintained in your local maven repository. You can force this to be rebuilt by running
Code Block |
---|
mvn org.apache.geronimo.buildsupport:car-maven-plugin:create-pluginlist
|
This might be necessary if you prune your maven repository and remove plugins listed in the catalog.
Alternatively, you can construct the geronimo-plugin.xml file by hand and include it in a deployed module in a geronimo server.
The admin console also allows limited editing of geronimo-plugin.xml files but editing the information about how the plugin fits into the server is not yet supported.
Installing plugins
If the appropriate admin console plugin is installed (and your geronimo server includes web app support) you can install plugins from a plugin repository. After selecting the "plugins" page from the navigation menu select the plugin repository you want, such as your local maven repository if you have been building your own plugins. Next you see a list of available plugins from the repository. Select multiple plugins using the checkboxes or a single plugin as a link, and on the next page you will see more information on the plugins. On your approval the plugins will be downloaded and installed.
Alternatively you can use gshell to install plugins using the deploy/list-plugins command. This can be run with a command line or interactively. Interactively you can select the plugin repository to use (if more than one is known), and then select the plugins to install. Again, they will be downloaded and installed. An example of command line usage will be seen in later when we discuss assembling a server.
Extracting a server from an existing server.
Just as with installing plugins, this can be done from the admin console, gshell, and the Geronimo Eclipse Plugin. In the admin console you specify the groupId and artifactId of the server you want, the version, and the archive type and then select the plugins you want installed. The server will be assembled in var/temp.
Similarly you can use the gshell deploy/assemble-server command specifying the same information on the command line or interactively.
Tip | ||
---|---|---|
| ||
In order to get a working server you must include the geronimo-boilerplate-minimal plugin which includes several files used to start the server |
TODO: The groupId is not currently used but the intention is to copy the assembled server into an appropriate maven repository.
Here's an example of a gshell script to install the roller plugin into the framework assembly and extract a server that only supports roller (and does not include the admin console or any deployment capabilities)
TODO: use something like this: snippet:url=geronimo/plugins/roller/trunk/roller-jetty-commands
TODO: get gshell to accept line continuations as in the following (these DO NOT WORK IN REAL LIFE):
Code Block |
---|
# assembles a server containing roller-jetty from the geronimo-framework server.
# run using ./bin/gsh < roller-jetty-commands
deploy/list-plugins -u system -w manager -r file:/Users/david/.m2/repository/\
org.apache.geronimo.plugins/roller-jetty/0.0.2-SNAPSHOT/car\
org.apache.geronimo.plugins/roller-themes/0.0.2-SNAPSHOT/car
deploy/assemble -g org.apache.geronimo.assemblies -a geronimo-roller-jetty -v 1.0-SNAPSHOT\
org.apache.geronimo.assemblies/geronimo-boilerplate-minimal/2.1-SNAPSHOT/jar\
org.apache.geronimo.plugins/roller-jetty/0.0.2-SNAPSHOT/car\
org.apache.geronimo.plugins/roller-themes/0.0.2-SNAPSHOT/car
|
.047s
Startup completed in 1.969s seconds
Listening on Ports:
1099 0.0.0.0 RMI Naming
9999 0.0.0.0 JMX Remoting Connector
Geronimo Application Server started
|
Refer to Plugins Group if you want to learn moreThe use of the GEP to assemble a custom server is very similar to the other methods. While the Geronimo server is running, use the server's popup menu to launch the Custom Server Assembly dialog. Specify the artifact name, group, version, archive type, path (relative to the running server), and plugins that you want installed. Once again, remember that the geronimo-boilerplate-minimal plugin must be included to get a working server.