Merge branch 'stable-2.13'

* stable-2.13:
  Prevent circular module dependency when running in external container
  Update Documentation of Auto Site Initialization

Change-Id: Ibcbaf7e7b5af58dca5c9b32d068acb81d1fd9781
This commit is contained in:
David Pursehouse 2017-03-01 11:16:17 +09:00
commit 7e5e551c8c
2 changed files with 12 additions and 33 deletions

View File

@ -27,18 +27,10 @@ If the `gerrit.site_path` system property is defined then the init is
run for that site. The database connectivity, in that case, is defined
in the `etc/gerrit.config`.
If `gerrit.site_path` is not defined then Gerrit will try to find an
existing site by looking into the `system_config` table in the database
defined via the `jdbc/ReviewDb` JNDI property. If the `system_config`
table exists then the `site_path` from that table is used for the
initialization. The database connectivity is defined by the
`jdbc/ReviewDb` JNDI property.
Finally, if neither the `gerrit.site_path` property nor the
`system_config` table exists, the `gerrit.init_path` system property,
if defined, will be used to determine the site path. The database
connectivity, also for this case, is defined by the `jdbc/ReviewDb`
JNDI property.
If `gerrit.site_path` is not defined then Gerrit will try to find the
`gerrit.init_path` system property. If defined this property will be
used to determine the site path. The database connectivity, also for
this case, is defined by the `jdbc/ReviewDb` JNDI property.
[WARNING]
Defining the `jdbc/ReviewDb` JNDI property for an H2 database under the
@ -70,18 +62,6 @@ database is defined in `etc/gerrit.config` of that site:
=== Example 2
Prepare Tomcat so that an existing site with the path defined in the
`system_config` table is initialized (upgraded) on Gerrit startup. The
assumption is that the `jdbc/ReviewDb` JNDI property is defined in
Tomcat:
----
$ export CATALINA_OPTS='-Dgerrit.init'
$ catalina.sh start
----
=== Example 3
Assuming the database schema doesn't exist in the database defined
via the `jdbc/ReviewDb` JNDI property, initialize a new site using that
database and a given path:

View File

@ -272,15 +272,7 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
listener().to(ReviewDbDataSourceProvider.class);
}
});
}
modules.add(new DatabaseModule());
modules.add(new DropWizardMetricMaker.ApiModule());
return Guice.createInjector(PRODUCTION, modules);
}
private Injector createCfgInjector() {
final List<Module> modules = new ArrayList<>();
if (sitePath == null) {
// If we didn't get the site path from the system property
// we need to get it from the database, as that's our old
// method of locating the site path on disk.
@ -297,8 +289,15 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
});
modules.add(new GerritServerConfigModule());
}
modules.add(new SchemaModule());
modules.add(new DatabaseModule());
modules.add(new ConfigNotesMigration.Module());
modules.add(new DropWizardMetricMaker.ApiModule());
return Guice.createInjector(PRODUCTION, modules);
}
private Injector createCfgInjector() {
final List<Module> modules = new ArrayList<>();
modules.add(new SchemaModule());
modules.add(SchemaVersionCheck.module());
modules.add(new AuthConfigModule());
return dbInjector.createChildInjector(modules);