sbadia / puppet-gitlab

Puppet module for manage GitLab installation
http://forge.puppetlabs.com/sbadia/gitlab
GNU General Public License v3.0
131 stars 77 forks source link

Don't wipe the database out during installation #180

Open njm506 opened 10 years ago

njm506 commented 10 years ago

I've begun testing this module across a couple of VMs. On setting up the second VM (with a bit of test data in the database), I've found that the database gets reinitialized, wiping out the data.

This is due to Exec['setup gitlab database'] looking at a local file to determine whether the database needs "setting up".

For such a dangerous operation, one might speculate that this functionality should be separate from the main install process (either as a separate class or by setting a parameter).

brianvans commented 9 years ago

+1

StrangeWill commented 9 years ago

+1, funny enough I seem to be missing the local file for whatever reason, and without a sane check it's eating my database on every puppet run...

becosta commented 9 years ago

Same issue here with postgresql backend, my database is wiped out on every run.

StrangeWill commented 9 years ago

@becosta Logged issue #215, thought it was me doing something dumb (had a failure during install due to a missing Redis server) during my first run but did a fresh clean install and still had that issue.

cyberkov commented 9 years ago

+1

sbadia commented 9 years ago

Hi, I'm not able to reproduce the issue (with debian or centos) https://paste.debian.net/plainh/f09ad8ae

toepi commented 9 years ago

Hi @sbadia, this issue is related to #215 which was fixed with pull request #217. But I think this issue is not close because the discussion about a flag?

I think you should include a boolean which say yes create (wipeout) database if needed (no .done-file) or never do it. I think about create databases incl. schema with something like cpitman/database_schema - so gitlab must not do it again? Or a mutlinode cluster - which currently mean ever member recreate the database.

njm506 commented 9 years ago

Yes, to clarify, the original issue was with regards to setting up multiple front-ends which share the same database and filestore (for clustering). Building an additional node wipes the database as the new node doesn't have the local file to say the database has been initialized.

I was expecting it would come down to a new parameter to determine whether the code should ever try to wipe the db, rather than relying on a local file. I haven't retested this recently.

toepi commented 9 years ago

stupid question: It is possible to check if a database has a schema/tables? I know Oracle has some views for this - mysql show tables but postgres? So it is possible to replace file which this check?

joshuaspence commented 9 years ago

+1 on this... I currently have this ugly hack in place to safeguard against this:

  exec { 'prevent setup gitlab database':
    command => "touch /home/git/.gitlab_setup_done",
    before  => Exec['setup gitlab database'],
    require => User['git'],
  }