Configure gitlab with apache on Ubuntu 10.04
- On August 14, 2012
- By Laur
- In Software
As mentioned in my previous post, I’ve managed to install gitlab with nginx using the tutorial. The only problem is that I already use apache for something else, so I’ve had to shutdown apache to use gitlab. Not nice.
Configuration
To use apache and gitlab I’m following this article outlining a Fedora install. Unfortunately, I’ve hit a snag:
The reason is that default ruby install on Ubuntu is a 1.8.7 (used to build passenger) and gitlab was built against a 1.9.1 version.
After digging a bit, I’ve decided that the way to go is to use rvm, so I can rebuild passenger (easiest way). First, remove the installation done by the gitlab automatic script or, better yet, just don’t use the automatic script at all. Just in case you get all kind of errors, remember to get out of gitlab’s directory (see here).
Another error I’ve got is:
Error message:
constant URI::WFKV_ not defined
which, apparently is a known error of ruby 1.9.1 and rake 1.3.5. To fix that, I’ve installed ruby 1.9.3 via rvm install 1.9.3 --with-openssl.
Unicorn daemon
To make sure I can run unicorn to consume from queue, I had to alter a bit the init.d script provided by the tutorial to use su instead of sudo:
#! /bin/bash ### BEGIN INIT INFO # Provides: gitlab # Required-Start: $local_fs $remote_fs $network $syslog redis-server # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: GitLab git repository management # Description: GitLab git repository management ### END INIT INFO echo "Ruby `ruby -v`" DAEMON_OPTS="-c /home/gitlab/gitlab/config/unicorn.rb -E production -D" NAME=unicorn DESC="Gitlab service" PID=/home/gitlab/gitlab/tmp/pids/unicorn.pid RESQUE_PID=/home/gitlab/gitlab/tmp/pids/resque_worker.pid case "$1" in start) CD_TO_APP_DIR="cd /home/gitlab/gitlab" START_DAEMON_PROCESS="bundle exec unicorn_rails $DAEMON_OPTS" START_RESQUE_PROCESS="./resque.sh" echo -n "Starting $DESC: " if [ `whoami` = root ]; then # use su instead of sudo (laur) # su - gitlab -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS && $START_RESQUE_PROCESS" else $CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS && $START_RESQUE_PROCESS fi echo "$NAME." ;; stop) echo -n "Stopping $DESC: " kill -QUIT `cat $PID` kill -QUIT `cat $RESQUE_PID` echo "$NAME." ;; restart) echo -n "Restarting $DESC: " kill -USR2 `cat $PID` kill -USR2 `cat $RESQUE_PID` echo "$NAME." ;; reload) echo -n "Reloading $DESC configuration: " kill -HUP `cat $PID` kill -HUP `cat $RESQUE_PID` echo "$NAME." ;; *) echo "Usage: $NAME {start|stop|restart|reload}" >&2 exit 1 ;; esac exit 0 |
Apache
My apache site config is:
<VirtualHost *:80> ServerName gitlab.server.local DocumentRoot /home/gitlab/gitlab/public/ <Directory /home/gitlab/gitlab/public/> AllowOverride all Options -MultiViews </Directory> </VirtualHost> |

