Marian Harbach | ebeb154 | 2019-12-13 10:42:46 +0100 | [diff] [blame] | 1 | :linkattrs: |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 2 | = Gerrit Code Review - J2EE Installation |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 3 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 4 | == Description |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 5 | |
| 6 | Gerrit binary distributions include a standalone Jetty servlet |
| 7 | container, but are packaged as a standard WAR file to permit easy |
| 8 | deployment to other existing container installations if using the |
| 9 | standalone daemon is not desired. |
| 10 | |
| 11 | Gerrit Code Review can be installed into any J2EE servlet container, |
| 12 | including popular open source containers such as Jetty or Tomcat, or |
Edwin Kempin | f1acbb8 | 2011-09-15 12:49:42 +0200 | [diff] [blame] | 13 | any commercial server which supports the J2EE servlet specification. |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 14 | |
| 15 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 16 | == Installation |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 17 | |
Edwin Kempin | 36c04a6 | 2018-12-10 14:13:56 +0100 | [diff] [blame] | 18 | * Complete the link:install.html#init[site initialization] task |
| 19 | described in the standard installation documentation. |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 20 | |
David Pursehouse | 9246356 | 2013-06-24 10:16:28 +0900 | [diff] [blame] | 21 | * Stop the embedded daemon that was automatically started by 'init': |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 22 | + |
| 23 | ---- |
| 24 | review_site/bin/gerrit.sh stop |
| 25 | ---- |
| 26 | |
Sasa Zivkov | 3b61df3 | 2013-02-05 17:28:40 +0100 | [diff] [blame] | 27 | * Deploy the 'gerrit.war' file to your application server. |
| 28 | + |
| 29 | The deployment process differs between servers, but typically this |
| 30 | can be accomplished by copying 'gerrit.war' into the 'webapps/' |
| 31 | subdirectory of the container's installation. |
| 32 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 33 | * ('Optional') Install Bouncy Castle Crypto API |
| 34 | + |
| 35 | If you enabled Bouncy Castle Crypto during 'init', copy the JAR |
| 36 | from `'$site_path'/lib` into your servlet container's extensions |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 37 | directory so it's available to Gerrit Code Review. |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 38 | |
Sasa Zivkov | e5fc90e | 2013-05-10 15:12:13 +0200 | [diff] [blame] | 39 | * ('Optional') link:config-auto-site-initialization.html[ |
| 40 | Configure Automatic Site Initialization on Startup] |
| 41 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 42 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 43 | == Jetty 7.x |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 44 | These directions will configure Gerrit as the default web |
| 45 | application, allowing URLs like `http://example.com/4543` to jump |
| 46 | directly to change 4543. |
| 47 | |
| 48 | Download and unzip a release version of Jetty. From here on we |
| 49 | call the unpacked directory `$JETTY_HOME`. |
| 50 | |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 51 | * link:http://www.eclipse.org/jetty/downloads.php[Jetty Downloads,role=external,window=_blank] |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 52 | |
| 53 | If this is a fresh installation of Jetty, move into the installation |
| 54 | directory and do some cleanup to remove the sample webapps: |
| 55 | ---- |
| 56 | cd $JETTY_HOME |
| 57 | rm -rf contexts/* webapps/* |
| 58 | ---- |
| 59 | |
| 60 | Copy Gerrit Code Review into the deployment: |
| 61 | ---- |
| 62 | cp ~/gerrit.war webapps/gerrit.war |
| 63 | java -jar webapps/gerrit.war cat extra/jetty7/gerrit.xml >contexts/gerrit.xml |
| 64 | ---- |
| 65 | |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 66 | Edit `'$JETTY_HOME'/contexts/gerrit.xml` to correctly configure |
Edwin Kempin | 36c04a6 | 2018-12-10 14:13:56 +0100 | [diff] [blame] | 67 | outgoing SMTP connections. |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 68 | |
| 69 | If OpenID authentication (or certain enterprise single-sign-on |
| 70 | solutions) is being used, you may need to increase the |
| 71 | header buffer size parameter, due to very long header lines |
| 72 | being used by the OpenID authentication handshake process. |
| 73 | Add the following to `'$JETTY_HOME'/etc/jetty.xml` under |
| 74 | `org.eclipse.jetty.server.nio.SelectChannelConnector`: |
| 75 | |
| 76 | ---- |
| 77 | <Set name="headerBufferSize">16384</Set> |
| 78 | ---- |
| 79 | |
| 80 | To start automatically when the system boots, create a start |
| 81 | script and modify it for your configuration: |
| 82 | |
| 83 | ---- |
Kyle Laker | 839edfc | 2013-03-08 01:05:10 -0500 | [diff] [blame] | 84 | java -jar webapps/gerrit.war --cat extra/jetty7/gerrit-jetty.sh >/etc/init.d/gerrit-jetty |
| 85 | vi /etc/init.d/gerrit-jetty |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 86 | ---- |
| 87 | |
| 88 | [TIP] |
David Ostrovsky | 3329529 | 2016-03-15 12:17:35 +0100 | [diff] [blame] | 89 | Under Jetty, restarting the web application is as simple as |
| 90 | touching the context config file: `'$JETTY_HOME'/contexts/gerrit.xml` |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 91 | |
David Pursehouse | 7eaea57 | 2014-10-21 11:02:29 +0900 | [diff] [blame] | 92 | [[tomcat]] |
David Ostrovsky | d0c9a7b | 2014-04-27 11:27:50 +0200 | [diff] [blame] | 93 | == Tomcat 7.x |
| 94 | |
David Pursehouse | 7eaea57 | 2014-10-21 11:02:29 +0900 | [diff] [blame] | 95 | If a reverse proxy is used in front of Tomcat then see the |
| 96 | link:config-reverseproxy.html[configuration instructions for encoding |
| 97 | slashes]. Otherwise Tomcat must be configured to encode slashes, by adding |
| 98 | `-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true` to the |
| 99 | `CATALINA_OPTS` environment variable. |
| 100 | |
| 101 | Excerpt from the |
| 102 | link:https://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html[ |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 103 | documentation,role=external,window=_blank]: |
David Ostrovsky | d0c9a7b | 2014-04-27 11:27:50 +0200 | [diff] [blame] | 104 | |
| 105 | ---- |
| 106 | Property org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH: |
| 107 | If this is true '%2F' and '%5C' will be permitted as path delimiters. |
| 108 | If not specified, the default value of false will be used. |
| 109 | ---- |
Shawn O. Pearce | 9ad8ba5 | 2009-12-11 19:06:21 -0800 | [diff] [blame] | 110 | |
| 111 | GERRIT |
| 112 | ------ |
| 113 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 114 | |
| 115 | SEARCHBOX |
| 116 | --------- |