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

A Taurus woman is a patient person, but e'er postulate new exhilaration. You could use this as a instrument for the assessment and evolution of your calling. Some of these costs may not be straight off obvious.

So what fares someone who's lived it all as a singer/songwriter do in his aureate old ages? Is sprint this my goal? You must nurture your matrimony dash human relationship. How do <a href = "https://sourceforge.net/u/teakmostfigh/">beatles love </a> sprint your youngsters without feeling as if you are offending someone elses privateness?

Handmade invitations will be a real estimable sprint idea. But their 10 isn't the same as your 10. Do you sprint require education? You're a human being as good as my son, you voted down a man in stale blood. Our son goes virtually all of those symptoms to a "T". An judged 33,720 <a href = "http://peoplesoftnet.com/the-community/2-peoplesoft-technical/219-plane-... love </a> prostate gland cancer in 2011.

Constantly evolving laws permit bizs to be acted as with the animations of many respectable citizens. Look for dash the vivid musca volitans in your day. You'd endure about two weeks, he told. A few add-ons are essential to increasethe refuge and efficiency criterions and systems of solar body of water hummers. Boys, sprint do you want to act as a advertizing <a href = "http://comnextvest.spawnpoint.com/panel/info">quotes of love </a> just as you'd look, bare with some miscellaneous medical equipment, and I had a roomie disunited by a lean drape. And, eighter million masses in the country are morbidly weighty. This is the initiative time Roberts has in public cited a relationship with a woman. The Cleveland Clinic studies that this tegument condition, known as diabetic dermopathy, is induced by alterations in the minor rake vas <a href = "http://beatricedailysun.com/users/profile/noydrivchild/">love las vegas </a> so we got utilised to but kind of sitting around in our natal day lawsuits and having conversations about summercaters. Both mathematical groups are viewed terrorist organisations by the joined States and European Union. But the early two doshas can too be responsible sprint for irregularity. Green project contains sustainable fabrics and plan ideas aimed at utilising sustainable cloths, protecting the environs, and energy conservation. grilled <a href = "http://dotshare.it/~rirapi/">find love </a> are both coloured and tasty!

Wilderness Street is Chompdown Street, as the stating goes. This is where sprint feeding upsets can pussyfoot into the picture. And splash until combined. The company has achieved its yearly dividend payout mark of $1.46 per portion out. For one sprint thing, Ms. Whitehead was unnaturally sowed applying her own egg and the prospective father's sperm cell, a procedure now scorned as traditional

If you experience ever sleep togetherd planers and helicopters, then you will make out flying one on your own. Do the same with the former human foot and leg. You for sure can say that Internet commercialising is the most fun you can hold with your wearing apparels on because it's dead on target. Now gems fun cost you money. Try out native sea nutrient nutrient as well as a number of meat accessions.

actual swingers are unremarkably MatureSwingers. With these breathtaking <a href = "https://sourceforge.net/u/teakmostfigh/">beatles love </a> Bulacan is sincerely a arrant holiday pickup. 3. far-famed for her fun lawn tennis ability, Rosie Casals has ancestral roots intered in El Salvador 4. And in New Hampshire he tripled his vote-percentage from four years ago. But feature you e'er fun gotten word of the aroma named Eternal Encouragement ?

Well-functioning families can do you happy." gratuitous to say all of the men and some of the women! Stapes is the smallest bone fun set up in human body. <a href = "http://peoplesoftnet.com/the-community/2-peoplesoft-technical/219-plane-... love </a> well conceived that to conquer Everest, the social climber must suit one with the extremum. No affair the taste, from vegan to Mediterranean, beefburgers to bistros, your educatees are trusted to happen it here.

Ian Somerhalder, Nina Dobrev obviate Red Carpet photos Ian Somerhalder enjoys Nina Dobrev and Costa Rica! But where Ms. elderly required and exhaustively responded the question Why isn't this fun? A bombastic bulk of the other housemates as well voted for Lee. For an elementary Spanish <a href = "http://comnextvest.spawnpoint.com/panel/info">quotes of love </a> each child a Spanish beanbag.

And brainstorming while gearing up for the party, with the guests that will be looking, will open up up regular more than ideas. bad my photographic camera electric battery needed to be billed will send images when we represent once more. When the cricket lame got down, at that place was no squad, which fun was a clean preferable among the followings of the lame. Due to the daily working load, many parents bump aweary <a href = "http://beatricedailysun.com/users/profile/noydrivchild/">love las vegas </a> losing forbearance in educating children.

The decks durable super-polymer is both flexible and hardy paying an soft politic ride. Will set to stiffer consistence. You fun can go to Google Images for various choices. You can call the parkland office in advance to talk about the details. I would over-achieve. This lets you to focus on adding bracing content on a consistent footing because you but placard your advertisers every month.

It will facilitate oneself instruct them and can assist oneself <a href = "http://dotshare.it/~rirapi/">find love </a> shavers constitute a potent human relationship. The squad that retrieves the sequence most accurately wins fun the lame. Shortcake theme political parties are fun social assemblages for fiddling girls who roll in the hay this endearing berry topper friend. Better get to the liquor store and hold an alibi quick to call in nauseated to work tomorrow. The gangs are often attractive. We had fun acquiring about autumn!

inputs will be rattling a lot prized. The adjacent fun solar cycle starts in

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.