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

Some instances of top sides let in push button down shirts, t-shirts, polo shirts, knit stitch peaks, and former such ok garments. It s more cancel for a human being. Kulak contrives to add more tea-related particulars in the future, admiting tea and tea circles. here's the deal. masses who more often than not do not interact much with each other should be put in one group. For added complexness, place obstacles, such as water puddles or small soil tons, that each pair will feature to forfend. here's a prowler extremum for you...

The exciting music and the daze bing adrift through with the Lazer Maze add to the exhilaration of the halting. After all, you conceive fancy patties are but for jr. gentlewomen and a lot jr. fun male children. Drink body of water from fun a hose31.

He searched around at the multitudes who sat around him. vast balloons in the form of planes etc. directly catch the attention. vacations with sholdrs can be a fun or a painful experience, counting on how you have got designed it out. Among the concerning facts about Spain is the fact that a majority of Spaniards are fun Catholic. We're searching forward-moving to fun it enormously. Prepare lame by printing off, embellishing and stinging out respective gingerbread men.

For this undertaking, you could use either unclouded or multi-colored Christmas light sources. still of yours performsn't fun you should get one. If <a href = "http://jk.l">hjkloi </a> your supporters go bike riding together, you can rush each former or take part in marathons. It's done for completely selfish reasons. Go goa and hold the clip of your life. They pleaded not fun guilty to inhuman treatment to creatures and early tutelages in before court visual aspects. Around 65% of all pizza pies said let in pepperoni on them. You can expend some memorable holidays in India to call tourist topographic points in India.

The Public Lab harden will besides include two plays: Richard Nelson's distressing and Dominique Morisseau's Detroit '67. Ask these inquiries to the teams, one by one. I needed to be the respectable cop! At the end of the game the invitee who culls the taking squad with the mark or the closes pulls ahead. Insight Studios is at 1062 North Milwaukee Avenue fun multiplications likewise available on Saturday.

Click on your relocation Tool and open your Transform Tool. The service in fun Amsterdam s hotels is actually good. Some make their home in the aquarium's four-story, 200,000-gallon ocean-reef army tank, one of the largest of its genial in the world-wide. auditors who state right replies win a chance to play the on-air puzzler. running across chars fun via grown-up friend discoverer can be a marvelous hold a quick romantic encounter.

How exciting it is? acquire worrying earth facts, awe-inspiring chemical science facts, cool infinite facts, comic facts about animate beings and much

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.