Using GitLab Community Edition with the Green House Data gBlock Cloud

I’ve recently been doing more and more DevOps and Systems Engineering related work in the Green House Data gBlock Cloud, and I’ve quickly found that I needed a place to manage my configurations and code that I’ve created. It is also great for backups.

I’ve used GitHub extensively in the past, but I decided I wanted to host something myself this time.  This gives me flexibility in how I would like to backup, store, and access the systems. It also is a cost effective solution that scales well beyond my needs at this time.

So how did I do it? Read on – the process is listed below.

1.) I installed a fresh Ubuntu 14.04.5 Virtual Machine inside the gBlock Cloud. The VM has 4GB of RAM, 16 GB of Disk, and 4 vCPU’s.  I decided to use Ubuntu so I could easily upgrade to newer versions of Ruby, etc in the future. GitLab CE’s Requirements.

2.) I opened Port 443 and Port 80 per the firewall rules in the Data Center settings

3.)  I went ahead and brought the system up to date:

git$ sudo apt-get update && sudo apt-get upgrade

4.) Install the GitLab CE dependencies

git$ sudo apt-get install curl openssh-server ca-certificates postfix

5.) Download the GitLab CE package

git$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

6.) Install the GitLab CE package

git$ sudo apt-get install gitlab-ce

7.) Install Lets Encrypt and Encrypt all communications (skip this step if you have your own SSL Certificates to install)

git$ sudo mkdir -p /srv/www/git.example.net/le
git$ sudo vi /etc/gitlab/gitlab.rb

8.) Add the following configuration to tell Nginx to use the .well-known file for Let’s encrypt.

nginx['custom_gitlab_server_config'] = "location ^~ /.well-known { root /srv/www/git.example.net/le; }"

9.) Configure GitLab CE for the first time

git$ sudo gitlab-ctl reconfigure

10.) Let’s Encrypt – Generate certificates

git$ wget https://codeload.github.com/certbot/certbot/zip/master
git$ unzip master
git$ cd certbot-auto
git$ sudo ./letsencrypt-auto certonly -a webroot -w /srv/www.git.example.net/le -d git.example.net

11.)  Configure Gitlab to use the new certificates and force all traffic over HTTPS.  Edit /etc/gitlab/gitlab.rb and add the following lines

nginx['redirect_http_to_https'] = true
. . .
nginx['ssl_certificate'] = "/etc/letsencrypt/live/git.example.net/fullchain.pem"
nginx['ssl_certificate_key'] = "/etc/letsencrypt/live/git.example.net/privkey.pem"

While we are editing the /etc/gitlab/gitlab.rb file, lets tell the server to only use https. Make sure the url has httpS.

external_url 'https://git.example.net

12.) Tell Gitlab to generate a new configuration

git$ sudo gitlab-ctl reconfigure

13.) Now logon to the Gitlab site and configure it via https://git.example.net

 

As you can see, installing Gitlab on a virtual machine in the Green House Cloud is very simple to do. Please feel free to leave comments below.

2 thoughts on “Using GitLab Community Edition with the Green House Data gBlock Cloud

  • Jack January 14, 2017 at 04:46 AM

    Hey just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Chrome.
    I’m not sure if this is a format issue or something to do with web browser
    compatibility but I thought I’d post to let you know.
    The design and style look great though! Hope you get the issue
    solved soon. Many thanks

  • brandon January 14, 2017 at 02:41 PM

    Thanks Jack. I believe I have it fixed now.

Comments are closed.