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