Gitlab Setup on existing DigitalOcean droplet

January 13 2016

A few months ago, I downgraded all of my GitHub accounts to free and launched an instance of GitLab on a DigitalOcean server. Between my different organizations, I was just paying too much for private repositories, and I needed another solution. Launching the DigitalOcean server is costing me $40/month, compared to the $80-$100/month I was paying to GitHub. And I can use the DigialOcean server to host other small projects that need to live online.

From now on, all of my projects will start on GitLab, and I will move them to GitHub if/when I want to make them public.

I won’t lie - it took a bit of fiddling to get it working properly, which is why I am publishing my notes here.

  1. Set up a DigitalOcean droplet with Ubuntu 14.04 of at least 4GB (I didn’t think it would be necessary to go up to 4GB, but you will get 502 errors if you don’t use at least this size). This will cost you $40/month.
  2. Pick a domain or subdomain (I’m using and make a DNS “A” record that points to the IP address of the droplet. This process will differ depending on your registrar. I use Dreamhost, so it’s as easy as going to “Control Panel” > “Manage Domains” > “DNS” and then adding in the record.
  3. See to install GitLab. Follow the instructions carefully! I sipped the first step because I thought I had the prereqs installed, but that got me into trouble.
  4. I want to use the droplet for other projects as well, so I installed NGINX independently from Gitlab and then followed these instructions to tell Gitlab to use an existing NGINX install.
  5. I set up Gitlab to use my Dreamhost SMTP for sending emails (confirmations, notifications, etc), and I found the SMTP settings to be very finicky. The official instructions got me close, but my emails weren’t being sent. It took me a lot of googling just to find out that you can use sudo gitlab-ctl tail to read log messages. Then I was getting Net::ReadTimeout errors, and then OpenSSL::SSL::SSLError
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = ""
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = ""
gitlab_rails['smtp_password'] = "your-password"
gitlab_rails['smtp_domain'] = ""
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'none' # Solution to OpenSSL::SSL::SSLError problem
gitlab_rails['smtp_tls'] = true # solution to Net::ReadTimeout problem?

Remember: after making changes to configuration file, run gitlab-ctl reconfigure to make those changes active.

There are lots of other instructions on that page if you prefer another email service, but setting up Postfix is a huge PITA, and in order to use Gmail, you have to disable 2-step authentication, which I don’t want to do.

  1. Integrate your GitLab install with GitHub. This will make it possible to import repositories from Github into your Gitlab. This was crucial for me.