Setup a Gitlab with Apache2 routing at Ubuntu server 12.10

After a lot of bugs, errors, despair, etc…I’m finally finished Gitlab installation at my VM with Ubuntu Server 12.10.

The default wizard provided by own Gitlab works perfectly IF some small adjusts between and after some steps.

Use the default wizard (https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md) for main guide of Gitlab installation and attempt for steps mentioned bellow on this post and good luck.

Step 1

With this wizard, you can make step 1 directly without modifications.

Step 2

To keep your server organized, you can use another folder for ruby source, for example you can use:

/opt/ruby-1.9.3/

After you do or not this adjust, compile and install normally all step 2.

Steps 3 and 4

For system users and Gitlab-shell, follow default wizard normally.

Step 5

Important: remember to install libmysqlclient-dev package…either Ruby throws some exceptions when it’s install mysql2’s gems.

Step 6

Before the item ‘Install Gems’, you can install separately gem for mysql adapter:

After this, continue with default wizard instructions.

When we have configured init.d file, now we going to configure the Apache2 routing for Gitlab app.

Apache2 routing

If you want have an Apache server with pretty urls like:

boss.domain.com

And, you doesn’t have uris like this bellow:

boss.domain.com:3948502/some/page.foo

We going to use an Apache module to do internal routing from 3948502 to 80 ports.

Now install this modules with apt-get manager:

Now we’ll need install passenger gem to integrates two services,

The passenger installer will ask you for what you want do…choose the second option ‘install and configure’ …however with you have missing deps, the installer will show they for you.

After passenger’s installation, the installer will print the module location and configuration to be used with your Apache2 sites.

Apache site configurations

This step (and last) it’s very simple. Create your site conf ‘name_of_site.conf’:

And put this content in this file:

Now you only need enable the site and restart gitlab and apache2 services:

It’s done! With all configs has been correct, now you can access your Gitlab’s by those two uris:

http://server-money.com:8081/ and http://gitlab.server-money.com/

Appendix (SSH bugs and more)

After my installation,  I’ve problem with SSH auth because my SSH port it’s not a 22 (standard). So, I needed configure the ‘conf’ file under /home/git/.ssh/ folder:

After, check the permissions of /home/git/.ssh/ folder, you must set this permissions for him:

And still needed execute at /home/git/gitlab folder these commands:

The second command will be validate all your Gitlab installation, repositories and users…and must important, your /home/git/.ssh/authorized_keys.

More bugs, read this page.

References

https://gist.github.com/carlosjrcabello/5486422

https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md

https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/databases.md

http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab/16291877#16291877

https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide

https://github.com/gitlabhq/gitlab-shell/issues/46

Special thanks to

@lccezinha – support with satanical Ruby errors and Ruby usage and config.

@caarl0sbitnami installer.