From 35305b6a5c7519eb87c503ae8dbc990687f46347 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 16 Sep 2020 10:58:23 +0200 Subject: [PATCH] Improvements to the Jetty documentation. Reworked the start documentation. Started skeleton of the operations guide. Removed old_docs/deploying/hot-deployment.adoc and old_docs/gettingstarted/getting-started/jetty-deployment.adoc, since its content has been moved to the refactored documentation. Restructured the skeleton of the operations guide. Removed old_docs/deploying/anatomy-of-a-webapp.adoc, since its content has been moved to the refactored documentation. Removed old_docs/deploying/automatic-webapp-deployment.adoc, since its content has been moved to the refactored documentation. Removed old_docs/deploying/configuring-virtual-hosts.adoc, since its content has been moved to the refactored documentation. Removed old_docs/contexts/serving-webapps-from-particular-port.adoc and example-jetty-embedded/src/main/resource/jetty-otherserver.xml, since its content has been moved to the refactored documentation. Simplified POMs. Simplified index.adoc files, refactoring common things into config.adoc. Expanded the deploy configuration documentation. Expanded the protocols configuration documentation. Signed-off-by: Simone Bordet --- .../src/main/resources/jetty-otherserver.xml | 51 ----- .../src/main/config/modules/deploy.mod | 4 +- jetty-documentation/pom.xml | 195 +--------------- .../src/main/asciidoc/config.adoc | 41 ++++ .../asciidoc/contribution-guide/index.adoc | 38 +-- .../operations-guide/.asciidoctorconfig | 3 + .../operations-guide/begin/architecture.adoc | 81 +++++++ .../operations-guide/begin/chapter.adoc | 28 +++ .../operations-guide/begin/deploy.adoc | 120 ++++++++++ .../operations-guide/begin/download.adoc | 25 ++ .../operations-guide/begin/install.adoc | 35 +++ .../operations-guide/begin/start.adoc | 150 ++++++++++++ .../operations-guide/contexts/chapter.adoc | 23 ++ .../operations-guide/deploy/chapter.adoc | 44 ++++ .../deploy/deploy-extract-war.adoc | 39 ++++ .../deploy/deploy-hot-static.adoc | 43 ++++ .../operations-guide/deploy/deploy-jetty.adoc | 80 +++++++ .../operations-guide/deploy/deploy-jndi.adoc | 56 +++++ .../deploy/deploy-override-webxml.adoc | 60 +++++ .../operations-guide/deploy/deploy-rules.adoc | 43 ++++ .../deploy/deploy-virtual-hosts.adoc | 191 ++++++++++++++++ .../main/asciidoc/operations-guide/index.adoc | 47 +--- .../operations-guide/introduction.adoc | 32 ++- .../operations-guide/modules/chapter.adoc | 24 ++ .../modules/module-bytebufferpool.adoc | 34 +++ .../modules/module-deploy.adoc | 36 +++ .../operations-guide/modules/module-http.adoc | 64 ++++++ .../modules/module-https.adoc | 28 +++ .../modules/module-server.adoc | 36 +++ .../operations-guide/modules/module-ssl.adoc | 32 +++ .../modules/module-test-keystore.adoc | 31 +++ .../modules/module-threadpool.adoc | 34 +++ .../operations-guide/modules/modules.adoc | 27 +++ .../old_docs/contexts/chapter.adoc | 2 - .../contexts/configuring-virtual-hosts.adoc | 216 ------------------ .../serving-webapp-from-particular-port.adoc | 74 ------ .../deploying/anatomy-of-a-webapp.adoc | 42 ---- .../automatic-webapp-deployment.adoc | 42 ---- .../old_docs/deploying/chapter.adoc | 3 - .../old_docs/deploying/hot-deployment.adoc | 66 ------ .../getting-started/chapter.adoc | 1 - .../getting-started/jetty-deploying.adoc | 72 ------ .../operations-guide/protocols/chapter.adoc | 43 ++++ .../protocols/protocols-http.adoc | 77 +++++++ .../protocols/protocols-https.adoc | 102 +++++++++ .../protocols/protocols-ssl.adoc | 48 ++++ .../operations-guide/start/chapter.adoc | 20 ++ .../operations-guide/start/start-details.adoc | 25 ++ .../startup => start}/start-jar.adoc | 4 +- .../operations-guide/xml/chapter.adoc | 19 ++ .../asciidoc/operations-guide/xml/xml.adoc | 24 ++ .../asciidoc/programming-guide/index.adoc | 38 +-- .../src/main/config/modules/https.mod | 1 + jetty-server/src/main/config/modules/ssl.mod | 10 +- pom.xml | 2 +- 55 files changed, 1811 insertions(+), 895 deletions(-) delete mode 100644 examples/embedded/src/main/resources/jetty-otherserver.xml create mode 100644 jetty-documentation/src/main/asciidoc/config.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/.asciidoctorconfig create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/begin/architecture.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/begin/chapter.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/begin/deploy.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/begin/download.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/begin/install.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/begin/start.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/contexts/chapter.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/deploy/chapter.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-extract-war.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-hot-static.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jetty.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jndi.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-override-webxml.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-rules.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-virtual-hosts.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/chapter.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/module-bytebufferpool.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/module-deploy.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/module-http.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/module-https.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/module-server.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/module-ssl.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/module-test-keystore.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/module-threadpool.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/modules/modules.adoc delete mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/configuring-virtual-hosts.adoc delete mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/serving-webapp-from-particular-port.adoc delete mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/anatomy-of-a-webapp.adoc delete mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/automatic-webapp-deployment.adoc delete mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/hot-deployment.adoc delete mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/old_docs/gettingstarted/getting-started/jetty-deploying.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/protocols/chapter.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-http.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-https.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-ssl.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/start/chapter.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/start/start-details.adoc rename jetty-documentation/src/main/asciidoc/operations-guide/{old_docs/startup => start}/start-jar.adoc (99%) create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/xml/chapter.adoc create mode 100644 jetty-documentation/src/main/asciidoc/operations-guide/xml/xml.adoc diff --git a/examples/embedded/src/main/resources/jetty-otherserver.xml b/examples/embedded/src/main/resources/jetty-otherserver.xml deleted file mode 100644 index 2a4c4d361c4..00000000000 --- a/examples/embedded/src/main/resources/jetty-otherserver.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - 8888 - - - - - - - - - - - - - - - /other-webapps - /etc/webdefault.xml - true - - - - - - - - - - diff --git a/jetty-deploy/src/main/config/modules/deploy.mod b/jetty-deploy/src/main/config/modules/deploy.mod index 167005f349e..e570db19208 100644 --- a/jetty-deploy/src/main/config/modules/deploy.mod +++ b/jetty-deploy/src/main/config/modules/deploy.mod @@ -1,7 +1,5 @@ -# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html - [description] -Enables webapplication deployment from the webapps directory. +Enables web application deployment from the $JETTY_BASE/webapps/ directory. [depend] webapp diff --git a/jetty-documentation/pom.xml b/jetty-documentation/pom.xml index 79e417b6cc4..ae003fef1e9 100644 --- a/jetty-documentation/pom.xml +++ b/jetty-documentation/pom.xml @@ -11,23 +11,6 @@ Jetty :: Documentation jar - - yyyy-MM-dd HH:mm - ${project.build.directory}/html/common - ${project.build.directory}/html/common/images - ${project.version} - 1.5.7.1 - 1.5.0-alpha.16 - 1.5.0-alpha.8.1 - 1.5.8.1 - 1.7.27 - 1.2 - ${project.build.directory}/web-resources - - ${project.build.directory}/current - ${project.version} - - org.eclipse.jetty.toolchain @@ -108,69 +91,23 @@ - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack-jetty-web-resouces - generate-resources - - unpack - - - - - org.eclipse.jetty.toolchain - jetty-web-resources - ${web.resources.version} - jar - true - ${web.resources.directory} - - - META-INF/** - - - - - - maven-resources-plugin - - - copy-base-html-assets - generate-resources - - copy-resources - - - - - ${web.resources.directory}/html - - ** - - - - ${html.common.directory} - - - - org.asciidoctor asciidoctor-maven-plugin - ${asciidoctor.maven.plugin.version} org.asciidoctor asciidoctorj-diagram - 2.0.1 + 2.0.2 + html5 + + asciidoctor-diagram + - http://www.eclipse.org/jetty/javadoc/${javadoc.version} + http://www.eclipse.org/jetty/javadoc/${project.version} http://download.eclipse.org/jetty/stable-9/xref ${basedir}/.. https://github.com/eclipse/jetty.project/tree/master @@ -192,8 +129,6 @@ process-asciidoc - html5 - ${web.resources.directory}/asciidoc/slim-template src/main/asciidoc/operations-guide index.adoc ${project.build.directory}/html/operations-guide @@ -206,12 +141,9 @@ process-asciidoc - html5 - ${web.resources.directory}/asciidoc/slim-template ${basedir}/src/main/asciidoc/contribution-guide index.adoc ${project.build.directory}/html/contribution-guide - coderay @@ -221,15 +153,9 @@ process-asciidoc - html5 - ${web.resources.directory}/asciidoc/slim-template ${basedir}/src/main/asciidoc/programming-guide index.adoc ${project.build.directory}/html/programming-guide - coderay - - asciidoctor-diagram - @@ -254,113 +180,4 @@ - - - - alt-formats - - - - org.asciidoctor - asciidoctor-maven-plugin - ${asciidoctor.maven.plugin.version} - - - org.asciidoctor - asciidoctorj-pdf - ${asciidoctorj.pdf.version} - - - org.asciidoctor - asciidoctorj-epub3 - ${asciidoctorj.epub.version} - - - org.jruby - jruby-complete - ${jruby.version} - - - org.asciidoctor - asciidoctorj - ${asciidoctorj.version} - - - - - docbook - - ${project.version} - http://www.eclipse.org/jetty/javadoc/${javadoc.version} - http://download.eclipse.org/jetty/stable-9/xref - ${basedir}/.. - https://github.com/eclipse/jetty.project/tree/master - http://central.maven.org/maven2 - ${project.version} - - - - - contribution-guide-pdf - generate-resources - - process-asciidoc - - - pdf - coderay - - font - - - - - - - ${basedir}/src/main/asciidoc/contribution-guide - index.adoc - ${project.build.directory}/pdf/contribution-guide/contribution-guide.pdf - - - - quickstart-distribution-guide-pdf - generate-resources - - process-asciidoc - - - pdf - coderay - - font - - - - - - - ${basedir}/src/main/asciidoc/quickstart-distribution-guide - index.adoc - ${project.build.directory}/pdf/quickstart-distribution-guide/quickstart-distribution-guide.pdf - - - - contribution-guide-epub - generate-resources - - process-asciidoc - - - epub3 - coderay - ${basedir}/src/main/asciidoc/contribution-guide - index.adoc - ${project.build.directory}/epub/contribution-guide/contribution-guide.epub - - - - - - - - - diff --git a/jetty-documentation/src/main/asciidoc/config.adoc b/jetty-documentation/src/main/asciidoc/config.adoc new file mode 100644 index 00000000000..e780b634f2a --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/config.adoc @@ -0,0 +1,41 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +:author: Jetty Developers +:email: jetty-dev@eclipse.org +:revnumber: {version} +:revdate: {localdate} + +:toc: left +:toclevels: 4 + +:idseparator: - +:sectlinks: +:sectanchors: + +// Use fonts for admonitions. +:icons: font + +// HTML specific directives +ifdef::backend-html5[] +:safe-mode-unsafe: +:linkcss: +endif::[] + +// TODO: remove this attribute once all documentation has been ported. +:sub-order: attributes+ diff --git a/jetty-documentation/src/main/asciidoc/contribution-guide/index.adoc b/jetty-documentation/src/main/asciidoc/contribution-guide/index.adoc index 5543d145f28..d21d2663152 100644 --- a/jetty-documentation/src/main/asciidoc/contribution-guide/index.adoc +++ b/jetty-documentation/src/main/asciidoc/contribution-guide/index.adoc @@ -17,45 +17,11 @@ // :doctitle: Eclipse Jetty: Contribution Guide -:author: Jetty Developers -:email: jetty-dev@eclipse.org -:revnumber: 1.0 -:revdate: {TIMESTAMP} -:toc: left :toc-title: Contribution Guide -:toc-style: - -:header-style: eclipse-thin -:breadcrumb-style: eclipse-thin -:footer-style: default :breadcrumb: Home:../index.html | Contribution Guide:./index.html +:idprefix: cg- -// docinfo lets you pull in shared content and/or influence via render type -//:docinfodir: {DOCINFODIR}/documentation -//:docinfo1: - -// html specific directives -ifdef::backend-html5[] -:safe-mode-unsafe: -:stylesdir: ../common/css -:stylesheet: jetty.css -:linkcss: -:scriptsdir: ../common/js -endif::[] - -// options for special blocks, code snippets, screen, etc -:sub-order: attributes+ - -// uncomment to allow include::https:// style content inclusion -//:allow-uri-read: true - -// use fonts for admonitions -:icons: font - -// suppress automatic id generation -:sectids!: - - +include::../config.adoc[] include::1-introduction.adoc[] include::2-community.adoc[] include::3-source.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/.asciidoctorconfig b/jetty-documentation/src/main/asciidoc/operations-guide/.asciidoctorconfig new file mode 100644 index 00000000000..41b4a711098 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/.asciidoctorconfig @@ -0,0 +1,3 @@ +// Asciidoctor IDE configuration file. +// See https://github.com/asciidoctor/asciidoctor-intellij-plugin/wiki/Support-project-specific-configurations +:JETTY_HOME: ../../../../../../jetty-home/target/jetty-home diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/begin/architecture.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/begin/architecture.adoc new file mode 100644 index 00000000000..52282f579ef --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/begin/architecture.adoc @@ -0,0 +1,81 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-begin-arch]] +==== Eclipse Jetty Architecture Overview + +There are two main concepts on which the Eclipse Jetty standalone server is based: + +* the xref:og-begin-arch-modules[Jetty _module_ system], that provides the Jetty features +* the xref:og-begin-arch-jetty-base[`$JETTY_BASE` directory], that provides a place where you configure the modules, and therefore the features, you need for your web applications + +After installing Jetty, you want to setup a xref:og-begin-arch-jetty-base[`$JETTY_BASE` directory] where you configure xref:og-begin-arch-modules[Jetty modules]. + +[[og-begin-arch-modules]] +===== Eclipse Jetty Architecture: Modules + +The Jetty standalone server is made of xref:pg-arch-bean[components] that are assembled together, configured and started to provide different features. + +A Jetty _module_ is made of one or more components that work together to provide typically one feature, although they may provide more than one feature. + +A Jetty module is nothing more than Jetty components assembled together like you would do using Java APIs, just done in a declarative way using configuration files rather than using Java APIs. +What you can do in Java code to assemble Jetty components, it can be done using Jetty modules. + +A Jetty module may be dependent on other Jetty modules: for example, the `http` Jetty module depends on the `server` Jetty module, that in turn depends on the `threadpool` and `logging` Jetty modules. + +Every feature in a Jetty server is enabled by enabling correspondent Jetty modules. + +For example, if you enable only the `http` Jetty module, then your Jetty standalone server will only be able to listen to a network port for clear-text HTTP requests. +It will not be able to process secure HTTP (i.e. `https`) requests, it will not be able to process WebSocket, or HTTP/2 or any other protocol because the correspondent modules have not been enabled. + +You can even start a Jetty server _without_ listening on a network port -- for example because you have enabled a custom module you wrote that provides the features you need. + +This allows the Jetty standalone server to be as small as necessary: modules that are not enabled are not loaded, don't waste memory, and you don't risk that client use a module that you did not know was even there. + +For more detailed information about the Jetty module system, see xref:og-modules[this section]. + +[[og-begin-arch-jetty-base]] +===== Eclipse Jetty Architecture: `$JETTY_BASE` + +After installing Jetty in `$JETTY_HOME`, you want to create another directory that will be referred to as `$JETTY_BASE`, likely in a different location in the file system from `$JETTY_HOME`. + +The `$JETTY_BASE` directory is where you configure which Jetty modules you want to use and what configuration they have, and it is the base directory where you deploy your web applications. +You do not deploy your web applications in `$JETTY_HOME`, you deploy them in `$JETTY_BASE`. + +You can have just one `$JETTY_HOME` but multiple `$JETTY_HOME` directories, each with its own configuration. + +This separation between `$JETTY_HOME` and `$JETTY_BASE` allows to upgrade Jetty without affecting your web applications. +`$JETTY_HOME` contains the Jetty runtime and libraries and the default configuration, while a `$JETTY_BASE` contains your web applications and any override of the default configuration. + +For example, with the `$JETTY_HOME` installation the default value for the network port for clear-text HTTP is `8080`. +However, you want that port to be `6060`, for example because you are behind a load balancer that is configured to forward to the backend on port `6060`. + +If you had changed the default configuration in `$JETTY_HOME`, when you upgrade Jetty, say from version `10.0.0` to version `10.0.1`, your change will be lost. +You would have to remember all the changes you made to the default configuration, upgrade Jetty (which would overwrite the configuration files with the default values), and made again all the changes, which results in a maintenance nightmare. + +Instead, you want to configure the clear-text HTTP port in your `$JETTY_BASE`. +When you upgrade Jetty, you will upgrade only files in `$JETTY_HOME`, and all the configuration in `$JETTY_BASE` will remain unchanged. + +Installing the Jetty runtime and libraries in `$JETTY_HOME` also allows you to leverage file system permissions: `$JETTY_HOME` may be owned by an administrator user (so that only administrators can upgrade it), while `$JETTY_BASE` directories may be owned by a less privileged user. + +[IMPORTANT] +==== +Install Jetty and never modify the files under `$JETTY_HOME`, unless you are upgrading Jetty itself. + +Do all the rest in `$JETTY_BASE`. +==== diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/begin/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/begin/chapter.adoc new file mode 100644 index 00000000000..fa985c705a3 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/begin/chapter.adoc @@ -0,0 +1,28 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-begin]] +=== Introduction to Eclipse Jetty + +This section will get you started with Eclipse Jetty. + +include::download.adoc[] +include::install.adoc[] +include::architecture.adoc[] +include::start.adoc[] +include::deploy.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/begin/deploy.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/begin/deploy.adoc new file mode 100644 index 00000000000..f19029f99da --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/begin/deploy.adoc @@ -0,0 +1,120 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-begin-deploy]] +==== Deploying Web Applications to Eclipse Jetty + +For the purpose of deploying web applications to Jetty, there are two types of resources that can be deployed: + +* Standard Web Application Archives, in the form of `+*.war+` files or `+*.war+` directories, defined by the Servlet specification. +Their deployment is described in xref:og-begin-deploy-war[this section]. +* Jetty context XML files, that allow you to customize the deployment of standard web applications, and also allow you use Jetty components, and possibly custom components written by you, to assemble your web applications. +Their deployment is described in xref:og-deploy[this section]. + +[[og-begin-deploy-war]] +===== Deploying Standard +*.war+ Web Applications + +A standard Servlet web application is packaged in either a `+*.war+` file or in a directory with the structure of a `+*.war+` file. + +[NOTE] +==== +Recall that the structure of a `+*.war+` file is as follows: + +[source,subs=verbatim] +---- +mywebapp.war +├── index.html <1> +└── WEB-INF <2> + ├── classes/ <3> + ├── lib/ <4> + └── web.xml <5> +---- +<1> Publicly accessible resources such as `+*.html+`, `+*.jsp+`, `+*.css+`, `+*.js+` files, etc. are placed in `+*.war+` or in sub-directories of the `+*.war+`. +<2> `WEB-INF` is a special directory used to store anything related to the web application that must not be publicly accessible, but may be accessed by other resources. +<3> `WEB-INF/classes` stores the web application compiled `+*.class+` files +<4> `WEB-INF/classes` stores the web application `+*.jar+` files +<5> `WEB-INF/web.xml` is the web application deployment descriptor defines the components and the configuration of your web application. +==== + +To deploy a standard web application, you need to enable the `deploy` module (see the `deploy` module complete definition xref:og-module-deploy[here]). + +---- +$ java -jar $JETTY_HOME/start.jar --add-module=deploy +---- +---- +INFO : webapp transitively enabled, ini template available with --add-module=webapp +INFO : security transitively enabled +INFO : servlet transitively enabled +INFO : deploy initialized in ${jetty.base}/start.d/deploy.ini +INFO : mkdir ${jetty.base}/webapps +INFO : Base directory was modified +---- + +The `deploy` module creates the `$JETTY_BASE/webapps` directory, the directory where `+*.war+` files or `+*.war+` directories should be copied so that Jetty can deploy them. + +[NOTE] +==== +The `deploy` module only provides the feature of deploying web applications. + +Whether these web applications are served via clear-text HTTP/1.1, or secure HTTP/1.1, or secure HTTP/2 (or even all of these protocols) depends on whether the correspondent Jetty modules have been enabled. +Refer to the xref:og-protocols[section about protocols] for further information. +==== + +Now you need to copy a web application to the `$JETTY_BASE/webapps` directory: + +---- +curl https://repo1.maven.org/maven2/org/eclipse/jetty/test-jetty-webapp/10.0.0/test-jetty-webapp-10.0.0.war --output $JETTY_BASE/webapps/test.war +---- +// TODO: this webapp requires the login module, need something simpler. +// TODO: replace this with a module, so the download is done by the module. + +The `$JETTY_BASE` directory is now: + +---- +$JETTY_BASE +├── resources +│ └── jetty-logging.properties +├── start.d +│ ├── deploy.ini +│ └── http.ini +└── webapps + └── test.war +---- + +Now start Jetty: + +---- +$ java -jar $JETTY_HOME/start.jar +---- +---- +2020-09-16 09:53:38.182:INFO :oejs.Server:main: jetty-10.0.0-SNAPSHOT; built: 2020-09-16T07:47:47.334Z; git: d45455b32d96f516d39e03b53e91502a34b04f37; jvm 15+36-1562 +2020-09-16 09:53:38.205:INFO :oejdp.ScanningAppProvider:main: Deployment monitor [file:///tmp/jetty.base/webapps/] at interval 1 +2020-09-16 09:53:38.293:WARN :oejshC.test:main: The async-rest webapp is deployed. DO NOT USE IN PRODUCTION! +2020-09-16 09:53:38.298:INFO :oejw.StandardDescriptorProcessor:main: NO JSP Support for /test, did not find org.eclipse.jetty.jsp.JettyJspServlet +2020-09-16 09:53:38.306:INFO :oejss.DefaultSessionIdManager:main: DefaultSessionIdManager workerName=node0 +2020-09-16 09:53:38.306:INFO :oejss.DefaultSessionIdManager:main: No SessionScavenger set, using defaults +2020-09-16 09:53:38.307:INFO :oejss.HouseKeeper:main: node0 Scavenging every 660000ms +2020-09-16 09:53:38.331:INFO :oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@45b4c3a9{Async REST Webservice Example,/test,[file:///tmp/jetty-0_0_0_0-8080-test_war-_test-any-15202033063643714058.dir/webapp/, jar:file:///tmp/jetty-0_0_0_0-8080-test_war-_test-any-15202033063643714058.dir/webapp/WEB-INF/lib/example-async-rest-jar-10.0.0-SNAPSHOT.jar!/META-INF/resources],AVAILABLE}{/tmp/jetty.base/webapps/test.war} +2020-09-16 09:53:38.338:INFO :oejs.AbstractConnector:main: Started ServerConnector@543295b0{HTTP/1.1, (http/1.1)}{0.0.0.0:8080} +2020-09-16 09:53:38.347:INFO :oejs.Server:main: Started Server@5ffead27{STARTING}[10.0.0-SNAPSHOT,sto=5000] @593ms +---- +// TODO: highlight the line that says that it deployed a context + +Now you can access the web application by pointing your browser to `+http://localhost:8080/test+`. + +If you want to customize the deployment of your web application, for example by specifying a `contextPath` different from the file/directory name, or by specifying JNDI entries, or by specifying virtual hosts, etc. read xref:og-deploy[this section]. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/begin/download.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/begin/download.adoc new file mode 100644 index 00000000000..963dd601407 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/begin/download.adoc @@ -0,0 +1,25 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-begin-download]] +==== Downloading Eclipse Jetty + +The Eclipse Jetty distribution is available for download from link:https://www.eclipse.org/jetty/download.html[] + +The Eclipse Jetty distribution is available in both `zip` and `gzip` formats; download the one most appropriate for your system, typically `zip` for Windows and `gzip` for other operative systems. + diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/begin/install.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/begin/install.adoc new file mode 100644 index 00000000000..55a498062f5 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/begin/install.adoc @@ -0,0 +1,35 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-begin-install]] +==== Installing Eclipse Jetty + +After the download, unpacking the Eclipse Jetty distribution will extract the files into a directory called `jetty-distribution-VERSION`, where `VERSION` is the version that you downloaded, for example `10.0.0`, so that the directory is called `jetty-distribution-10.0.0`. + +Unpack the Eclipse Jetty distribution compressed file in a convenient location, for example under `/opt`. + +NOTE: For Windows users, you should unpack Jetty to a path that does not contain spaces. + +The rest of the instructions in this documentation will refer to this location as `$JETTY_HOME`, or `${jetty.home}`. + +IMPORTANT: It is important that *only* stable release versions are used in production environments. +Versions that have been deprecated or are released as Milestones (M), Alpha, Beta or Release Candidates (RC) are *not* suitable for production as they may contain security flaws or incomplete/non-functioning feature sets. + +If you are new to Jetty, read the xref:og-begin-arch[Jetty architecture short section] to become familiar with the terms used in this document. +Otherwise, you can jump to the xref:og-begin-start[start Jetty section]. + diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/begin/start.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/begin/start.adoc new file mode 100644 index 00000000000..ed0f6a6ffff --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/begin/start.adoc @@ -0,0 +1,150 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-begin-start]] +==== Starting Eclipse Jetty + +// TODO: Consider: old_docs/startup/*.adoc + +// So far, what below is the content of old_docs/startup/startup-modules.adoc + +Eclipse Jetty as a standalone server has no graphical user interface, so configuring and running the server is done from the command line. + +Recall from the xref:og-begin-arch[Eclipse Jetty standalone server architecture section] that Jetty is based on xref:og-modules[modules], that provides features, and on xref:og-begin-arch-jetty-base[`$JETTY_BASE`], the place where you configure which module (and therefore which feature) you want to enable, and where you configure module parameters. + +Jetty is started by executing `$JETTY_HOME/start.jar`, but first we need to create a `$JETTY_BASE`: + +---- +$ JETTY_BASE=/path/to/jetty.base +$ cd $JETTY_BASE +$ java -jar $JETTY_HOME/start.jar +---- +---- +ERROR : Nothing to start, exiting ... + +Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs] + java -jar $JETTY_HOME/start.jar --help # for more information +---- + +The error is normal, since the `$JETTY_BASE` you just created is empty and therefore there is no configuration to use to assemble the Jetty server. + +However, it shows that `start.jar` takes parameters, whose details can be found in xref:og-start-jar[this section]. + +You can explore what modules are available out of the box via: + +---- +$ java -jar $JETTY_HOME/start.jar --list-modules=* +---- +// TODO: add output of the --list-modules command? + +Try to enable the `http` module (see also xref:og-protocols-http[this section] for additional information): + +---- +$ java -jar $JETTY_HOME/start.jar --add-module=http +---- +---- +INFO : mkdir ${jetty.base}/start.d +INFO : server transitively enabled, ini template available with --add-module=server +INFO : logging-jetty transitively enabled +INFO : http initialized in ${jetty.base}/start.d/http.ini +INFO : resources transitively enabled +INFO : threadpool transitively enabled, ini template available with --add-module=threadpool +INFO : logging/slf4j dynamic dependency of logging-jetty +INFO : bytebufferpool transitively enabled, ini template available with --add-module=bytebufferpool +INFO : mkdir ${jetty.base}/resources +INFO : copy ${jetty.home}/modules/logging/jetty/resources/jetty-logging.properties to ${jetty.base}/resources/jetty-logging.properties +INFO : Base directory was modified +---- + +Now you can start Jetty: + +---- +$ java -jar $JETTY_HOME/start.jar +---- +[source,subs=quotes] +---- +2020-09-11 15:35:17.451:INFO :oejs.Server:main: jetty-10.0.0-SNAPSHOT; built: 2020-09-10T11:01:33.608Z; git: b10a14ebf9b200da388f4f9a2036bd8117ee0b11; jvm 11.0.8+10 +2020-09-11 15:35:17.485:INFO :oejs.AbstractConnector:main: Started ServerConnector@2d52216b{HTTP/1.1, #(http/1.1)}{0.0.0.0:8080}# +2020-09-11 15:35:17.496:INFO :oejs.Server:main: Started Server@44821a96{STARTING}[10.0.0-SNAPSHOT,sto=5000] @553ms +---- + +Note how Jetty is listening on port `8080` for clear-text HTTP/1.1 connections. + +After having enabled the `http` module, the `$JETTY_BASE` directory looks like this: + +[source,subs=verbatim] +---- +JETTY_BASE +├── resources +│ └── jetty-logging.properties <1> +└── start.d <2> + └── http.ini <3> +---- + +<1> The `resources/jetty-logging.properties` file has been created because the `http` modules depends on the `server` module, which in turn depends on the `logging` module; the `logging` module created this file that can be configured to control the server logging level. +<2> The `start.d/` directory contains the configuration files for the modules. +<3> The `start.d/http.ini` file is the `http` module configuration file, where you can specify values for the `http` module properties. + +In the `http.ini` file you can find the following content (among other content): + +.http.ini +[source,subs=verbatim] +---- +--module=http <1> +# jetty.http.port=8080 <2> +... +---- + +<1> This line enables the `http` module and should not be modified. +<2> This line is commented out and specifies the default value for the module property `jetty.http.port`, which is the network port that listens for clear-text HTTP connections. + +You can change the module property `jetty.http.port` value directly from the command line: + +---- +$ java -jar $JETTY_HOME/start.jar jetty.http.port=9999 +---- + +To make this change persistent, you can edit the `http.ini` file, uncomment the module property `jetty.http.port` and change its value to `9999`: + +.http.ini +---- +--module=http +jetty.http.port=9999 +... +---- + +If you restart Jetty, the new value will be used: + +---- +$ java -jar $JETTY_HOME/start.jar +---- +[source,subs=quotes] +---- +2020-09-11 15:35:17.451:INFO :oejs.Server:main: jetty-10.0.0-SNAPSHOT; built: 2020-09-10T11:01:33.608Z; git: b10a14ebf9b200da388f4f9a2036bd8117ee0b11; jvm 11.0.8+10 +2020-09-11 15:35:17.485:INFO :oejs.AbstractConnector:main: Started ServerConnector@2d52216b{HTTP/1.1, #(http/1.1)}{0.0.0.0:9999}# +2020-09-11 15:35:17.496:INFO :oejs.Server:main: Started Server@44821a96{STARTING}[10.0.0-SNAPSHOT,sto=5000] @553ms +---- + +Note how Jetty is now listening on port `9999` for clear-text HTTP/1.1 connections. + +NOTE: If you want to enable support for different protocols such as secure HTTP/1.1 or HTTP/2, or configured Jetty behind a load balancer, read xref:og-protocols[this section]. + +The Jetty server is now up and running, but it has no web applications deployed, so it just replies with `404 Not Found` to every request. +It is time to xref:og-begin-deploy[deploy your web applications] to Jetty. + +For more detailed information about the Jetty start system, you can read the xref:og-start-details[Jetty start system] section. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/contexts/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/contexts/chapter.adoc new file mode 100644 index 00000000000..edc144f3bb3 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/contexts/chapter.adoc @@ -0,0 +1,23 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-contexts]] +=== Configuring Jetty Context XML Files + +TODO +// TODO: add here from old_docs/contexts and old_docs/extras diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/chapter.adoc new file mode 100644 index 00000000000..9db2aaa30a2 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/chapter.adoc @@ -0,0 +1,44 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-deploy]] +=== Customizing Web Application Deployment + +Most of the times you want to be able to customize the deployment of your web applications, for example by changing the `contextPath`, or by adding JNDI entries, or by configuring virtual hosts, etc. + +The customization is performed by the xref:og-module-deploy[`deploy` module] by processing xref:og-deploy-jetty[Jetty context XML files]. + +The `deploy` module contains the `DeploymentManager` component that scans the `$JETTY_BASE/webapps` directory for changes, following the deployment rules described in xref:og-deploy-rules[this section]. + +include::deploy-hot-static.adoc[] +include::deploy-rules.adoc[] +include::deploy-jetty.adoc[] +include::deploy-jndi.adoc[] +include::deploy-virtual-hosts.adoc[] +include::deploy-extract-war.adoc[] +include::deploy-override-webxml.adoc[] + +// TODO: move this section to its own file +// TODO: configuring from the Jetty context XML file happens before web.xml +// What about jetty-web.xml? Can this be specified externally, e.g. WebAppContext.setJettyWebXml() ? +[[og-deploy-init-params]] +==== Configuring ``init-param``s + +TODO + +// TODO: see old_docs/deploying diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-extract-war.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-extract-war.adoc new file mode 100644 index 00000000000..c6d575836e8 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-extract-war.adoc @@ -0,0 +1,39 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-deploy-extract-war]] +==== Configuring `+*.war+` File Extraction + +By default, `+*.war+` files are uncompressed and its content extracted in a temporary directory. +// TODO: reference the `work` module and how it works, perhaps in a section about the `deploy` module? +The web application resources are served by Jetty from the files extracted in the temporary directory, not from the files within the `+*.war+` file, for performance reasons. + +If you do not want Jetty to extract the `+*.war+` files, you can disable this feature, for example: + +.mywebapp.xml +[source,xml,highlight=8] +---- + + + + + /mywebapp + /opt/webapps/mywebapp.war + false + +---- diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-hot-static.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-hot-static.adoc new file mode 100644 index 00000000000..3db17ea73b2 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-hot-static.adoc @@ -0,0 +1,43 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-deploy-hot-static]] +==== Hot vs Static Deployment + +The `DeploymentManager` scans the `$JETTY_BASE/webapps` directory for changes every `N` seconds, where `N` is configured via the `jetty.deploy.scanInterval` property. + +By default, the scan interval is `1` second, which means that _hot_ deployment is enabled: if a file is added/changed/removed from the `$JETTY_BASE/webapps` directory, the `DeploymentManager` will notice the change and respectively deploy/redeploy/undeploy the web application. + +Setting the scan interval to `0` means that _static_ deployment is enabled, and the `DeploymentManager` will not scan the `$JETTY_BASE/webapps` directory for changes. +This means that to deploy/redeploy/undeploy a web application you will need to stop and restart Jetty. + +The following command line disables _hot_ deployment by specifying the `jetty.deploy.scanInterval` property on the command line, and therefore only for this particular run: + +---- +$ java -jar $JETTY_HOME/start.jar jetty.deploy.scanInterval=0 +---- + +To make _static_ deployment persistent, you need to edit the `deploy` module configuration file, `$JETTY_BASE/start.d/deploy.ini`, uncomment the module property `jetty.deploy.scanInterval` and change its value to `0`: + +.deploy.ini +[source,subs=quotes] +---- +--module=deploy +#jetty.deploy.scanInterval=0# +... +---- diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jetty.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jetty.adoc new file mode 100644 index 00000000000..0e2249b2080 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jetty.adoc @@ -0,0 +1,80 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-deploy-jetty]] +==== Deploying Jetty Context XML Files + +A Jetty context XML file is a xref:og-xml[Jetty XML file] that allows you to customize the deployment of web applications. + +NOTE: Recall that the `DeploymentManager` component of the Jetty `deploy` module xref:og-deploy-rules[gives priority] to Jetty context XML files over `+*.war+` files or directories. + +To deploy a web application using a Jetty context XML file, simply place the file in the `$JETTY_BASE/webapps` directory. + +A simple Jetty context XML file, for example named `wiki.xml` is the following: + +.wiki.xml +[source,xml,subs=verbatim] +---- + + + + <1> + /wiki <2> + /opt/myapps/myapp.war <3> + +---- +<1> Configures a link:{JDURL}/org/eclipse/jetty/webapp/WebAppContext.html[`WebAppContext`], which is the Jetty component that represents a standard Servlet web application. +<2> Specifies the web application `contextPath`, which may be different from the `+*.war+` file name. +<3> Specifies the file system path of the `+*.war+` file. + +The `$JETTY_BASE` directory would look like this: + +---- +$JETTY_BASE +├── resources +│ └── jetty-logging.properties +├── start.d +│ ├── deploy.ini +│ └── http.ini +└── webapps + └── wiki.xml +---- + +TIP: The `+*.war+` file may be placed anywhere in the file system and does not need to be placed in the `$JETTY_BASE/webapps` directory. + +IMPORTANT: If you place both the Jetty context XML file _and_ the `+*.war+` file in the `$JETTY_BASE/webapps` directory, remember that they must have the same file name, for example `wiki.xml` and `wiki.war`, so that the `DeploymentManager` deploys the web application only once using the Jetty context XML file (and not the `+*.war+` file). + +You can use the features of xref:og-xml[Jetty XML files] to avoid to hard-code file system paths or other configurations in your Jetty context XML files, for example by using system properties: + +.wiki.xml +[source,xml] +---- + + + + + /wiki + /myapp.war + +---- + +Note how the `+*.war+` file path is now obtained by resolving the system property `myapps.dir` that you can specify on the command line when you start Jetty: + +---- +$ java -jar $JETTY_HOME/start.jar -Dmyapps.dir=/opt/myapps +---- diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jndi.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jndi.adoc new file mode 100644 index 00000000000..904eaecc172 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jndi.adoc @@ -0,0 +1,56 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-deploy-jndi]] +==== Configuring JNDI Entries + +A web application may _reference_ a JNDI entry, such as a JDBC `DataSource` from the web application `web.xml` file. +The JNDI entry must be _defined_ in the Jetty context XML file, for example: + +.mywebapp.xml +[source,xml,subs=normal] +---- + + + + + /mywebapp + /opt/webapps/mywebapp.war +#   + + jdbc/myds + + + jdbc:mysql://localhost:3306/databasename + user + password + + + # + +---- + +[IMPORTANT] +==== +Class `com.mysql.cj.jdbc.MysqlConnectionPoolDataSource` is present in the MySQL JDBC driver file, `mysql-connector-java-.jar`, which must be available to the web application. + +File `mysql-connector-java-.jar` must be either present in `WEB-INF/lib`, or in the Jetty server class-path. +==== +// TODO: add a link to reference the section about how +// to add a JDBC driver jar to the server classpath. + diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-override-webxml.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-override-webxml.adoc new file mode 100644 index 00000000000..26f7036e2eb --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-override-webxml.adoc @@ -0,0 +1,60 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-deploy-jetty-override-web-xml]] +==== Overriding `web.xml` + +You can configure an additional `web.xml` that complements the `web.xml` file that is present in the web application `+*.war+` file. +This additional `web.xml` is processed _after_ the `+*.war+` file `web.xml`. +This allows you to add host specific configuration or server specific configuration without having to extract the web application `web.xml`, modify it, and repackage it in the `+*.war+` file. + +.mywebapp.xml +[source,xml,highlight=8] +---- + + + + + /mywebapp + /opt/webapps/mywebapp.war + /opt/webapps/mywebapp-web.xml + +---- + +The format of the additional `web.xml` is exactly the same as a standard `web.xml` file, for example: + +.mywebapp-web.xml +[source,xml,linenums,highlight=10-11] +---- + + + + my-servlet + + host + 192.168.0.13 + + + +---- + +In the example above, you configured the `my-servlet` Servlet (defined in the web application `web.xml`), adding a host specific `init-param` with the IP address of the host. + diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-rules.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-rules.adoc new file mode 100644 index 00000000000..f299f846460 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-rules.adoc @@ -0,0 +1,43 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-deploy-rules]] +==== Deployment Rules + +_Adding_ a `+*.war+` file, a `+*.war+` directory, a Jetty context XML file or a normal directory to `$JETTY_BASE/webapps` causes the `DeploymentManager` to deploy the new web application. + +_Updating_ a `+*.war+` file or a Jetty context XML file causes the `DeploymentManager` to redeploy the web application, which means that the Jetty context component representing the web application is stopped, then reconfigured, and then restarted. + +_Removing_ a `+*.war+` file, a `+*.war+` directory, a Jetty context XML file or a normal directory from `$JETTY_BASE/webapps` causes the `DeploymentManager` to undeploy the web application, which means that the Jetty context component representing the web application is stopped and removed from the Jetty server. + +When a file or directory is added to `$JETTY_BASE/webapps`, the `DeploymentManager` derives the web application `contextPath` from the file or directory name, with the following rules: + +* If the directory name is, for example, `mywebapp/`, it is deployed as a standard web application if it contains a `WEB-INF/` subdirectory, otherwise it is deployed as a web application of static content. +The `contextPath` would be `/mywebapp` (that is, the web application is reachable at `+http://localhost:8080/mywebapp/+`). +* If the directory name is `ROOT`, case insensitive, the `contextPath` is `/` (that is, the web application is reachable at `+http://localhost:8080/+`). +* If the directory name ends with `.d`, for example `config.d/`, it is ignored, although it may be referenced to configure other web applications (for example to store common files). +* If the `+*.war+` file name is, for example, `mywebapp.war`, it is deployed as a standard web application with the context path `/mywebapp` (that is, the web application is reachable at `+http://localhost:8080/mywebapp/+`). +* If the file name is `ROOT.war`, case insensitive, the `contextPath` is `/` (that is, the web application is reachable at `+http://localhost:8080/+`). +* If both the `mywebapp.war` file and the `mywebapp/` directory exist, only the file is deployed. +This allows the directory with the same name to be the `+*.war+` file unpack location and avoid that the web application is deployed twice. +* A xref:og-deploy-jetty[Jetty context XML file] named `mywebapp.xml` is deployed as a web application by processing the directives contained in the XML file itself, which must set the `contextPath`. +* If both `mywebapp.xml` and `mywebapp.war` exist, only the XML file is deployed. +This allows the XML file to reference the `+*.war+` file and avoid that the web application is deployed twice. + +// TODO: add section about the work directory from +// old_docs/contexts/temporary-directories.adoc diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-virtual-hosts.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-virtual-hosts.adoc new file mode 100644 index 00000000000..28305dec7a3 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-virtual-hosts.adoc @@ -0,0 +1,191 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-deploy-virtual-hosts]] +==== Configuring Virtual Hosts + +A _virtual host_ is an internet domain name, registered in the Domain Name Server (DNS), for an IP address such that multiple virtual hosts will resolve to the same IP address of a single server instance. + +If you have multiple web applications deployed on the same Jetty server, by using virtual hosts you will be able to target a specific web application. + +For example, you may have a web application for your business and a web application for your hobbies , both deployed in the same Jetty server. +By using virtual hosts, you will be able to have the first web application available at `+http://domain.biz/+`, and the second web application available at `+http://hobby.net/+`. + +Another typical case is when you want to use different subdomains for different web application, for example a project website is at `+http://project.org/+` and the project documentation is at `+http://docs.project.org+`. + +Virtual hosts can be used with any context that is a subclass of link:{JDURL}/org/eclipse/jetty/server/handler/ContextHandler.html[ContextHandler]. + +[[og-deploy-virtual-hosts-names]] +===== Virtual Host Names + +Jetty supports the following variants to be specified as virtual host names: + +`www.hostname.com`:: +A fully qualified domain name. It is important to list all variants as a site may receive traffic for both `www.hostname.com` and `hostname.com`. + +`*.hostname.com`:: +A wildcard domain name which will match only one level of arbitrary subdomains. +*.foo.com will match www.foo.com and m.foo.com, but not www.other.foo.com. + +`10.0.0.2`:: +An IP address may be set as a virtual host to indicate that a web application should handle requests received on the network interface with that IP address for protocols that do not indicate a host name such as HTTP/0.9 or HTTP/1.0. + +`@ConnectorName`:: +A Jetty `ServerConnector` name to indicate that a web application should handle requests received on the `ServerConnector` with that name, and therefore received on a specific IP port. +A `ServerConnector` name can be set via link:{JDURL}/org/eclipse/jetty/server/AbstractConnector.html#setName(java.lang.String)[]. + +`www.√integral.com`:: +Non-ASCII and https://en.wikipedia.org/wiki/Internationalized_domain_name[IDN] domain names can be set as virtual hosts using https://en.wikipedia.org/wiki/Punycode[Puny Code] equivalents that may be obtained from a https://www.punycoder.com/[Punycode/IDN converters]. +For example if the non-ASCII domain name `www.√integral.com` is given to a browser, then the browser will make a request that uses the domain name `www.xn--integral-7g7d.com`, which is the name that should be added as the virtual host name. + +[[og-deploy-virtual-hosts-config]] +===== Virtual Hosts Configuration + +If you have a web application `mywebapp.war` you can configure its virtual hosts in this way: + +[source,xml] +---- + + + + + /mywebapp + /opt/webapps/mywebapp.war + + + mywebapp.com + www.mywebapp.com + mywebapp.net + www.mywebapp.net + + + +---- + +Your web application will be available at: + +* `+http://mywebapp.com/mywebapp+` +* `+http://www.mywebapp.com/mywebapp+` +* `+http://mywebapp.net/mywebapp+` +* `+http://www.mywebapp.net/mywebapp+` + +[NOTE] +==== +You configured the `contextPath` of your web application to `/mywebapp`. + +As such, a request to `+http://mywebapp.com/other+` will not match your web application because the `contextPath` does not match. + +Likewise, a request to `+http://other.com/mywebapp+` will not match your web application because the virtual host does not match. +==== + +[[og-deploy-virtual-hosts-same-context]] +===== Same Context Path, Different Virtual Hosts + +If you want to deploy different web applications to the same context path, typically the root context path `/`, you must use virtual hosts to differentiate among web applications. + +You have `domain.war` that you want to deploy at `+http://domain.biz/+` and `hobby.war` that you want to deploy at `+http://hobby.net+`. + +To achieve this, you simply use the same context path of `/` for each of your webapps, while specifying different virtual hosts for each of your webapps: + +.domain.xml +[source,xml] +---- + + + + + / + /opt/webapps/domain.war + + + domain.biz + + + +---- + +.hobby.xml +[source,xml] +---- + + + + + / + /opt/webapps/hobby.war + + + hobby.net + + + +---- + +[[og-deploy-virtual-hosts-port]] +===== Different Port, Different Web Application + +Sometimes it is required to serve different web applications from different IP ports, and therefore from different ``ServerConnector``s. + +For example, you want requests to `+http://localhost:8080/+` to be served by one web application, but requests to `+http://localhost:9090/+` to be served by another web application. + +This configuration may be useful when Jetty sits behind a load balancer. + +In this case, you want to xref:og-protocols[configure multiple connectors], each with a different name, and then reference the connector name in the web application virtual host configuration: + +.domain.xml +[source,xml,highlight=10] +---- + + + + + / + /opt/webapps/domain.war + + + @port8080 + + + +---- + +.hobby.xml +[source,xml,highlight=10] +---- + + + + + / + /opt/webapps/hobby.war + + + @port9090 + + + +---- + +[NOTE] +==== +Web application `domain.war` has a virtual host of `@port8080`, where `port8080` is the name of a Jetty connector. + +Likewise, web application `hobby.war` has a virtual host of `@port9090`, where `port9090` is the name of another Jetty connector. + +See xref:og-protocols[this section] for further information about how to configure connectors. +==== diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/index.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/index.adoc index aaa6b04376b..70f61e182aa 100644 --- a/jetty-documentation/src/main/asciidoc/operations-guide/index.adoc +++ b/jetty-documentation/src/main/asciidoc/operations-guide/index.adoc @@ -17,48 +17,19 @@ // :doctitle: Eclipse Jetty: Operations Guide -:author: Jetty Developers -:email: jetty-dev@eclipse.org -:revnumber: {version} -:revdate: {TIMESTAMP} -:toc: left :toc-title: Operations Guide -:toc-style: - -:header-style: eclipse-thin -:breadcrumb-style: eclipse-thin -:footer-style: default - :breadcrumb: Home:../index.html | Operations Guide:./index.html +:idprefix: og- -// docinfo lets you pull in shared content and/or influence via render type -//:docinfodir: {DOCINFODIR}/documentation -//:docinfo1: - -// html specific directives -ifdef::backend-html5[] -:safe-mode-unsafe: -:stylesdir: ../common/css -:stylesheet: jetty.css -:linkcss: -:scriptsdir: ../common/js -endif::[] - -// options for special blocks, code snippets, screen, etc -:sub-order: attributes+ - -// uncomment to allow include::https:// style content inclusion -//:allow-uri-read: true - -// use fonts for admonitions -:icons: font - -// suppress automatic id generation -:sectids!: - -// download and install +include::../config.adoc[] +include::.asciidoctorconfig[] include::introduction.adoc[] -// TODO: jetty.home vs jetty.base +include::begin/chapter.adoc[] + +include::start/chapter.adoc[] +include::deploy/chapter.adoc[] +include::protocols/chapter.adoc[] +include::modules/chapter.adoc[] // TODO: how jetty standalone work what start.jar does, command line options, modules, etc. // TODO: this is mostly in old_docs/startup. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/introduction.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/introduction.adoc index 8b24c06414a..0ec193ccec3 100644 --- a/jetty-documentation/src/main/asciidoc/operations-guide/introduction.adoc +++ b/jetty-documentation/src/main/asciidoc/operations-guide/introduction.adoc @@ -16,33 +16,31 @@ // ======================================================================== // -[[og-guide]] +[[og-intro]] == Eclipse Jetty Operations Guide The Eclipse Jetty Operations Guide targets sysops, devops, and developers who want to install Eclipse Jetty as a standalone server to deploy web applications. -[[og-download]] -=== Downloading Eclipse Jetty +=== Eclipse Jetty Introduction -The Eclipse Jetty distribution is available for download from link:https://www.eclipse.org/jetty/download.html[] +If you are new to Eclipse Jetty, read xref:og-begin[here] to download, install, start and deploy web applications to Jetty. -The Eclipse Jetty distribution is available in both `zip` and `gzip` formats; download the one most appropriate for your system, typically `zip` for Windows and `gzip` for other operative systems. +=== Eclipse Jetty Features -[[og-install]] -=== Installing Eclipse Jetty +If you know Jetty already, jump to a feature: -After the download, unpacking the Eclipse Jetty distribution will extract the files into a directory called `jetty-distribution-VERSION`, where `VERSION` is the version that you downloaded, for example `10.0.0`, so that the directory is called `jetty-distribution-10.0.0`. +TODO -Unpack the Eclipse Jetty distribution compressed file in a convenient location, for example under `/opt`. +* Jetty Overview +* Jetty Modules +* Rewrite Modules -The rest of the instructions in this documentation will refer to this location as `$JETTY_HOME`. +=== Eclipse Jetty How-Tos -IMPORTANT: It is important that *only* stable release versions are used in production environments. -Versions that have been deprecated or are released as Milestones (M), Alpha, Beta or Release Candidates (RC) are *not* suitable for production as they may contain security flaws or incomplete/non-functioning feature sets. +* xref:og-protocols-http[Configure Clear-Text HTTP/1.1] +* xref:og-protocols-https[Configure Secure HTTP/1.1 (https)] -[[og-running]] -=== Running Eclipse Jetty +TODO -Eclipse Jetty as a standalone server has no graphical user interface, so configuring and running the server is done from the command line. - -TODO: section about general architecture - modules etc. +* Jetty Behind a Load Balancer +** Forward Header Customizer diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/chapter.adoc new file mode 100644 index 00000000000..fd9c0f22736 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/chapter.adoc @@ -0,0 +1,24 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +include::modules.adoc[] +include::module-bytebufferpool.adoc[] +include::module-deploy.adoc[] +include::module-http.adoc[] +include::module-server.adoc[] +include::module-threadpool.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-bytebufferpool.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-bytebufferpool.adoc new file mode 100644 index 00000000000..2a6a1848c8b --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-bytebufferpool.adoc @@ -0,0 +1,34 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-module-bytebufferpool]] +==== Module `bytebufferpool` + +The `bytebufferpool` module allows you to configure the server-wide `ByteBuffer` pool. + +// TODO: expand + +The module file is `$JETTY_HOME/modules/bytebufferpool.mod`: + +---- +include::{JETTY_HOME}/modules/bytebufferpool.mod[] +---- + +Among the configurable properties, the most relevant are: + +TODO diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-deploy.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-deploy.adoc new file mode 100644 index 00000000000..e913b54674b --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-deploy.adoc @@ -0,0 +1,36 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-module-deploy]] +==== Module `deploy` + +The `deploy` module provides the deployment feature through a `DeploymentManager` component that watches a directory for changes (see xref:og-deploy[how to deploy web applications] for more information). + +Files or directories added in this monitored directory cause the `DeploymentManager` to deploy them as web applications; updating files already existing in this monitored directory cause the `DeploymentManager` to re-deploy the correspondent web application; removing files in this monitored directory cause the `DeploymentManager` to undeploy the correspondent web application (see also xref:og-deploy-rules[here] for more information). + +The module file is `$JETTY_HOME/modules/deploy.mod`: + +---- +include::{JETTY_HOME}/modules/deploy.mod[] +---- + +Among the configurable properties, the most relevant are: + +* `jetty.deploy.monitoredDir`, to change the name of the monitored directory. +* `jetty.deploy.scanInterval`, to change the scan period, that is how frequently the `DeploymentManager` wakes up to scan the monitored directory for changes. +Setting `jetty.deploy.scanInterval=0` disabled _hot_ deployment so that only static deployment will be possible (see also xref:og-deploy-hot-static[here] for more information). diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-http.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-http.adoc new file mode 100644 index 00000000000..7044dac497b --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-http.adoc @@ -0,0 +1,64 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-module-http]] +==== Module `http` + +The `http` module provides support for the clear-text HTTP/1.1 protocol and depends on the xref:og-module-server[`server` module]. + +The module file is `$JETTY_HOME/modules/http.mod`: + +---- +include::{JETTY_HOME}/modules/http.mod[] +---- + +Among the configurable properties, the most relevant are: + +* `jetty.http.port`, default `8080`, is the network port that Jetty listens to for clear-text HTTP/1.1 connections. +* `jetty.http.idleTimeout`, default `30` seconds, is the amount of time a connection can be idle (i.e. no bytes received and no bytes sent) until the server decides to close it to save resources. +* `jetty.http.acceptors`, default -1 (i.e. an accept heuristic decides the value based on the number of cores), is the number of threads that compete to accept connections. +* `jetty.http.selectors`, default -1 (i.e. a select heuristic decides the value based on the number of cores), is the number of NIO selectors (with an associated thread) that manage connections. + +[[og-module-http-acceptors]] +===== Configuration of Acceptors + +Accepting connections is a blocking operation, so a thread is blocked in the `accept()` call until a connection is accepted, and other threads are blocked on the lock acquired just before the `accept()` call. + +When the accepting thread accepts a connection, it performs a little processing of the just accepted connection, before forwarding it to other components. + +During this little processing other connections may be established; if there is only one accepting thread, the newly established connections are waiting for the accepting thread to finish the processing of the previously accepted connection and call again `accept()`. + +Servers that manage a very high number of connections that may (naturally) come and go, or that handle inefficient protocols that open and close connections very frequently (such as HTTP/1.0) may benefit of an increased number of acceptor threads. + +// TODO: expand on acceptors=0 and non-blocking accepts + +[[og-module-http-selectors]] +===== Configuration of Selectors + +Performing a NIO `select()` call is a blocking operation, where the selecting thread is blocked in the `select()` call until at least one connection is ready to be processed for an I/O operation. +There are 4 I/O operations: ready to be accepted, ready to be connected, ready to be read and ready to be written. + +A single NIO selector can manage thousands of connections, with the assumption that not many of them will be ready at the same time. + +For a single NIO selector, the ratio between the average number of selected connections over the total number of connections for every `select()` call depends heavily on the protocol but also on the application. + +Multiplexed protocols such as HTTP/2 tend to be busier than duplex protocols such as HTTP/1.1, leading to a higher ratio. + +REST applications that exchange many little JSON messages tend to be busier than file server applications, leading to a higher ratio. + +The higher the ratio, the higher the number of selectors you want to have, compatibly with the number of cores -- there is no point in having 64 selector threads on a single core hardware. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-https.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-https.adoc new file mode 100644 index 00000000000..e8c14c6f591 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-https.adoc @@ -0,0 +1,28 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-module-https]] +==== Module `https` + +The `https` module provides the HTTP/1.1 protocol to the xref:og-module-ssl[`ssl` module]. + +The module file is `$JETTY_HOME/modules/https.mod`: + +---- +include::{JETTY_HOME}/modules/https.mod[] +---- diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-server.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-server.adoc new file mode 100644 index 00000000000..a4fdcad7c2e --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-server.adoc @@ -0,0 +1,36 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-module-server]] +==== Module `server` + +The `server` module provides generic server support, and configures generic HTTP properties that apply to all HTTP protocols, the scheduler properties and the server specific properties. + +The `server` module depends on the xref:og-module-threadpool[`threadpool` module], the xref:og-module-bytebufferpool[`bytebufferpool` module] and the xref:og-module-logging[`logging` module]. + +The module file is `$JETTY_HOME/modules/server.mod`: + +---- +include::{JETTY_HOME}/modules/server.mod[] +---- + +Among the configurable properties, the most relevant are: + +TODO + +// TODO: consider extracting the httpConfig and scheduler properties into separate files. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-ssl.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-ssl.adoc new file mode 100644 index 00000000000..11b105ec44d --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-ssl.adoc @@ -0,0 +1,32 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-module-ssl]] +==== Module `ssl` + +The `ssl` module provides the secure connector, and allows you to configure the keystore properties and the TLS parameters. + +The module file is `$JETTY_HOME/modules/ssl.mod`: + +---- +include::{JETTY_HOME}/modules/ssl.mod[] +---- + +Among the configurable properties, the most relevant are: + +TODO diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-test-keystore.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-test-keystore.adoc new file mode 100644 index 00000000000..eee9a0a42a0 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-test-keystore.adoc @@ -0,0 +1,31 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-module-test-keystore]] +==== Module `test-keystore` + +The `test-keystore` module provides a keystore containing a self-signed certificate for domain `localhost`. + +The module file is `$JETTY_HOME/modules/test-keystore.mod`: + +---- +include::{JETTY_HOME}/modules/test-keystore.mod[] +---- + +Note how properties `jetty.sslContext.keyStorePath` and `jetty.sslContext.keyStorePassword` are configured, only if not already set (via the `?=` operator), directly in the module file, rather than in a `+*.ini+` file. +This is done to avoid that these properties accidentally overwrite a real keystore configuration. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-threadpool.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-threadpool.adoc new file mode 100644 index 00000000000..4b944b6d2e2 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/module-threadpool.adoc @@ -0,0 +1,34 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-module-threadpool]] +==== Module `threadpool` + +The `threadpool` module allows you to configure the server-wide thread pool. + +// TODO: thread pool per connector should be documented here? + +The module file is `$JETTY_HOME/modules/threadpool.mod`: + +---- +include::{JETTY_HOME}/modules/threadpool.mod[] +---- + +Among the configurable properties, the most relevant are: + +TODO diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/modules/modules.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/modules/modules.adoc new file mode 100644 index 00000000000..c9aa42caa99 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/modules/modules.adoc @@ -0,0 +1,27 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-modules]] +==== Jetty Modules + +TODO +// Consider: +// * old_docs/gettingstarted/configuring/*.adoc +// * old_docs/startup/startup-modules.adoc +// * old_docs/startup/custom-modules.adoc +// diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/chapter.adoc index d171d12fb5d..abe1de08689 100644 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/chapter.adoc +++ b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/chapter.adoc @@ -22,8 +22,6 @@ This chapter discusses various options for configuring Jetty contexts. include::setting-context-path.adoc[] -include::configuring-virtual-hosts.adoc[] include::temporary-directories.adoc[] -include::serving-webapp-from-particular-port.adoc[] include::custom-error-pages.adoc[] include::setting-form-size.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/configuring-virtual-hosts.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/configuring-virtual-hosts.adoc deleted file mode 100644 index 5dca037769d..00000000000 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/configuring-virtual-hosts.adoc +++ /dev/null @@ -1,216 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under -// the terms of the Eclipse Public License 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0 -// -// This Source Code may also be made available under the following -// Secondary Licenses when the conditions for such availability set -// forth in the Eclipse Public License, v. 2.0 are satisfied: -// the Apache License v2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0 -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -[[configuring-virtual-hosts]] -=== Configuring Virtual Hosts - -A virtual host is an alternative name, registered in DNS, for an IP address such that multiple domain names will resolve to the same IP of a shared server instance. -If the content to be served to the aliases names is link:#different-virtual-hosts-different-contexts[different], then a virtual host needs to be configured for each deployed link:{JDURL}/org/eclipse/jetty/server/handler/ContextHandler.html[context] to indicate which names a context will respond to. - -Virtual hosts are set on a link:{JDURL}/org/eclipse/jetty/server/handler/ContextHandler.html[context] by calling the link:{JDURL}/org/eclipse/jetty/server/handler/ContextHandler.html#setVirtualHosts-java.lang.String:A-[`setVirtualHosts`] or link:{JDURL}/org/eclipse/jetty/server/handler/ContextHandler.html#addVirtualHosts-java.lang.String:A-[`addVirtualHost`] method which can be done in several ways: - -* Using a link:#deployable-descriptor-file[context XML] file in the webapps directory (see the example in link:{GITBROWSEURL}/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml[test.xml] in the Jetty distribution). -* Creating a link:#deployment-architecture[custom deployer] with a binding to configure virtual hosts for all contexts found in the same `webapps` directory. -* Calling the link:{JDURL}/org/eclipse/jetty/server/handler/ContextHandler.html#setVirtualHosts-java.lang.String:A-[API] directly on an link:#advanced-embedding[embedded] usage. -* Using a `WEB-INF/jetty-web.xml` file (now deprecated). - -[[configuring-a-virtual-host]] -==== Virtual Host Names - -Jetty supports the following styles of virtual host name: - -www.hostname.com:: - A fully qualified host name. It is important to list all variants as a site may receive traffic from both www.hostname.com and just hostname.com -*.hostname.com:: - A wildcard qualified host which will match only one level of arbitrary names. - *.foo.com will match www.foo.com and m.foo.com, but not www.other.foo.com -10.0.0.2:: - An IP address may be given as a virtual host name to indicate that a context should handle requests received on that server port that do not have a host name specified (HTTP/0.9 or HTTP/1.0). -@ConnectorName:: - A connector name, which is not strictly a virtual host, but instead will only match requests that are received on connectors that have a matching name set with link:{JDURL}/org/eclipse/jetty/server/AbstractConnector.html#setName(java.lang.String)[Connector.setName(String)]. -www.√integral.com:: - Non-ASCII and http://en.wikipedia.org/wiki/Internationalized_domain_name[IDN] domain names can be set as virtual hosts using http://en.wikipedia.org/wiki/Punycode[Puny Code] equivalents that may be obtained from a http://network-tools.com/idn-convert.asp[Punycode/IDN converters]. - For example if the non-ASCII domain name `www.√integral.com` is given to a browser, then it will make a request that uses the domain name `www.xn--integral-7g7d.com`, which is the name that should be added as the virtual host name. - -==== Example Virtual Host Configuration - -Virtual hosts can be used with any context that is a subclass of link:{JDURL}/org/eclipse/jetty/server/handler/ContextHandler.html[ContextHandler]. -Lets look at an example where we configure a web application - represented by the link:{JDURL}/org/eclipse/jetty/webapp/WebAppContext.html[WebAppContext] class - with virtual hosts. -You supply a list of IP addresses and names at which the web application is reachable, such as the following: - -* `333.444.555.666` -* `127.0.0.1` -* `www.blah.com` -* `www.blah.net` -* `www.blah.org` - -Suppose you have a webapp called `blah.war`, that you want all of the above names and addresses to be served at path "`/blah`". -Here's how you would configure the virtual hosts with a link:#deployable-descriptor-file[context XML] file: - -[source, xml, subs="{sub-order}"] ----- - - - - - /blah - blah.war - - - 333.444.555.666 - 127.0.0.1 - www.blah.com - www.blah.net - www.blah.org - - - ----- - -[[different-virtual-hosts-different-contexts]] -==== Using Different Sets of Virtual Hosts to Select Different Contexts - -You can configure different contexts to respond on different virtual hosts by supplying a specific list of virtual hosts for each one. - -For example, suppose your imaginary machine has these DNS names: - -* `www.blah.com` -* `www.blah.net` -* `www.blah.org` -* `www.other.com` -* `www.other.net` -* `www.other.org` - -Suppose also you have 2 webapps, one called `blah.war` that you would like served from the `*.blah.*` names, and one called `other.war` that you want served only from the `*.other.*` names. - -Using the method of preparing link:#deployable-descriptor-file[contextXML] files, one for each webapp yields the following: - -For `blah` webapp: - -[source, xml, subs="{sub-order}"] ----- - - - - - /blah - /blah.war - - - www.blah.com - www.blah.net - www.blah.org - - - ----- - -These URLs now resolve to the blah context (ie `blah.war`): - -* `http://www.blah.com/blah` -* `http://www.blah.net/blah` -* `http://www.blah.org/blah` - -For `other` webapp: - -[source, xml, subs="{sub-order}"] ----- - - - - - /other - /other.war - - - www.other.com - www.other.net - www.other.org - - - ----- - -These URLs now resolve to the other context (i.e. `other.war`): - -* `http://www.other.com/other` -* `http://www.other.net/other` -* `http://www.other.org/other` - -[[different-virtual-hosts-different-context-same-path]] -==== Using Different Sets of Virtual Hosts to Select Different Contexts at the Same Context Path - -In the previous section we setup 2 different contexts to be served from different virtual hosts at _different_ context paths. -However, there is no requirement that the context paths must be distinct: you may use the same context path for multiple contexts, and use virtual hosts to determine which one is served for a given request. - -Consider an example where we have the same set of DNS names as before, and the same webapps `blah.war` and `other.war`. We still want `blah.war` to be served in response to hostnames of `*.blah.*`, and we still want `other.war` to be served in response to `*.other.*` names. -However, we would like__all__ of our clients to use the `"/"` context path, no matter which context is being targeted. - -In other words, we want all of the following URLs to map to `blah.war`: - -* `http://www.blah.com/` -* `http://www.blah.net/` -* `http://www.blah.org/` - -Similarly, we want the following URLs to map to `other.war`: - -* `http://www.other.com/` -* `http://www.other.net/` -* `http://www.other.org/` - -To achieve this, we simply use the same context path of `/` for each of our webapps, while still applying our different set of virtual host names. - -For foo webapp: - -[source, xml, subs="{sub-order}"] ----- - - - - - / - /foo.war - - - www.blah.com - www.blah.net - www.blah.org - - - ----- - -For bar webapp: - -[source, xml, subs="{sub-order}"] ----- - - - - - / - /bar.war - - - www.other.com - www.other.net - www.other.org - - - ----- diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/serving-webapp-from-particular-port.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/serving-webapp-from-particular-port.adoc deleted file mode 100644 index 4c1c353527d..00000000000 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/contexts/serving-webapp-from-particular-port.adoc +++ /dev/null @@ -1,74 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under -// the terms of the Eclipse Public License 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0 -// -// This Source Code may also be made available under the following -// Secondary Licenses when the conditions for such availability set -// forth in the Eclipse Public License, v. 2.0 are satisfied: -// the Apache License v2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0 -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -[[serving-webapp-from-particular-port]] -=== Serving a WebApp from a Particular Port/Connector - -Sometimes it is required to serve different web applications from different ports/connectors. -The simplest way to do this is to create multiple `Server` instances. -However, if contexts need to share resources (eg data sources, authentication), or if the mapping of ports to web applications is not cleanly divided, then the named connector mechanism can be used. - -[[creating-server-instances]] -==== Creating Multiple Server Instances - -Creating multiple server instances is a straight forward process that includes embedding Jetty code by creating multiples instances of the Server class and configuring them as needed. -This is also easy to achieve if you are configuring Jetty servers via XML. -The `id` field in the Configure element of `jetty.xml` files is used to identify the instance that the configuration applies to, so to run two instances of the Server, you can copy the `jetty.xml`, jetty-http.xml and other jetty configuration files used and change the "Server" id to a new name. -This can be done in the same style and layout as the existing `jetty.xml` files or the multiple XML files may be combined to a single file. - -When creating new configurations for alternative server: - -* Change all `id="Server"` to the new server name: - -[source, xml, subs="{sub-order}"] ----- - ----- - -* For all connectors for the new server change the `refid` in the server argument: - -[source, xml, subs="{sub-order}"] ----- - ----- - -* Make sure that any references to properties like `jetty.http.port` are either renamed or replaced with absolute values. -* Make sure that any deployers `AppProviders` refer to a different "webapps" directory so that a different set of applications are deployed. - -[[jetty-otherserver.xml]] -===== Example Other Server XML - -The following example creates another server instance and configures it with a connector and deployer: - -[source, xml, subs="{sub-order}"] ----- -include::{SRCDIR}/examples/embedded/src/main/resources/jetty-otherserver.xml[] ----- - -To run the other server, add the extra configuration file(s) to the command line: - -[source, screen, subs="{sub-order}"] ----- -java -jar start.jar jetty-otherserver.xml ----- - -[[alternative]] -==== Named Connectors - -It is also possible to use an extension to the virtual host mechanism with named to connectors to make some web applications only accessible by specific connectors. -If a connector has a name "MyConnector" set using the `setName` method, then this can be referenced with the special virtual host name "@MyConnector". diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/anatomy-of-a-webapp.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/anatomy-of-a-webapp.adoc deleted file mode 100644 index ed84a54481b..00000000000 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/anatomy-of-a-webapp.adoc +++ /dev/null @@ -1,42 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under -// the terms of the Eclipse Public License 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0 -// -// This Source Code may also be made available under the following -// Secondary Licenses when the conditions for such availability set -// forth in the Eclipse Public License, v. 2.0 are satisfied: -// the Apache License v2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0 -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -[[anatomy-of-a-webapp]] -=== Anatomy of a Web Application - -The standard Jetty distribution is capable of deploying standard Servlet Spec Web Applications and Jetty internal ContextHandler deployment descriptors, or even a mix of the two. - -Web Applications are deployable collections of dynamic (servlets, filters, jsps, etc..) and static content, support libraries, and descriptive metadata that are bound to a specific context path on Jetty. - -Ultimately the format and layout are defined by the Servlet Spec, and the official Servlet Spec documentation should be consulted for a more detailed understanding of Web Application layout and structure; however, this will outline basics about how Jetty views these requirements. - -Web Applications can be bundled into a single Web Archive (WAR file) or as a directory tree. - -`/WEB-INF/`:: - Special Servlet API defined directory used to store anything related to the Web Application that are not part of the public access of the Web Application. - If there is content that is accessed by a Web Application internally, but that should also never be accessed directly by a web browser, this is the directory it would placed in. - -`/WEB-INF/web.xml`:: - *Required* deployment descriptor defining various behavior of the Web Application. - -`/WEB-INF/classes/`:: - Location for Web Application specific compiled java classes -`/WEB-INF/lib/`:: - Directory for JAR files (libraries) - -The Jetty internal `WebAppClassloader` will load classes from `/WEB-INF/classes/` first, then from jar files found in `/WEB-INF/lib/`. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/automatic-webapp-deployment.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/automatic-webapp-deployment.adoc deleted file mode 100644 index ccb00c4a639..00000000000 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/automatic-webapp-deployment.adoc +++ /dev/null @@ -1,42 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under -// the terms of the Eclipse Public License 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0 -// -// This Source Code may also be made available under the following -// Secondary Licenses when the conditions for such availability set -// forth in the Eclipse Public License, v. 2.0 are satisfied: -// the Apache License v2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0 -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -[[automatic-webapp-deployment]] -=== Automatic Web Application Deployment - -The most basic technique for deploying Web Applications is to put a WAR file or Exploded WAR directory into the `${jetty.base}/webapps/` directory and let Jetty's deployment scanner find it and deploy it under a Context path of the same name. - -Only Web Applications that follow the Web Application Layout will be detected by Jetty and deployed this way. - -The Context Path assigned to this automatic deployment is based the filename (or directory name) of the WAR. - -[cols=",",options="header",] -|======================================================================= -|File or Directory Name |Assigned Context Path -|`/webapps/footrope.war` |http://host/footrope/ - -|`/webapps/baggywrinkle-1.0.war` |http://host/baggywrinkle-1.0/ - -|`/webapps/lazaret-2.1.3-SNAPSHOT.war` |http://host/lazaret-2.1.3-SNAPSHOT/ - -|`/webapps/belaying-pins/WEB-INF/web.xml` |http://host/belaying-pins/ - -|`/webapps/root.war` _(reserved name)_ |http://host/ - -|`/webapps/root/WEB-INF/web.xml` _(reserved name)_ |http://host/ -|======================================================================= diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/chapter.adoc index 209727a8430..4220259f9f4 100644 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/chapter.adoc +++ b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/chapter.adoc @@ -23,12 +23,9 @@ This chapter discusses various ways to deploy applications with Jetty. Topics range from deployment bindings to deploying third party products. It also includes information about the Deployment Manager and WebApp Provider. -include::anatomy-of-a-webapp.adoc[] -include::automatic-webapp-deployment.adoc[] include::configuring-specific-webapp-deployment.adoc[] include::deployment-processing-webapps.adoc[] include::static-content-deployment.adoc[] -include::hot-deployment.adoc[] include::deployment-architecture.adoc[] include::quickstart-webapp.adoc[] //include::overlay-deployer.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/hot-deployment.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/hot-deployment.adoc deleted file mode 100644 index 66819bb5175..00000000000 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/deploying/hot-deployment.adoc +++ /dev/null @@ -1,66 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under -// the terms of the Eclipse Public License 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0 -// -// This Source Code may also be made available under the following -// Secondary Licenses when the conditions for such availability set -// forth in the Eclipse Public License, v. 2.0 are satisfied: -// the Apache License v2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0 -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -[[hot-deployment]] -=== Hot Deployment - -Jetty allows for deploying 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, Jetty's `DeploymentManager` (DM) deploys a new context. -If a context descriptor is touched or updated, the DM stops, reconfigures, and redeploys its context. -If a context is removed, the DM stops it and removes it from the server. - -This behavior can be controlled by configuring `WebAppProvider` properties. - -monitoredDirName:: - The directory to scan for possible deployable Web Applications (or Deployment Descriptor XML files). -scanInterval:: - Number of seconds between scans of the provided `monitoredDirName`. - A value of `0` disables the continuous hot deployment scan, Web Applications will be deployed on startup only. - -The default location for this configuration is in the `${jetty.home}/etc/jetty-deploy.xml` file. -To modify it as part of the Jetty distribution, first enable the `deploy` module. -Once it is enabled, you can edit these properties in either the `$JETTY_BASE/start.d/deploy.ini` or `$JETTY_BASE/start.ini` file, depending on link:#start-vs-startd[how your implementation is configured.] - -[source, screen, subs="{sub-order}"] ----- - -# --------------------------------------- -# Module: deploy -# Enables webapplication deployment from the webapps directory. -# --------------------------------------- ---module=deploy - -# Monitored directory name (relative to $jetty.base) -# jetty.deploy.monitoredDir=webapps -# - OR - -# Monitored directory path (fully qualified) -# jetty.deploy.monitoredPath=/var/www/webapps - -# Defaults Descriptor for all deployed webapps -# jetty.deploy.defaultsDescriptorPath=${jetty.base}/etc/webdefault.xml - -# Monitored directory scan period (seconds) -# jetty.deploy.scanInterval=1 - -# Whether to extract *.war files -# jetty.deploy.extractWars=true ----- - -See xref:default-web-app-provider[] for more configuration details. - -See also xref:deployment-architecture[] for detailed conceptual information. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/gettingstarted/getting-started/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/gettingstarted/getting-started/chapter.adoc index 533a91a736b..714fbe884eb 100644 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/gettingstarted/getting-started/chapter.adoc +++ b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/gettingstarted/getting-started/chapter.adoc @@ -25,4 +25,3 @@ This guide covers the latter, a standalone distribution suitable for deploying w include::jetty-installing.adoc[] include::jetty-running.adoc[] include::jetty-common-configuration.adoc[] -include::jetty-deploying.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/gettingstarted/getting-started/jetty-deploying.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/gettingstarted/getting-started/jetty-deploying.adoc deleted file mode 100644 index 0df5d34fe0b..00000000000 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/gettingstarted/getting-started/jetty-deploying.adoc +++ /dev/null @@ -1,72 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. -// -// This program and the accompanying materials are made available under -// the terms of the Eclipse Public License 2.0 which is available at -// https://www.eclipse.org/legal/epl-2.0 -// -// This Source Code may also be made available under the following -// Secondary Licenses when the conditions for such availability set -// forth in the Eclipse Public License, v. 2.0 are satisfied: -// the Apache License v2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0 -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// ======================================================================== -// - -[[quickstart-deploying-webapps]] -=== Deploying Web Applications - -Jetty server instances that configure the deploy module will have a web application deployer that link:#hot-deployment[hot deploys] files found in the `webapps` directory. -Standard WAR files and Jetty configuration files that are placed in the `webapps` directory are hot deployed to the server with the following conventions: - -* A directory called `example/` is deployed as a standard web application if it contains a `WEB-INF/` subdirectory, otherwise it is deployed as context of static content. -The context path is `/example` (that is, `http://localhost:8080/example/`) unless the base name is ROOT (case insensitive), in which case the context path is /. -If the directory name ends with ".d" it is ignored (but may be used by explicit configuration). -* A file called `example.war` is deployed as a standard web application with the context path `/example` (that is, -`http://localhost:8080/example/`). -If the base name is `ROOT` (case insensitive), the context path is `/`. -If `example.war` and `example/` exist, only the WAR is deployed (which may use the directory as an unpack location). -* An XML file like `example.xml` is deployed as a context whose configuration is defined by the XML. -The configuration itself must set the context path. -If `example.xml` and `example.war` exists, only the XML is deployed (which may use the WAR in its configuration). - -If you have a standard web application, you can hot deploy it into Jetty by copying it into the `webapps` directory. - -==== Jetty Demonstration Web Applications - -The demo-base/webapps directory contains the following deployable and auxiliary files: - -`ROOT/`:: - A directory of static content that is deployed to the root context / due to it's name. - Contains the Jetty demo welcome page. -`test.d`:: - A directory containing additional configuration files used by `test.xml` to inject extra configuration into `test.war`. -`test.xml`:: - A context configuration file that configures and deploys `test.war.` - The additional configuration includes the context path as well as setting additional descriptors found in the `test.d` directory. -`test.war`:: - The demonstration web application that is configured and deployed by `test.xml`. -`async-rest.war`:: - A web application demonstration of asynchronous REST to eBay, automatically deployed to /async-rest based on the file name. -`test-jaas.war`:: - A demonstration web application utilizing link:#jaas-support[JAAS] for authentication. -`test-jaas.xml`:: - A context configuration file that configures `test-jaas.war`. - Additional configuration includes setting up the link:#configuring-login-service[LoginService] for authentication and authorization. -`test-jndi.war`:: - A demonstration web application showing the use of link:#jndi[JNDI]. -`test-jndi.xml`:: - A context configuration file that configures `test-jndi.war`. - Additional configuration includes defining objects in the naming space that can be referenced from the webapp. -`test-spec.war`:: - A demonstration web application that shows the use of annotations, fragments, `ServletContainerInitializers` and other Servlet Specification 3.0/3.1 features. -`test-spec.xml`:: - A context configuration file that configures `test-spec.war`. - Additional configuration includes setting up some objects in the naming space that can be referenced by annotations. -`javadoc-proxy.war`:: - A demonstration web application that uses a transparent proxy to serve the Jetty source link:{JDURL}/[Javadoc] from the http://www.eclipse.org/jetty[Eclipse Jetty website]. -`example-moved.xml`:: - A demonstration context configuration file that shows how to use the link:#moved-context-handler[`MovedContextHandler`] to redirect from one path to another. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/protocols/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/protocols/chapter.adoc new file mode 100644 index 00000000000..e1c61b3ff73 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/protocols/chapter.adoc @@ -0,0 +1,43 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-protocols]] +=== Configuring Eclipse Jetty Connectors and Protocols + +Connectors are the network components through which Jetty accepts incoming network connections. + +Each connector listens on a network port and can be configured with `ConnectionFactory` components that _understand_ one or more network protocols. + +Understanding a protocol means that the connector is able to interpret incoming network bytes (for example, the bytes that represent an HTTP/1.1 request) and convert them into more abstract objects (for example an `HttpServletRequest` object) that are then processed by applications. +Conversely, an abstract object (for example an `HttpServletResponse`) is converted into the correspondent outgoing network bytes (the bytes that represent an HTTP/1.1 response). + +Like other Jetty components, connectors are enabled and configured by enabling and configuring the correspondent Jetty module. + +IMPORTANT: Recall that you must always issue the commands to enable Jetty modules from within the `$JETTY_BASE` directory, and that the Jetty module configuration files are in the `$JETTY_BASE/start.d/` directory. + +You can obtain the list of connector-related modules in this way: + +---- +$ java -jar $JETTY_HOME/start.jar --list-modules=connector +---- + +include::protocols-http.adoc[] +include::protocols-https.adoc[] +include::protocols-ssl.adoc[] + +// TODO: old_docs/connectors/*.adoc diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-http.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-http.adoc new file mode 100644 index 00000000000..392141dc059 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-http.adoc @@ -0,0 +1,77 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-protocols-http]] +==== Configuring Clear-Text HTTP/1.1 + +Clear text HTTP/1.1 is enabled with the `http` Jetty module with the following command (issued from within the `$JETTY_BASE` directory): + +---- +$ java -jar $JETTY_HOME/start.jar --add-module=http +---- +---- +INFO : mkdir ${jetty.base}/start.d +INFO : server transitively enabled, ini template available with --add-module=server +INFO : logging-jetty transitively enabled +INFO : http initialized in ${jetty.base}/start.d/http.ini +INFO : resources transitively enabled +INFO : threadpool transitively enabled, ini template available with --add-module=threadpool +INFO : logging/slf4j dynamic dependency of logging-jetty +INFO : bytebufferpool transitively enabled, ini template available with --add-module=bytebufferpool +INFO : mkdir ${jetty.base}/resources +INFO : copy ${jetty.home}/modules/logging/jetty/resources/jetty-logging.properties to ${jetty.base}/resources/jetty-logging.properties +INFO : Base directory was modified +---- + +After having enabled the `http` module, the `$JETTY_BASE` directory looks like this: + +[source,subs=quotes] +---- +JETTY_BASE +├── resources +│ └── jetty-logging.properties +└── start.d + └── #http.ini# +---- + +The `http.ini` file is the file that you want to edit to configure network and protocol parameters -- for more details see xref:og-module-http[this section]. + +Note that the `http` Jetty module depends on the `server` Jetty module. + +Some parameters that you may want to configure are in fact common HTTP parameters that are applied not only for clear-text HTTP/1.1, but also for secure HTTP/1.1 or for clear-text HTTP/2 or for encrypted HTTP/2, and these configuration parameters may be present in the `server` module configuration file. + +You can force the creation of the `server.ini` file via: + +---- +$ java -jar $JETTY_HOME/start.jar --add-module=server +---- + +Now the `$JETTY_BASE` directory looks like this: + +[source,subs=quotes] +---- +JETTY_BASE +├── resources +│ └── jetty-logging.properties +└── start.d + ├── http.ini + └── server.ini +---- + +Now you can edit the `server.ini` file -- for more details see xref:og-module-server[this section]. + diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-https.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-https.adoc new file mode 100644 index 00000000000..56b28aac4b7 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-https.adoc @@ -0,0 +1,102 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-protocols-https]] +==== Configuring Secure HTTP/1.1 + +Secure HTTP/1.1 is enabled with both the `ssl` and `https` Jetty modules with the following command (issued from within the `$JETTY_BASE` directory): + +---- +$ java -jar $JETTY_HOME/start.jar --add-modules=ssl,https +---- +---- +INFO : mkdir ${jetty.base}/start.d +INFO : server transitively enabled, ini template available with --add-module=server +INFO : logging-jetty transitively enabled +INFO : resources transitively enabled +INFO : https initialized in ${jetty.base}/start.d/https.ini +INFO : ssl initialized in ${jetty.base}/start.d/ssl.ini +INFO : threadpool transitively enabled, ini template available with --add-module=threadpool +INFO : logging/slf4j transitive provider of logging/slf4j for logging-jetty +INFO : logging/slf4j dynamic dependency of logging-jetty +INFO : bytebufferpool transitively enabled, ini template available with --add-module=bytebufferpool +INFO : mkdir ${jetty.base}/resources +INFO : copy ${jetty.home}/modules/logging/jetty/resources/jetty-logging.properties to ${jetty.base}/resources/jetty-logging.properties +INFO : Base directory was modified +---- + +The command above enables the `ssl` module, that provides the secure network connector, the keystore configuration and TLS configuration -- for more details see xref:og-protocols-ssl[this section]. +Then, the xref:og-module-https[`https` module] adds HTTP/1.1 as the protocol secured by TLS. + +The `$JETTY_BASE` directory looks like this: + +[source,subs=verbatim] +---- +$JETTY_BASE +├── resources +│ └── jetty-logging.properties +└── start.d + ├── https.ini + └── ssl.ini +---- + +Note that the keystore file is missing, because you have to provide one with the cryptographic material you want (read xref:og-ssl[this section] to create your own keystore). +You need to configure these two properties by editing `ssl.ini`: + +* `jetty.sslContext.keyStorePath` +* `jetty.sslContext.keyStorePassword` + +As a quick example, you can enable the xref:og-module-test-keystore[`test-keystore` module], that provides a keystore containing a self-signed certificate: + +---- +$ java -jar $JETTY_HOME/start.jar --add-modules=ssl,https +---- +---- +INFO : test-keystore initialized in ${jetty.base}/start.d/test-keystore.ini +INFO : mkdir ${jetty.base}/etc +INFO : copy ${jetty.home}/modules/test-keystore/test-keystore.p12 to ${jetty.base}/etc/test-keystore.p12 +INFO : Base directory was modified +---- + +The `$JETTY_BASE` directory is now: + +---- +├── etc +│ └── #test-keystore.p12# +├── resources +│ └── jetty-logging.properties +└── start.d + ├── https.ini + ├── ssl.ini + └── test-keystore.ini +---- + +Starting Jetty yields: + +---- +$ java -jar $JETTY_HOME/start.jar +---- +[source,subs=quotes] +---- +2020-09-22 08:40:49.482:INFO :oejs.Server:main: jetty-10.0.0-SNAPSHOT; built: 2020-09-21T14:44:05.094Z; git: 5c33f526e5b7426dd9644ece61b10184841bb8fa; jvm 15+36-1562 +2020-09-22 08:40:49.709:INFO :oejus.SslContextFactory:main: x509=X509@14cd1699(mykey,h=[localhost],w=[]) for Server@73a1e9a9[provider=null,keyStore=file:///tmp/jetty.base/etc/test-keystore.p12,trustStore=file:///tmp/jetty.base/etc/test-keystore.p12] +2020-09-22 08:40:49.816:INFO :oejs.AbstractConnector:main: Started ServerConnector@2e1d27ba##{SSL, (ssl, http/1.1)}{0.0.0.0:8443}## +2020-09-22 08:40:49.828:INFO :oejs.Server:main: Started Server@2f177a4b{STARTING}[10.0.0-SNAPSHOT,sto=5000] @814ms +---- + +Note how Jetty is listening on port `8443` for the secure HTTP/1.1 protocol. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-ssl.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-ssl.adoc new file mode 100644 index 00000000000..8c9ac79a430 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/protocols/protocols-ssl.adoc @@ -0,0 +1,48 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-protocols-ssl]] +==== Configuring Secure Protocols + +Secure protocols are normal protocols such as HTTP/1.1 or WebSocket that are wrapped by the link:https://en.wikipedia.org/wiki/Transport_Layer_Security[TLS protocol]. +Any network protocol can be wrapped with TLS. + +The `https` scheme used in URIs really means `tls+http/1.1` and similarly the `wss` scheme used in URIs really means `tls+websocket`, etc. +Senders wrap the underlying protocol bytes (e.g. HTTP/1.1 bytes or WebSocket bytes) with the TLS protocol, while receivers first interpret the TLS protocol to obtain the underlying protocol bytes, and then interpret the wrapped bytes. + +Secure protocols have a slightly more complicated configuration since they require to configure a _keystore_. + +A keystore is a file on the file system that contains a private key and a public certificate, along with the certificate chain of the certificate authorities that issued the certificate. +The private key, the public certificate and the certificate chain, but more generally the items present in a keystore, are typically referred to as "cryptographic material". + +Keystores may encode the cryptographic material with different encodings, the most common being link:https://en.wikipedia.org/wiki/PKCS_12[PKCS12], and are typically protected by a password. + +After configuring the keystore path and keystore password, you may want to further customize the parameters of the TLS protocol, such as the minimum TLS protocol version, or the TLS algorithms, etc. + +The Jetty `ssl` module allows you to configure the keystore and the TLS parameters; if other modules require encryption, they declare a dependency on the `ssl` module. + +Since the `ssl` module is only about encryption, it does not configure a connector listening on a network port because it does not know what is the wrapped protocol. +It is the job of other Jetty modules to configure the wrapped protocol. + +For example, it is the xref:og-protocols-https[`https` module] that configures the listening network port for secure HTTP/1.1. +The `https` module depends on the `ssl` module to allow the configuration of keystore and TLS, and adds HTTP/1.1 as the protocol wrapped by TLS. + +Recall from the xref:og-modules[section about modules], that only modules that are explicitly enabled get their module configuration file (`+*.ini+`) saved in `$JETTY_BASE/start.d/`, and you want `$JETTY_BASE/start.d/ssl.ini` to be present so that you can configure the keystore and TLS properties. + +// TODO: section about client authentication with certificates? +// See readme_keystores.txt about the fact that the server keystore needs the CA=true extension. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/start/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/start/chapter.adoc new file mode 100644 index 00000000000..1a23d5fccb0 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/start/chapter.adoc @@ -0,0 +1,20 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +include::start-details.adoc[] +include::start-jar.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/start/start-details.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/start/start-details.adoc new file mode 100644 index 00000000000..330c358aa26 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/start/start-details.adoc @@ -0,0 +1,25 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-start-details]] +=== Starting Eclipse Jetty: Details + +// TODO: how start.jar builds a classpath, etc. +// how command line overrides base, that overrides home +// how you can start Jetty on-the-fly without modules or ini files +// etc. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/startup/start-jar.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/start/start-jar.adoc similarity index 99% rename from jetty-documentation/src/main/asciidoc/operations-guide/old_docs/startup/start-jar.adoc rename to jetty-documentation/src/main/asciidoc/operations-guide/start/start-jar.adoc index 1532c100cd9..20aea344c34 100644 --- a/jetty-documentation/src/main/asciidoc/operations-guide/old_docs/startup/start-jar.adoc +++ b/jetty-documentation/src/main/asciidoc/operations-guide/start/start-jar.adoc @@ -16,9 +16,11 @@ // ======================================================================== // -[[start-jar]] +[[og-start-jar]] === Using start.jar +TODO: review in light of Jetty 10 + The most basic way of starting the Jetty standalone server is to execute the `start.jar`, which is a bootstrap for starting Jetty with the configuration you want. [source, screen, subs="{sub-order}"] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/xml/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/xml/chapter.adoc new file mode 100644 index 00000000000..270c7c973ed --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/xml/chapter.adoc @@ -0,0 +1,19 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +include::xml.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/xml/xml.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/xml/xml.adoc new file mode 100644 index 00000000000..d52e6ff56e8 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/operations-guide/xml/xml.adoc @@ -0,0 +1,24 @@ +// +// ======================================================================== +// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others. +// +// This program and the accompanying materials are made available under +// the terms of the Eclipse Public License 2.0 which is available at +// https://www.eclipse.org/legal/epl-2.0 +// +// This Source Code may also be made available under the following +// Secondary Licenses when the conditions for such availability set +// forth in the Eclipse Public License, v. 2.0 are satisfied: +// the Apache License v2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// ======================================================================== +// + +[[og-xml]] +=== Jetty XML + +TODO + +// TODO: port the documentation from old_docs/jetty-xml/*.adoc diff --git a/jetty-documentation/src/main/asciidoc/programming-guide/index.adoc b/jetty-documentation/src/main/asciidoc/programming-guide/index.adoc index ba48a8bad20..cc1f98ba3fe 100644 --- a/jetty-documentation/src/main/asciidoc/programming-guide/index.adoc +++ b/jetty-documentation/src/main/asciidoc/programming-guide/index.adoc @@ -17,45 +17,11 @@ // :doctitle: Eclipse Jetty: Programming Guide -:author: Jetty Developers -:email: jetty-dev@eclipse.org -:revnumber: {version} -:revdate: {TIMESTAMP} -:toc: left :toc-title: Programming Guide -:toc-style: - -:header-style: eclipse-thin -:breadcrumb-style: eclipse-thin -:footer-style: default - :breadcrumb: Home:../index.html | Programming Guide:./index.html +:idprefix: pg- -// docinfo lets you pull in shared content and/or influence via render type -//:docinfodir: {DOCINFODIR}/documentation -//:docinfo1: - -// html specific directives -ifdef::backend-html5[] -:safe-mode-unsafe: -:stylesdir: ../common/css -:stylesheet: jetty.css -:linkcss: -:scriptsdir: ../common/js -endif::[] - -// options for special blocks, code snippets, screen, etc -:sub-order: attributes+ - -// uncomment to allow include::https:// style content inclusion -//:allow-uri-read: true - -// use fonts for admonitions -:icons: font - -// suppress automatic id generation -:sectids!: - +include::../config.adoc[] include::.asciidoctorconfig[] include::introduction.adoc[] include::client/client.adoc[] diff --git a/jetty-server/src/main/config/modules/https.mod b/jetty-server/src/main/config/modules/https.mod index 53b4d6330d5..23cd62fac5f 100644 --- a/jetty-server/src/main/config/modules/https.mod +++ b/jetty-server/src/main/config/modules/https.mod @@ -13,6 +13,7 @@ ssl ssl [optional] +alpn http2 http-forwarded diff --git a/jetty-server/src/main/config/modules/ssl.mod b/jetty-server/src/main/config/modules/ssl.mod index 6ef55a216e6..e7564770cbe 100644 --- a/jetty-server/src/main/config/modules/ssl.mod +++ b/jetty-server/src/main/config/modules/ssl.mod @@ -59,9 +59,6 @@ etc/jetty-ssl-context.xml ## Connect Timeout in milliseconds # jetty.ssl.connectTimeout=15000 -## Whether SNI is required for all secure connections. Rejections are in TLS handshakes. -# jetty.sslContext.sniRequired=false - ## Whether SNI is required for all secure connections. Rejections are in HTTP 400 response. # jetty.ssl.sniRequired=false @@ -78,6 +75,9 @@ etc/jetty-ssl-context.xml ## Note that OBF passwords are not secure, just protected from casual observation ## See http://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html +## Whether SNI is required for all secure connections. Rejections are in TLS handshakes. +# jetty.sslContext.sniRequired=false + ## The Endpoint Identification Algorithm ## Same as javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String) #jetty.sslContext.endpointIdentificationAlgorithm= @@ -86,10 +86,10 @@ etc/jetty-ssl-context.xml # jetty.sslContext.provider= ## Keystore file path (relative to $jetty.base) -# jetty.sslContext.keyStorePath=etc/keystore +# jetty.sslContext.keyStorePath=etc/keystore.p12 ## Truststore file path (relative to $jetty.base) -# jetty.sslContext.trustStorePath=etc/keystore +# jetty.sslContext.trustStorePath=etc/keystore.p12 ## Keystore password # jetty.sslContext.keyStorePassword= diff --git a/pom.xml b/pom.xml index d58eef2468e..71d311726a6 100644 --- a/pom.xml +++ b/pom.xml @@ -734,7 +734,7 @@ org.asciidoctor asciidoctor-maven-plugin - 1.5.6 + 2.1.0 org.codehaus.mojo