blob: 1be0af961add099bc9fd7cdc1a0e3ba6ec834014 [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
David Ostrovsky33295292016-03-15 12:17:35 +010030`gerrit.site_path` system property must be defined to run the init for
31that site.
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020032
Saša Živkove90d6e82014-02-18 12:56:24 +010033[WARNING]
34Defining the `jdbc/ReviewDb` JNDI property for an H2 database under the
David Ostrovsky33295292016-03-15 12:17:35 +010035path defined by `gerrit.site_path` will cause an incomplete auto
36initialization and Gerrit will fail to start.
37
David Pursehousec19163c2017-01-23 06:15:17 +000038Opening a connection to such a database will create a subfolder under the
Saša Živkove90d6e82014-02-18 12:56:24 +010039site path folder (in order to create the H2 database) and Gerrit will
David Pursehousec19163c2017-01-23 06:15:17 +000040no longer consider that site path to be new and, because of that,
Saša Živkove90d6e82014-02-18 12:56:24 +010041skip some required initialization steps (for example, Lucene index
42creation). In order to auto initialize Gerrit with an embedded H2
43database use the `gerrit.site_path` to define the location of the review
44site and don't define a JNDI resource with a URL under that path.
45
David Pursehousec19163c2017-01-23 06:15:17 +000046If the `gerrit.install_plugins` property is not defined then all packaged
Saša Živkov9f058b32014-02-13 16:10:38 +010047plugins will be installed. If it is defined then it is parsed as a
David Pursehousec19163c2017-01-23 06:15:17 +000048comma-separated list of plugin names to install. If the value is an
Saša Živkov9f058b32014-02-13 16:10:38 +010049empty string then no plugin will be installed.
50
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080051=== Example 1
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020052
53Prepare Tomcat so that a site is initialized at a given path using
54the H2 database (if the site doesn't exist yet) or using whatever
55database is defined in `etc/gerrit.config` of that site:
56
57----
58 $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.site_path=/path/to/site'
59 $ catalina.sh start
60----
61
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080062=== Example 2
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020063
Sasa Zivkove5fc90e2013-05-10 15:12:13 +020064Assuming the database schema doesn't exist in the database defined
65via the `jdbc/ReviewDb` JNDI property, initialize a new site using that
66database and a given path:
67
68----
69 $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.init_path=/path/to/site'
70 $ catalina.sh start
71----
72
73GERRIT
74------
75Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -070076
77SEARCHBOX
78---------