diff options
author | Shawn O. Pearce <sop@google.com> | 2009-10-01 19:19:49 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-10-01 19:19:49 -0700 |
commit | db9f9a046f57deae46e41a43ae5e9fca4314e331 (patch) | |
tree | 4ae755eea3ce898a5621e977e6b25d53b426ba4a | |
parent | 1481fd67238185cdc44619a624a928a106d4087f (diff) |
Add scripts for Jetty 7.x and make that the default in the docs
Jetty 7.x is the future of the Jetty project, along with its new
home at the Eclipse Foundation. Point to that, and use updated
configuration files in our WAR.
Since 7.x is still in release candidate stage, we'll keep the
older 6.x configuration files around for now.
Change-Id: I03d47c8b33c4862960a7f095cfd73b8ab0d65864
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | Documentation/install.txt | 26 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/extra/jetty7/gerrit-jetty.sh | 21 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/extra/jetty7/gerrit.xml | 64 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/extra/jetty7/jetty_sslproxy.xml | 38 |
4 files changed, 137 insertions, 12 deletions
diff --git a/Documentation/install.txt b/Documentation/install.txt index acc9b25cdd..af114472a5 100644 --- a/Documentation/install.txt +++ b/Documentation/install.txt @@ -225,10 +225,10 @@ jump directly to change 4543. Download and unzip a release version of Jetty. From here on we call the unpacked directory `$JETTY_HOME`. -* link:http://dist.codehaus.org/jetty/[Jetty Downloads] +* link:http://www.eclipse.org/jetty/downloads.php[Jetty Downloads] Install the required JDBC drivers by copying them into the -`'$JETTY_HOME'/lib/plus` directory. Drivers can be obtained from +`'$JETTY_HOME'/lib/ext` directory. Drivers can be obtained from their source projects: * link:http://jdbc.postgresql.org/download.html[PostgreSQL JDBC Driver] @@ -236,7 +236,7 @@ their source projects: * link:http://commons.apache.org/dbcp/download_dbcp.cgi[Commons DBCP] Consider installing Bouncy Castle Cypto APIs into the -`'$JETTY_HOME'/lib/plus` directory. Some of the Bouncy Castle +`'$JETTY_HOME'/lib/ext` directory. Some of the Bouncy Castle implementations are faster than then ones that come in the JRE, and they may support additional encryption algorithms: @@ -244,20 +244,21 @@ and they may support additional encryption algorithms: Copy Gerrit into the deployment: ==== - java -jar gerrit.war --cat extra/jetty6/gerrit.xml >$JETTY_HOME/contexts/gerrit.xml - cp gerrit.war $JETTY_HOME/webapps/gerrit.war - - rm -f $JETTY_HOME/contexts/test.xml + cd $JETTY_HOME + cp ~/gerrit.war webapps/gerrit.war + java -jar webapps/gerrit.war --cat extra/jetty7/gerrit.xml >contexts/gerrit.xml + rm -f contexts/test.xml ==== Edit `'$JETTY_HOME'/contexts/gerrit.xml` to correctly configure the database and outgoing SMTP connections, especially the user and password fields. -If OpenID authentication is being used, you may need to increase -the header buffer size parameter, due to very long header lines. +If OpenID authentication (or certain enterprise single-sign-on +solutions) is being used, you may need to increase the +header buffer size parameter, due to very long header lines. Add the following to `'$JETTY_HOME'/etc/jetty.xml` under -`org.mortbay.jetty.nio.SelectChannelConnector`: +`org.eclipse.jetty.server.nio.SelectChannelConnector`: ==== <Set name="headerBufferSize">16384</Set> @@ -267,7 +268,7 @@ To start automatically when the system boots, create a start script and modify it for your configuration: ==== - java -jar gerrit.war --cat extra/jetty6/gerrit-jetty.sh >/etc/init.d/gerrit-jetty.sh + java -jar gerrit.war --cat extra/jetty7/gerrit-jetty.sh >/etc/init.d/gerrit-jetty.sh vi /etc/init.d/gerrit-jetty.sh ==== @@ -289,7 +290,8 @@ Port 443 (HTTPS / SSL) To deploy on port 443 with SSL enabled, unpack the SSL proxy handling rule into `'$JETTY_HOME'/etc`: ==== - java -jar gerrit.war --cat extra/jetty6/jetty_sslproxy.xml >$JETTY_HOME/etc/jetty_sslproxy.xml + cd $JETTY_HOME + java -jar webapps/gerrit.war --cat extra/jetty7/jetty_sslproxy.xml >etc/jetty_sslproxy.xml ==== Create a start script like the one above, configuring Jetty to diff --git a/src/main/webapp/WEB-INF/extra/jetty7/gerrit-jetty.sh b/src/main/webapp/WEB-INF/extra/jetty7/gerrit-jetty.sh new file mode 100644 index 0000000000..1342d804e4 --- /dev/null +++ b/src/main/webapp/WEB-INF/extra/jetty7/gerrit-jetty.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +export JETTY_HOST=127.0.0.1 +export JETTY_PORT=8081 +export JETTY_USER=gerrit2 +export JETTY_PID=/var/run/jetty$JETTY_PORT.pid +export JETTY_HOME=/home/$JETTY_USER/jetty +export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.07/jre + +JAVA_OPTIONS="" +JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.host=$JETTY_HOST" +export JAVA_OPTIONS + +JETTY_ARGS="" +JETTY_ARGS="$JETTY_ARGS OPTIONS=Server,plus,ext,rewrite" +export JETTY_ARGS + +C="jetty-logging jetty" +[ -f "$JETTY_HOME/etc/jetty_sslproxy.xml" ] && C="$C jetty_sslproxy" + +exec $JETTY_HOME/bin/jetty.sh "$@" $C diff --git a/src/main/webapp/WEB-INF/extra/jetty7/gerrit.xml b/src/main/webapp/WEB-INF/extra/jetty7/gerrit.xml new file mode 100644 index 0000000000..56b7af0a0f --- /dev/null +++ b/src/main/webapp/WEB-INF/extra/jetty7/gerrit.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.eclipse.org/configure.dtd"> +<!-- + + Jetty configuration to place "gerrit.war" into the root context, + so it answers to simple URLs like "/$changeid" and "/mine". + + * Copy this file to $JETTY_HOME/contexts/gerrit.xml + * Edit url, username, password as necessary below for database. + + * Copy commons-dbcp-*.jar to $JETTY_HOME/lib/ext/ + * Copy commons-pool-*.jar to $JETTY_HOME/lib/ext/ + * Copy JDBC driver to $JETTY_HOME/lib/ext/ + * Copy www/gerrit-*.war to $JETTY_HOME/webapps/gerrit.war + + * Make sure you remove $JETTY_HOME/context/test.xml + +--> +<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext"> + <Set name="contextPath">/</Set> + <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/gerrit.war</Set> + + <Set name="extractWAR">true</Set> + <Set name="copyWebDir">true</Set> + <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set> + + <Set name="ConfigurationClasses"> + <Array type="java.lang.String"> + <Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item> + <Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item> + <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item> + <Item>org.eclipse.jetty.plus.webapp.Configuration</Item> + <Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item> + </Array> + </Set> + + <New id="ReviewDb" class="org.eclipse.jetty.plus.jndi.Resource"> + <Arg></Arg> + <Arg>jdbc/ReviewDb</Arg> + <Arg> + <New class="org.apache.commons.dbcp.BasicDataSource"> +<!-- PostgreSQL + <Set name="driverClassName">org.postgresql.Driver</Set> + <Set name="url">jdbc:postgresql:reviewdb</Set> + <Set name="username">gerrit2</Set> + <Set name="password">secretkey</Set> +--> +<!-- MySQL + <Set name="driverClassName">com.mysql.jdbc.Driver</Set> + <Set name="url">jdbc:mysql://localhost/reviewdb?user=gerrit2&password=secretkey</Set> +--> +<!-- H2 + <Set name="driverClassName">org.h2.Driver</Set> + <Set name="url">jdbc:h2:file:ReviewDb</Set> +--> + <Set name="initialSize">4</Set> + <Set name="maxActive">8</Set> + <Set name="minIdle">4</Set> + <Set name="maxIdle">4</Set> + <Set name="maxWait">30000</Set> + </New> + </Arg> + </New> +</Configure> diff --git a/src/main/webapp/WEB-INF/extra/jetty7/jetty_sslproxy.xml b/src/main/webapp/WEB-INF/extra/jetty7/jetty_sslproxy.xml new file mode 100644 index 0000000000..652acadeb9 --- /dev/null +++ b/src/main/webapp/WEB-INF/extra/jetty7/jetty_sslproxy.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.eclipse.org/configure.dtd"> +<!-- + + Jetty configuration to correctly handle SSL/HTTPS traffic when + Apache is handling the SSL and proxying over plain HTTP to us. + + Requires Jetty 7.0.0.RC6 (or later). + + * Copy this file to $JETTY_HOME/etc/jetty_sslproxy.xml + * Add jetty_sslproxy to your start line: + + $JETTY_HOME/bin/jetty.sh start jetty-logging jetty jetty_sslproxy + + * Configure Apache to set X-Forwarded-Scheme on requests: + + RequestHeader set X-Forwarded-Scheme https + +--> +<Configure id="Server" class="org.eclipse.jetty.server.Server"> + <Get id="oldHandler" name="handler"/> + <Set name="handler"> + <New class="org.eclipse.jetty.rewrite.handler.RewriteHandler"> + <Set name="handler"><Ref id="oldHandler"/></Set> + <Set name="rules"> + <Array type="org.eclipse.jetty.rewrite.handler.Rule"> + <Item> + <New class="org.eclipse.jetty.rewrite.handler.ForwardedSchemeHeaderRule"> + <Set name="header">X-Forwarded-Scheme</Set> + <Set name="headerValue">https</Set> + <Set name="scheme">https</Set> + </New> + </Item> + </Array> + </Set> + </New> + </Set> +</Configure> |