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

Jetty/Feature/Deployment Manager

< Jetty‎ | Feature
Revision as of 17:01, 27 April 2011 by Jesse.mcconnell.gmail.com (Talk | contribs) (New page: {{Jetty Feature | introduction = Jetty provides capability to deploy an arbitrary context or web application by monitoring a directory for changes. If a web application or a context descri...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)



Introduction

Jetty provides capability to deploy an arbitrary context or web application by monitoring a directory for changes. If a web application or a context descriptor is added to the directory, a new context will be deployed. If a context descriptor is touched/updated then it's context will be stopped, reconfigured and redeployed. If a context descriptor is removed, then it's context will be stopped and removed from the server.

Feature

Deploy Manager is the heart of the webapp deployment mechanism, it is responsible for the lifecycle of an application through the phases of deployment.

In essence it is a graph that is pre-populated with standard edges/nodes. Alone these edges/nodes are useless so we have the ability to bind an implementation (of the DeployManager) to a specific node. There are four default bindings, 'deploying', 'starting', 'stopping', and 'undeploying'. There is a fifth that is provided which is not a part of the standard process called the DebugBinding.

Now a graph with bindings is nothing without a way for (web)apps to enter the lifecycle. And that is what the AppProviders are. You can have as many AppProvider implementations as you like registered with the deployment manager mechanism. By default we have two provided with jetty, the ContextProvider finds and provides webapps based on the existence of context.xml files in the ${jetty.home}/contexts directory and the WebAppProvider which finds and provides webapps based on the existence of war files or webapp directories within the ${jetty.home}/webapps directory. Having both active at the same time is possible, but can be confusing as you must take care to either keep both systems deploying mutually exclusive webapps or by aligning naming conventions of context.xml style files with war/webapp directories.

The lifecycle graph (the collection of edges and nodes) can be modified at startup. An implementor can insert new edges and nodes where they choose but it's quite an advanced usage. Normal use cases will be fine with the existing mechanism, although if there is a requirement for preprocessing a webapp to scan for some metadata, or check for some external condition like database accessibility that a particular user installation is highly interested in. Regardless, only those working on advanced deployments, vetting of content, modification of webapps prior to deployment should really concern themselves with extending the deployment manager in this way.

Looking at the graphs, if a new app is submitted to the lifecycle by an App Provider, it automatically enters the graph at “Undeployed.” There is a request to the DeploymentManager to move that app to 'Started' state. (this is the default behavior of jetty atm). The app is found at "Undeployed", and a breadth-first search is performed on the graph to see how to get to 'Started'. It finds the path .... Undeployed -> Deploying -> Deployed -> Starting -> Started. It executes each step of the path, and executes each binding at each step, stopping if it reaches the goal node, or if an exception is thrown.

Back to the top