blob: acd03c9c0c84b2ebbaa5ad87c2f6036cceca9313 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Automatic Site Initialization on Startup
Sasa Zivkove5fc90e2013-05-10 15:12:13 +02002
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003== Description
Sasa Zivkove5fc90e2013-05-10 15:12:13 +02004
5Gerrit supports automatic site initialization on server startup
6when Gerrit runs in a servlet container. Both creation of a new site
Saša Živkov9f058b32014-02-13 16:10:38 +01007and upgrade of an existing site are supported. By default, all packaged
8plugins will be installed when Gerrit is deployed in a servlet container
9and the location of the Gerrit distribution can be determined at
10runtime. It is also possible to install only a subset of packaged
David Pursehousec19163c2017-01-23 06:15:17 +000011plugins or not install any plugins.
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020012
13This feature may be useful for such setups where Gerrit administrators
14don't have direct access to the database and the file system of the
15server where Gerrit should be deployed and, therefore, cannot perform
16the init from their local machine prior to deploying Gerrit on such a
17server. It may also make deployment and testing in a local servlet
David Pursehousec19163c2017-01-23 06:15:17 +000018container faster to set up as the init step could be skipped.
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020019
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080020== Gerrit Configuration
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020021
22The site initialization will be performed only if the `gerrit.init`
David Pursehousec19163c2017-01-23 06:15:17 +000023system property exists. The value of the property is not used; only the
24existence of the property matters.
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020025
26If the `gerrit.site_path` system property is defined then the init is
27run for that site. The database connectivity, in that case, is defined
28in the `etc/gerrit.config`.
29
Reyad Attiyatee594102017-02-28 08:55:06 -060030If `gerrit.site_path` is not defined then Gerrit will try to find the
31`gerrit.init_path` system property. If defined this property will be
32used to determine the site path. The database connectivity, also for
33this case, is defined by the `jdbc/ReviewDb` JNDI property.
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020034
Saša Živkove90d6e82014-02-18 12:56:24 +010035[WARNING]
36Defining the `jdbc/ReviewDb` JNDI property for an H2 database under the
37path defined by either `gerrit.site_path` or `gerrit.init_path` will
38cause an incomplete auto initialization and Gerrit will fail to start.
David Pursehousec19163c2017-01-23 06:15:17 +000039Opening a connection to such a database will create a subfolder under the
Saša Živkove90d6e82014-02-18 12:56:24 +010040site path folder (in order to create the H2 database) and Gerrit will
David Pursehousec19163c2017-01-23 06:15:17 +000041no longer consider that site path to be new and, because of that,
Saša Živkove90d6e82014-02-18 12:56:24 +010042skip some required initialization steps (for example, Lucene index
43creation). In order to auto initialize Gerrit with an embedded H2
44database use the `gerrit.site_path` to define the location of the review
45site and don't define a JNDI resource with a URL under that path.
46
David Pursehousec19163c2017-01-23 06:15:17 +000047If the `gerrit.install_plugins` property is not defined then all packaged
Saša Živkov9f058b32014-02-13 16:10:38 +010048plugins will be installed. If it is defined then it is parsed as a
David Pursehousec19163c2017-01-23 06:15:17 +000049comma-separated list of plugin names to install. If the value is an
Saša Živkov9f058b32014-02-13 16:10:38 +010050empty string then no plugin will be installed.
51
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080052=== Example 1
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020053
54Prepare Tomcat so that a site is initialized at a given path using
55the H2 database (if the site doesn't exist yet) or using whatever
56database is defined in `etc/gerrit.config` of that site:
57
58----
59 $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.site_path=/path/to/site'
60 $ catalina.sh start
61----
62
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080063=== Example 2
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020064
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020065Assuming the database schema doesn't exist in the database defined
66via the `jdbc/ReviewDb` JNDI property, initialize a new site using that
67database and a given path:
68
69----
70 $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.init_path=/path/to/site'
71 $ catalina.sh start
72----
73
74GERRIT
75------
76Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -070077
78SEARCHBOX
79---------