tykeal / puppet-gerrit

Puppet module to manage Gerrit
6 stars 7 forks source link

H2 not always created #15

Closed ltutar closed 8 years ago

ltutar commented 8 years ago

I could get Gerrit working with the following yaml:


---
gerrit::gerrit_version: '2.11.5'
gerrit::install_default_plugins: false
gerrit::install_git: false
gerrit::install_gitweb: false
gerrit::install_java: false
gerrit::manage_database: false 
gerrit::manage_firewall: false
gerrit::override_options:
  container:
    user: 'gerrit'
    javaHome: '/usr/java/default'
  httpd:
    listenUrl: 'http://*:7070/'

I destroyed my vagrant image and recreated it again, but gerrit.config is now missing

[database]
    type = h2
    database = db/ReviewDB

This results now in the following error:

2015-12-11 14:55:07,207] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.NullPointerException
    at com.google.gerrit.pgm.util.SiteProgram.createDbInjector(SiteProgram.java:138)
    at com.google.gerrit.pgm.Daemon.start(Daemon.java:276)
    at com.google.gerrit.pgm.Daemon.run(Daemon.java:205)
    at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
    at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
    at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
    at Main.main(Main.java:25)

which is logical since the DB is missing.

Any ideas?

tykeal commented 8 years ago

You must specify a database section in to your override_options. This module does not default to an H2 database because it is intended for production use systems only where you would start hating yourself the moment you started seeing any sort of noticeable load if you're using H2.

All the manage_db flag is supposed to do is export a database setup for either mysql (working fine) or postgres (not currently operational) and it does that dependent on the database detected in your database section. But in any case, the module does not work correctly if you don't specify one. I suppose there should be a check to make sure that there is always one specified in the override_options

ltutar commented 8 years ago

Thank you for your explanation. We will also use mysql later. I am now trying to learn ins and out of it. Weird that it did work earlier.

tykeal commented 8 years ago

As an FYI if you configure the database section in the override_options with the H2 options the module should do the right thing in generating the database on a clean setup. It's just not going to do that for you without you having to explicitly set it ;)

ltutar commented 8 years ago

It works like a charm. For the other possible future users, I am pasting the yaml

---
gerrit::gerrit_version: '2.11.5'
gerrit::install_default_plugins: false
gerrit::install_git: false
gerrit::install_gitweb: false
gerrit::install_java: false
gerrit::manage_database: false 
gerrit::manage_firewall: false
gerrit::override_options:
  container:
    user: 'gerrit'
    javaHome: '/usr/java/default'
  httpd:
    listenUrl: 'http://*:7070/'
  database:
    type: 'h2'
    database: 'db/ReviewDB'