How to Setup Git Server (GitLab), With SSL
I have been using unfuddle which provided me with free 512 MB to use for my private projects, and (of course) GitHub for any opensource projects.
But what is better than setting up Git on your own server?
I have a $5/mth Digital Ocean VPS that is overloaded to run node apps, wordpress and mail server.. So, I might as well run GitLab too.
GitLab Installation Guide
At the point of writing, I am using GitLab 7.1 (stable) on Ubuntu 14.04.
Refer to their detailed installation guide.
WARNING: Do NOT use their simplified guide which install everything automatically. I did that, and it screwed up my existing nginx config..
Their installation guide is long, but comprehensive, and you can choose not to install any packages which you already have installed.
Follow their guide (except on the sections on HTTPS/SSL).
Setting up for HTTPS/SSL
For setting up HTTPS/SSL, refer to this GitLab recipe.
But I still need some refinement to that recipe, so I will share my configs.
I will be setting up for a fictional domain git.okloh.com
.
Create your FREE SSL Cert
A FREE class 1 SSL is provided by StartCom. Go to StartCom, and create another certificate for git.okloh.com
.
Save your private key password somewhere
On your server,
cd /etc/ssl/private
Save your private key
git-okloh.key
Save your certificate
git-okloh.pem
wget https://www.startssl.com/certs/sub.class1.server.ca.pem
to download their intermediate CA Certcat git-okloh.pem sub.class1.server.ca.pem > git-okloh-chain.pem
to concat and create a chain certopenssl rsa -in git-okloh.key -out git-okloh-decrypted.key
> enter your private key password
Note: In many tutorials, you would see that they use a .crt
instead of a .pem
. They are the same thing, but in different format. But it doesn’t matter. You can use a .pem
in place.
Nginx
This is my nginx config that works:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
GitLab Config
1 2 3 4 |
|
GitLab-Shell Config
1 2 3 4 5 |
|
Restart
Remember to restart both services.
1 2 |
|
If anything is wrong, you can check:
1 2 3 |
|
Pitfall: Port 443 already binded
In a previous tutorial, I setup iRedMail, which actually runs on Apache, which listen on port 443.
You will need to remove port 433 on apache, and probably do a reverse proxy from nginx for port 433. This perhaps will be covered in another tutorial.
Pitfall: Sidekiq not running
1 2 3 4 5 |
|