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