Using this Digitalocean tutorial on how to install Gitlab as a base:

We’re going to install and configure Gitlab, including some of the open source software bundled like Mattermost, but also set up S3 storage.

If you haven’t done so already, make sure you

First, log in to your server that will have gitlab

ssh code@code.80pxtesting.com

  1. Install Gitlab

    1. Update the server and install required packages

      sudo apt update

      sudo apt install ca-certificates curl openssh-server postfix

      (leave all options alone and hit OK for any settings regarding postfix)

    2. Download Gitlab to /tmp directory, and run script to add repository

      cd /tmp

      curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh

      sudo bash /tmp/script.deb.sh

      sudo apt install gitlab-ce

    downloading gitlab

    • The above image shows Gitlab installing after running sudo apt install gitlab-ce
    • Update the firewall to allow gitlab through (http and https)

      sudo ufw allow http

      sudo ufw allow https

      sudo ufw reload

    gitlab firewall

  2. Configuring Gitlab

    The way Gitlab works is it has a configuration file that reads in how to set up the application. Simply put, we edit the /etc/gitlab/gitlab.rb file and tell gitlab to reconfigure itself any time we want to make a change. Our goal right now is to open this file, put in our S3 information, and settings that we want for our gitlab installation, then restart gitlab.

    1. Let’s edit the /etc/gitlab/gitlab.rb
    2. There are many different text editors, we’re going to use nano

    sudo nano /etc/gitlab/gitlab.rb

    Now we can edit the file through the terminal.


    • The ^X on the bottom is an example of a command we can run in the nano application.
    • You hold control, and press X to do the Exit command.
    • You can navigate with the arrow keys and type changes to the file.
    • You can hit control + W and search for something with the Where Is menu. You type what you want to search for and hit enter.
    • A line with ## in front means that it is commented out and will be ignored.

    Here you can see I change the default variable external_url to the URL we set up in our Digitalocean domain settings.


    before settings

    ​ After

    settings after

    Remember from our tutorial, on how to get an API key for you Digitalocean spaces:

    The public key is: QMDLKUYLQLIPOJEYMYF4

    The private key is: SGRcKLuuWdv4UI3GY4E2kFvjc1NaTJgQnSMe/D8pLSc

    Now it’s really just a matter of us setting which variables we want. Below is a list of all the settings I changed for Gitlab, including using our Digitalocean S3 Spaces keys.

## URL for our gitlab website
external_url 'https://code.80pxtesting.com'

## Time configuration of where you live
gitlab_rails['time_zone'] = 'America/Phoenix'

## Enabling S3 storage for gitlab components
gitlab_rails['object_store']['enabled'] = true
gitlab_rails['object_store']['connection'] = {
  'provider' => 'AWS',
  'aws_signature_version' => '2',
  'region' => 'sfo3',
  'aws_access_key_id' => 'QMDLKUYLQLIPOJEYMYF4',
  'aws_secret_access_key' => 'SGRcKLuuWdv4UI3GY4E2kFvjc1NaTJgQnSMe/D8pLSc',
  'endpoint' => 'https://sfo3.digitaloceanspaces.com'
gitlab_rails['object_store']['proxy_download'] = false
gitlab_rails['object_store']['objects']['artifacts']['bucket'] = '80pxtesting/artifacts'
gitlab_rails['object_store']['objects']['external_diffs']['bucket'] = '80pxtesting/external-diffs'
gitlab_rails['object_store']['objects']['lfs']['bucket'] = '80pxtesting/lfs'
gitlab_rails['object_store']['objects']['uploads']['bucket'] = '80pxtesting/uploads'
gitlab_rails['object_store']['objects']['packages']['bucket'] = '80pxtesting/packages'
gitlab_rails['object_store']['objects']['dependency_proxy']['bucket'] = '80pxtesting/dependency-proxy'
gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = '80pxtesting/terraform-state'

## Enabling S3 storage for gitlab backups

gitlab_rails['backup_keep_time'] = 604800
gitlab_rails['backup_upload_connection'] = {
  'provider' => 'AWS',
  'aws_signature_version' => '2',
  'region' => 'sfo3',
  'aws_access_key_id' => 'QMDLKUYLQLIPOJEYMYF4',
  'aws_secret_access_key' => 'SGRcKLuuWdv4UI3GY4E2kFvjc1NaTJgQnSMe/D8pLSc',
  'endpoint' => 'https://sfo3.digitaloceanspaces.com'
gitlab_rails['backup_upload_remote_directory'] = '80pxtesting/gitlab-backups'

## URL for our docker registry
registry_external_url 'https://registry.80px.com'

## Enabling S3 for registry storage
registry['storage'] = {
  's3' => {
    'aws_signature_version' => '2',
    'accesskey' => 'QMDLKUYLQLIPOJEYMYF4',
    'secretkey' => 'SGRcKLuuWdv4UI3GY4E2kFvjc1NaTJgQnSMe/D8pLSc',
    'bucket' => '80pxtesting',
    'region' => 'sfo3',
    'regionendpoint' => 'https://sfo3.digitaloceanspaces.com'
  'redirect' => {
    'disable' => false
## Disable health checks for digitalocean s3 
registry['health_storagedriver_enabled'] = false

## URL for our mattermost install
mattermost_external_url 'https://chat.80pxtesting.com'

## Turn on automatic https certificate renewals. Must have a valid email address.
letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['80pxtutorials@protonmail.com'] # This should be an array of email addresses to add as contacts

Once you have made all your configuration changes in nano you can:

  • Press control + x to exit
  • When you are asked if you want to Save modified buffer? press y
  • When you are asked to confirm File Name to Write: /etc/gitlab/gitlab.rb press enter

You’ve now saved the configuration file, but we have not applied the changes yet.

Before we apply these settings we need to first create these folders in Digitalocean spaces.

Make the following empty folders in your Digitalocean spaces file browser.

  • uploads
  • terraform-state
  • packages
  • lfs
  • gitlab-backups
  • external-diffs
  • dependency-proxy
  • artifacts

add s3 folders

Now that we have the right folders and configuration for our gitlab, registry, and mattermost, lets reconfigure the server and get it started.

Run this command to reconfigure your gitlab.

sudo gitlab-ctl reconfigure

This will take a minute as Gitlab makes all the new changes. It will look something like this.

reconfigure gitlab

When it is all done, it will look like this

gitlab done

Congrats! You’ve got an Ubuntu 20.04 server running Gitlab all connected to S3 for data storage now.

Your new server gitlab url: code.80pxtesting.com

When you visit this in a browser, you would see the form the message is talking about. You need a new root password. Make it something strong!

gitlab root

Here is a list of some of the things you have added to your tool set:

  • Self-hosted architecture from the start (installed gitlab on our own digitalocean server)
  • A place to store your code projects in git repositories (gitlab)
  • A docker registry to build environments using your code projects (gitlab included the docker registry)
  • Mattermost (a slack-like chat that uses your gitlab accounts for login)
  • A way to integrate a kubernetes cluster to automatically deploy your app

Now you can log in

login root

And you’re in!


Click View Settings to disable sign-up like the notification is suggesting. You can turn this on when you are ready to add other users.

disable sign up

Let’s make a group for our organization. This is where we can put projects we may want to add to the kubernetes cluster.

Here we make a group on Gitlab called softwarecompany. We make it private, and check the box to make a mattermost team for the group.

new gitlab group

Now we have a private group on gitlab that has it’s own Mattermost team.

new gitlab group dash

You can also log in to the Mattermost chat at chat.80pxtesting.com


You can choose Gitlab single sign-on, and your gitlab instance is already connected to the chat. (Tip: You can disable email and password from the settings)

mattermost enable

Authorize the mattermost instance to use your gitlab account to continue with single sign on that way for the future.

After doing the tutorial, you can see the chat.

mattermost home

The Mattermost chat is a nice-to-have feature of installing Gitlab. It is a good way to have instant communication in a centralized way with various teams.

Now that we have a gitlab server, next we need to add a Kubernetes cluster, configure it, and install our application.