blob: f7252e0961cee893169f6e3b4a07a48d6e860eb8 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - J2EE Installation
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -08002
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003== Description
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -08004
5Gerrit binary distributions include a standalone Jetty servlet
6container, but are packaged as a standard WAR file to permit easy
7deployment to other existing container installations if using the
8standalone daemon is not desired.
9
10Gerrit Code Review can be installed into any J2EE servlet container,
11including popular open source containers such as Jetty or Tomcat, or
Edwin Kempinf1acbb82011-09-15 12:49:42 +020012any commercial server which supports the J2EE servlet specification.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080013
14
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080015== Installation
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080016
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 Pursehouse92463562013-06-24 10:16:28 +090021* Stop the embedded daemon that was automatically started by 'init':
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080022+
23----
24 review_site/bin/gerrit.sh stop
25----
26
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080027* Configure JNDI DataSource 'jdbc/ReviewDb'.
28+
29This DataSource must point to the database you created above.
30Don't forget to ensure your JNDI configuration can load the
31necessary JDBC drivers. You may wish to ensure connection pooling
32is configured and enabled within the DataSource.
33
Sasa Zivkov3b61df32013-02-05 17:28:40 +010034* Deploy the 'gerrit.war' file to your application server.
35+
36The deployment process differs between servers, but typically this
37can be accomplished by copying 'gerrit.war' into the 'webapps/'
38subdirectory of the container's installation.
39
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080040* ('Optional') Install Bouncy Castle Crypto API
41+
42If you enabled Bouncy Castle Crypto during 'init', copy the JAR
43from `'$site_path'/lib` into your servlet container's extensions
David Pursehouse221d4f62012-06-08 17:38:08 +090044directory so it's available to Gerrit Code Review.
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080045
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020046* ('Optional') link:config-auto-site-initialization.html[
47Configure Automatic Site Initialization on Startup]
48
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080049
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080050== Jetty 7.x
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -080051These directions will configure Gerrit as the default web
52application, allowing URLs like `http://example.com/4543` to jump
53directly to change 4543.
54
55Download and unzip a release version of Jetty. From here on we
56call the unpacked directory `$JETTY_HOME`.
57
58* link:http://www.eclipse.org/jetty/downloads.php[Jetty Downloads]
59
60If this is a fresh installation of Jetty, move into the installation
61directory and do some cleanup to remove the sample webapps:
62----
63 cd $JETTY_HOME
64 rm -rf contexts/* webapps/*
65----
66
67Copy 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
73Install 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. Pearce0b43ad12010-04-12 08:10:42 -070079 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. Pearce9ad8ba52009-12-11 19:06:21 -080081 java -jar webapps/gerrit.war cat lib/postgresql-8.4-701.jdbc4.jar >lib/ext/postgresql-8.4-701.jdbc4.jar
82----
83
84Edit `'$JETTY_HOME'/contexts/gerrit.xml` to correctly configure
85the database and outgoing SMTP connections, especially the user
86and password fields.
87
88If OpenID authentication (or certain enterprise single-sign-on
89solutions) is being used, you may need to increase the
90header buffer size parameter, due to very long header lines
91being used by the OpenID authentication handshake process.
92Add 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
99To start automatically when the system boots, create a start
100script and modify it for your configuration:
101
102----
Kyle Laker839edfc2013-03-08 01:05:10 -0500103 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. Pearce9ad8ba52009-12-11 19:06:21 -0800105----
106
107[TIP]
108Under 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 Pursehouse7eaea572014-10-21 11:02:29 +0900112[[tomcat]]
David Ostrovskyd0c9a7b2014-04-27 11:27:50 +0200113== Tomcat 7.x
114
David Pursehouse7eaea572014-10-21 11:02:29 +0900115If a reverse proxy is used in front of Tomcat then see the
116link:config-reverseproxy.html[configuration instructions for encoding
117slashes]. 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
121Excerpt from the
122link:https://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html[
123documentation]:
David Ostrovskyd0c9a7b2014-04-27 11:27:50 +0200124
125----
126Property org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH:
127If this is true '%2F' and '%5C' will be permitted as path delimiters.
128If not specified, the default value of false will be used.
129----
Shawn O. Pearce9ad8ba52009-12-11 19:06:21 -0800130
131GERRIT
132------
133Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700134
135SEARCHBOX
136---------