Change lockfile path to <installdir>/tmp, or specify full path in config/gitlab.yml
Created by: foglcz
Hi all! First of all, gitlab is awesome. However, I've ran across a problem when using multiple gitlabs installations on single unix server, when those installations both have different usernames/groups. Using apache /w passenger.
== My use case: == install first client:
- install gitolite into /var/git/first, install gitlab into /var/www/test.com/first (will run under first.test.com)
- chown first:first-gitlab /var/git/first -R
- chown first-gitlab:first-gitlab /var/www/test.com/first -R
- usermod apache -a -G first-gitlab
install second client:
- install gitolite into /var/git/second, install gitlab into /var/www/test.com/second (will run under second.test.com)
- chown second:second-gitlab /var/git/second -R
- chown second-gitlab:second-gitlab /var/www/test.com/second -R
- usermod apache -a -G second-gitlab
Then create project in first.test.com -- everything works. Then try to create project in second.test.com -- the app cannot gain access to gitolite system.
== Reason: == Whichever application has been first activated (eg. created a project), has created /tmp/gitlabhq-gitolite.lock file. That file is owned by first-gitlab user & group. Hence, the second application (which has different access rights) cannot access that lockfile. This applies to all subsequent installations as well.
== Temporary solution == I've solved the issue on my server by manually editing lib/gitlab/gitolite.rb (eg. /var/www/test.com/first/lib/gitlab/gitolite.rb ) on line 37, manually changing the filename of the lockfile, so that individual installations will use individual lockfiles.
== Proposed solution == As i'm not a ruby developer, I might have overlooked something. If so, I'm sorry for that.
I would propose to use installation tmp folder - not the global tmp folder. All gitlabs properly created tmp/cache inside of the installation dir (= /var/www/test.com/first/tmp/cache) for assets, however the locking mechanism is using global system tmp (= /tmp) folder.
Second solution would be to manually specify the full path to the lockfile, in config/githost.yml file.
(note for the multihost setup i am using -- every gitolite's installation is using different username; hence first is using git://[email protected] and second is using git://[email protected] etc.)