Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Feature/Deployment Manager"

< Jetty‎ | Feature
m
Line 1: Line 1:
 
{{Jetty Feature
 
{{Jetty Feature
 
| introduction =
 
| introduction =
In order for Jetty to serve content (static or dynamic) a [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/handler/ContextHandler.html ContextHandler] must be created and added to Jetty in the appropriate place.  A pluggable DeploymentManager exists in Jetty 7 to make this process easier.  The Jetty distribution contains example DeploymentManager configurations to deploy WAR files found in a directory to Jetty, and to deploy Jetty context.xml files into Jetty as well.  
+
In order for Jetty to serve content (static or dynamic), you need to create a [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/handler/ContextHandler.html ContextHandler] and add it to Jetty in the appropriate place.  A pluggable DeploymentManager exists in Jetty 7 to make this process easier.  The Jetty distribution contains example DeploymentManager configurations to deploy WAR files found in a directory to Jetty, and to deploy Jetty context.xml files into Jetty as well.  
  
 
| body =
 
| body =
  
The Deployment Manager is the heart of the typical webapp deployment mechanism; it operates as a combination of an Application LifeCycle Graph, Application Providers that find and provide Applications into the Application LifeCycle Graph, and a set of Bindings in the Graph to control the behavior of the deployment process.
+
The Deployment Manager is the heart of the typical webapp deployment mechanism; it operates as a combination of an Application LifeCycle Graph, Application Providers that find and provide Applications into the Application LifeCycle Graph, and a set of bindings in the graph that control the deployment process.
  
 
[[Image:Jetty_DeployManager_DeploymentManager_Roles.png]]
 
[[Image:Jetty_DeployManager_DeploymentManager_Roles.png]]
  
=== App Providers ===
+
=== Application Providers ===
  
Applications that are to eventually become Deployed must first enter be identified by an [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/AppProvider.html AppProvider], whose responsibility it is to provide Apps to the DeploymentManager.
+
Before Jetty deploys an application, an [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/AppProvider.html AppProvider] identifies the App and then provides it to the Deployment Manager. Two AppProviders come with the Jetty distribution:
  
There are two AppProvider's that come with the Jetty Distribution.
+
*'''[http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/providers/WebAppProvider.html WebAppProvider]'''–monitors a directory for <tt>*.war</tt> files and submits them to the Application LifeCycle Graph for deployment into a context with the same name as the <tt>*.war</tt> file itself.
  
'''[http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/providers/WebAppProvider.html WebAppProvider]'''
+
*'''[http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/providers/ContextProvider.html ContextProvider]'''–monitors a directory for <tt>*.xml</tt> files, and using the Jetty Xml configurator creates a ContextHandler (usually a WebAppContext) for the Application LifeCycle Graph.
 
+
The default WebAppProvider can monitor a directory for *.war files and submit them to the Application LifeCycle Graph for deployment into a context with the same name as the *.war file itself.
+
 
+
'''[http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/providers/ContextProvider.html ContextProvider]'''
+
 
+
The default ContextProvider can monitor a directory for *.xml files and using the Jetty Xml configurator create a ContextHandler (usually a WebAppContext) to the Application LifeCycle Graph.
+
  
 
Activating both at the same time is possible, but can be confusing because you must take care to either keep both systems deploying mutually exclusive webapps, or align naming conventions of <tt>context.xml</tt> style files with WAR and webapp directories.
 
Activating both at the same time is possible, but can be confusing because you must take care to either keep both systems deploying mutually exclusive webapps, or align naming conventions of <tt>context.xml</tt> style files with WAR and webapp directories.
Line 31: Line 25:
 
[[Image:Jetty_DeployManager_AppLifeCycle.png]]
 
[[Image:Jetty_DeployManager_AppLifeCycle.png]]
  
The nodes and edges of this graph are pre-defined in Jetty along the most common actions and states found.
+
The nodes and edges of this graph are pre-defined in Jetty along the most common actions and states found. These nodes and edges are not hardcoded; you can adjust  and add to them depending on your needs (for example, any complex requirements for added workflow, approvals, staging, distribution, coordinated deploys for a cluster or cloud, etc...).
These nodes and edges are not hardcoded, and can be adjusted and added to depending on need. (Such as any complex need for added workflow, approvals, staging, distribution, coordinated deploys for a cluster or cloud, etc...)
+
  
New Applications enter this graph at the Undeployed node, and are pushed through the graph via the use of the [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/DeploymentManager.html#requestAppGoal(org.eclipse.jetty.deploy.App, java.lang.String) DeploymentManager.requestAppGoal(App,String)] method.
+
New Applications enter this graph at the Undeployed node, and the [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/DeploymentManager.html#requestAppGoal(org.eclipse.jetty.deploy.App, java.lang.String) DeploymentManager.requestAppGoal(App,String)] method pushes them through the graph.
  
 
=== LifeCycle Bindings ===
 
=== LifeCycle Bindings ===
  
The responsibility for deploying, starting, stopping, undeploying is handled by a set of default [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/AppLifeCycle.Binding.html AppLifeCycle.Binding]'s that define the standard behavior.
+
A set of default [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/AppLifeCycle.Binding.html AppLifeCycle.Binding]s define standard behavior, and handles deploying, starting, stopping, and undeploying applications. If you choose, you can write your own AppLifeCycle.Binding's and assign them to anywhere on the Application LifeCycle graph.
 
+
If you choose to, you can write your own AppLifeCycle.Binding's and assign them to anywhere on the Application LifeCycle graph.
+
  
Example's of new AppLifeCycle.Binding implementations that could be written:
+
Examples of new AppLifeCycle.Binding implementations that you can write include:
  
* Validate the incoming Application.
+
* Validating the incoming application.
* Prevent the deployment of known forbidden Applications.
+
* Preventing the deployment of known forbidden applications.
* Submit the installation to an Application auditing service in a corporate environment.
+
* Submitting the installation to an application auditing service in a corporate environment.
* Distribute the Application to other nodes in the cluster or cloud.
+
* Distributing the application to other nodes in the cluster or cloud.
* Email owner / admin of change of state of the Application.  
+
* Emailing owner/admin of change of state of the application.  
  
 
There are four default bindings:
 
There are four default bindings:
* [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/bindings/StandardDeployer.html StandardDeployer] - will deploy the ContextHandler into Jetty in the appropriate place.
+
* [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/bindings/StandardDeployer.html StandardDeployer]–Deploys the ContextHandler into Jetty in the appropriate place.
* [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/bindings/StandardStarter.html StandardStarter] - will set the ContextHandler to started and start accepting incoming requests  
+
* [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/bindings/StandardStarter.html StandardStarter]–Sets the ContextHandler to started and start accepting incoming requests.
* [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/bindings/StandardStopper.html StandardStopper] - will stop the ContextHandler and stop accepting incoming requests.  
+
* [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/bindings/StandardStopper.html StandardStopper]–Stops the ContextHandler and stop accepting incoming requests.  
* [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/bindings/StandardUndeployer.html StandardUndeployer] - will remove the ContextHandler from Jetty.
+
* [http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/deploy/bindings/StandardUndeployer.html StandardUndeployer]–Removes the ContextHandler from Jetty.
  
 
[[Image:Jetty_DeployManager_DefaultAppLifeCycleBindings.png]]
 
[[Image:Jetty_DeployManager_DefaultAppLifeCycleBindings.png]]
  
A fifth, non-standard binding, called ''DebugBinding'', is also available for debugging reasons; It will Log the various transitions through the Application LifeCycle.
+
A fifth, non-standard binding, called ''DebugBinding'', is also available for debugging reasons; It logs the various transitions through the Application LifeCycle.
  
 
}}
 
}}

Revision as of 17:36, 30 June 2011



Introduction

In order for Jetty to serve content (static or dynamic), you need to create a ContextHandler and add it to Jetty in the appropriate place. A pluggable DeploymentManager exists in Jetty 7 to make this process easier. The Jetty distribution contains example DeploymentManager configurations to deploy WAR files found in a directory to Jetty, and to deploy Jetty context.xml files into Jetty as well.

Feature

The Deployment Manager is the heart of the typical webapp deployment mechanism; it operates as a combination of an Application LifeCycle Graph, Application Providers that find and provide Applications into the Application LifeCycle Graph, and a set of bindings in the graph that control the deployment process.

Jetty DeployManager DeploymentManager Roles.png

Application Providers

Before Jetty deploys an application, an AppProvider identifies the App and then provides it to the Deployment Manager. Two AppProviders come with the Jetty distribution:

  • WebAppProvider–monitors a directory for *.war files and submits them to the Application LifeCycle Graph for deployment into a context with the same name as the *.war file itself.
  • ContextProvider–monitors a directory for *.xml files, and using the Jetty Xml configurator creates a ContextHandler (usually a WebAppContext) for the Application LifeCycle Graph.

Activating both at the same time is possible, but can be confusing because you must take care to either keep both systems deploying mutually exclusive webapps, or align naming conventions of context.xml style files with WAR and webapp directories.

Application LifeCycle Graph

The core feature of the DeploymentManager is the Application LifeCycle Graph.

Jetty DeployManager AppLifeCycle.png

The nodes and edges of this graph are pre-defined in Jetty along the most common actions and states found. These nodes and edges are not hardcoded; you can adjust and add to them depending on your needs (for example, any complex requirements for added workflow, approvals, staging, distribution, coordinated deploys for a cluster or cloud, etc...).

New Applications enter this graph at the Undeployed node, and the java.lang.String) DeploymentManager.requestAppGoal(App,String) method pushes them through the graph.

LifeCycle Bindings

A set of default AppLifeCycle.Bindings define standard behavior, and handles deploying, starting, stopping, and undeploying applications. If you choose, you can write your own AppLifeCycle.Binding's and assign them to anywhere on the Application LifeCycle graph.

Examples of new AppLifeCycle.Binding implementations that you can write include:

  • Validating the incoming application.
  • Preventing the deployment of known forbidden applications.
  • Submitting the installation to an application auditing service in a corporate environment.
  • Distributing the application to other nodes in the cluster or cloud.
  • Emailing owner/admin of change of state of the application.

There are four default bindings:

Jetty DeployManager DefaultAppLifeCycleBindings.png

A fifth, non-standard binding, called DebugBinding, is also available for debugging reasons; It logs the various transitions through the Application LifeCycle.

Back to the top