[IMPROVEMENT] Do not hardcode /home/git to Gitlab, make it configurable
Created by: hron84
While I trying to install GitLab into our environment, we met with a problem GitLab hardly assumes it would be configured as 'git' user and /home/git directory, but in our case this username and home directory already occupied by something other and we wouldn't change it.
But anyways, hardcoding something is usually bad, Ruby provides many-many ways to calculate correct directories based on the actual path of the file, or query the home directory of the running user. There is no big advantage to use hardcoded absolute paths than relative or dynamic ones but causes problems if these paths are occupied by something other stuff.
Concrete examples:
# config/unicorn.rb
# Help ensure your application will always spawn in the symlinked
# "current" directory that Capistrano sets up.
working_directory "/home/git/gitlab" # available in 0.94.0+
# Listen on both a Unix domain socket and a TCP port.
# If you are load-balancing multiple Unicorn masters, lower the backlog
# setting to e.g. 64 for faster failover.
listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 1024
listen "127.0.0.1:8080", :tcp_nopush => true
# feel free to point this anywhere accessible on the filesystem
pid "/home/git/gitlab/tmp/pids/unicorn.pid"
These variables should use relative paths, or the internal %{working_directory}
globbing.
But GitLab also cannot detect running user automatically but expect it to be configured in the configs or blindly assume it was running under git user with /home/git directory, regardless if this user is available or not. Since the install guide already suggests to use sudo -u USERNAME for running scripts, it would be nice if the components would be able to fetch actual username and homedir via Etc object and not blindly assume something that may or may not be true.