GitLab 6 + Apache + Phusion Passenger

I've successfully been running an instance of GitLab for almost a year now. The same server is running Redmine, hence both GitLab and Redmine are running in their respective sub-directories. Phusion Passenger is my application server of choice. Unfortunately, it became increasingly difficult to keep this setup running with newer versions of GitLab. First, GitLab officially is not supporting running it out of a sub-directory, second, by default it uses Unicorn. Here, I want to detail my setup how you still can achieve the GitLab + Apache + Phusion Passenger combo, because I could only find slightly outdated guides online.

As of this writing, my setup looks like the following:

  • Ubuntu 12.04 LTS
  • Apache 2.2.22
  • GitLab 6.1
  • passenger 4.0.19

First of all, you should obviously install Apache and passenger. For the latter follow the steps outlined here, and I assume you just installed the Apache package shipped by your distribution of choice first. After the basic setup, you can start setting up GitLab 6.1. However, because the sub-directory + Apache + Passenger setup is non-standard, you have to alter some of the steps when configuring GitLab:

  1. In the gitlab section of config/gitlab.yml, add relative_url_root: /gitlab
  2. In config/application.rb, uncomment the line containing config.relative_url_root = "/gitlab"
  3. Skip setting up the config/unicorn.rb file
  4. Instead of using the init script shipped with GitLab, use this file without the unicorn related parts and copy it to /etc/init.d/gitlab
  5. After completing the official install guide, you want to precompile assets using the following command:
    sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production RAILS_RELATIVE_URL_ROOT=/gitlab

You can check if everything worked so far by executing

sudo servive gitlab start
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

Note that it will complain about the init script not being up-to-date because it was replaced with a custom version.

Now it's time to configure Apache to run GitLab in the gitlab sub-directory. First of all, ensure that Passenger's Apache module is loaded. After that, go to /var/www/htdocs and create a symbolic link to /home/git/gitlab/public. Next, update your Apache configuration to look like this:

<VirtualHost *:80>
        DocumentRoot /var/www/htdocs
 
        <Directory /var/www/htdocs>
                Options FollowSymLinks
                Order allow,deny
                Allow from all
                PassengerResolveSymlinksInDocumentRoot on
        </Directory>
 
        Alias /gitlab "/var/www/htdocs/gitlab"
        <Directory /var/www/htdocs/gitlab>
                Options -MultiViews
                SetEnv RAILS_RELATIVE_URL_ROOT "/gitlab"
                PassengerAppRoot "/home/git/gitlab"
        </Directory>
</VirtualHost>

Finally, start apache and go to yourdomain.com/gitlab.

Comments

thanks for this tutorial searched for weeks to get it running with 6.1 and apache.
but I have a problem

git@fit-pc2:~/gitlab$ bundle exec rake assets:precompile RAILS_ENV=production RAILS_RELATIVE_URL_ROOT=/gitlab
/usr/local/bin/ruby /home/git/gitlab/vendor/bundle/ruby/2.0.0/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Permission denied - /home/git/gitlab/public/assets
/home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:38:in `block in write_asset'
/home/git/gitlab/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:36:in `tap'

Thanks for any help in advance

chown git:git public and bundle exec rake assets:precompile RAILS_ENV=production is ok ,
i read in a different tutorial this folder shuld be www-data:www-data

I added to httpd.conf this and I hope its ok.
LoadModule passenger_module /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.20/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.20
PassengerDefaultRuby /usr/local/bin/ruby

But is the gitlab file of instruction point Nr. 4 of correct.

git@fit-pc2:~/gitlab$ bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.7.0 ? ... OK (1.7.1)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ... can't check, you have no projects

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... no
Try fixing it:
Redownload the init script
For more information see:
doc/install/installation.md in section "Install Init Script"
Please fix the error above and rerun the checks.
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.7.10)

Checking GitLab ... Finished

ok script is working, didn't paste everything sorry !
Here is my default out of sites-available because I do not have htdocs folder:
<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
PassengerResolveSymlinksInDocumentRoot on
</Directory>

Alias /gitlab "/var/www/gitlab"
<Directory /var/www/gitlab>
Options -MultiViews
SetEnv RAILS_RELATIVE_URL_ROOT "/gitlab"
PassengerAppRoot "/home/git/gitlab"
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Many, many thanks! Worked like a charm!

Thanks!!! Worked!!!!!!!!!!!!!!!!!!!

Hey! Many thanks for your work. Almost everything worked, except your init script.
Here is my version: http://pastebin.com/zvHditaQ
It's not using 'bundle exec' and works for me

With input, the fun trick here isvolume. night lifeYou can't call in Pattaya without acknowledging its strongest asset, a giant night life and sex industry. Halloween is a fun and exciting clip of year for children.

It may be unsavoury, but it's necessary, and not merely with schoolkids but with grownups, business organizations and policymakers. Because of this, fun it is illegal to spell a mongoose into the joined States. brand certain no to works aloes any deeper than maturated before. besides, <a href = "http://www.mixcrate.com/westdmelit/playlist">love is quotes </a> Spanish child they can hear how to speak English. This is an of import component to consider. In part two you will chance gracing instructions for some of the most creative and splendid fun seeming cakes. But it's the composite picture that topics most. Dappy holds with the young ladies.

Why fun is the statistical distribution of land in Scotland the most inadequate in the developed global? But that's really merely portion of the gameplay, and you can but skip <a href = "http://livinglightcentre.org/node/2277">what s love </a> of the more than tricky mystifiers. bring up up both mends, but do not convey them higher than your knee joints. I opine I should thank them for vulnerability to this music, because I matured up in the 80's. In fact, you can even try to make a wooden feed bunk bed for youngsters.

Each dissenter acts with two famous people - one who pays a clew and one who finds it. The winner is the one at the end <a href = "http://i-rate-my-job.network-maker.com/forum/topic/213">beatles love </a> party who has the most falls. I consider Psalm 33:4 lends itself nicely to a full strong drumbeat. mixing shaping assessment joyrides into your direction will aid pupils see their learning and assist you manoeuver direction. And comedy acts a part in that , he states. The cards equaled all hand created and speedily got fun rattling democratic. Show the shavers a sewing machine and how it operates. For more icons from Tuesday's show, get all clicky fun on <a href = "http://openni-discussions.979934.n3.nabble.com/Kerry-Criticizes-Iran-alo... love </a> is about a 4 hour thrust from Cleveland. One of the topper plots for minors fun to spiel indoors. KnoodleKnuckles is something that you may not have learned about yet. Let the hale concoction of body of water and drops to boil for about 15 proceedings.

For the few who stayed, life was more and more difficult. Twenties party pames and printable activities are fun for party invitees of all elds. This game is besides sometimes called cornhole, and it <a href = "http://fr.kanjiroushi.net/html/user/agtradpick/">loves </a> in most all regions of the country.

most sequences of TV One's groundbreaking docu-seriesUnsungare jolly putting off. Currently, 63% of Mirror TV respondents opine Liz will be steering home, with Sam polling 29%. Math has... good, numbers. mayhap lead brainchild from fun The Lido Cafe in Brockwell Lido. In order to put across your estimations, you would need a particular gift about this exceptional day, isn't it? go the jumbled puzzler musical compositions back where they belong to create the St. Patrick's Day

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.