j4

Deploying your own GitLab instance under 5 minutes

It's no secret that I work around GitLab during my day job and that I generally love this software.
This blog post is therefore not biased at all in any way or form. (do I need to mark this further as sarcasm, or did everyone get the memo?)

For this quick tutorial, you'll need:

  • Some machine where the instance will be hosted
  • Docker installed on the machine
  • Ability to read instructions

For this, we'll be using docker compose which provides an easy way to bring services up from a configuration file.
This tutorial just provides a bare bones instance that you will need to configure further later.

Small note: for this to work, your system SSH daemon will need to run on something else than port 22.

The compose file for GitLab is really simple:

services:
  gitlab:
    image: gitlab/gitlab-ce:17.6.1-ce.0
    volumes:
      - ./gitlab/config:/etc/gitlab
      - ./gitlab/log:/var/log/gitlab
      - ./gitlab/data:/var/opt/gitlab
    ports:
      - "22:22"
      - "80:80"
      - "443:443"

And there you go, name this file docker-compose.yml on your server and issue:

$ docker compose up -d

After a few minutes, the GitLab instance should be reachable on the IP of your machine.

To reset the root password, use:

$ docker compose exec gitlab gitlab-rake "gitlab:password:reset[root]"

Now, some few steps that are recommended to take after having a working instance:

  • Reverse-proxy GitLab and get HTTPS certificates for everything
  • Host a runner (to be able to utilize CI/CD)
  • Refine the Gitlab.rb configuration, most notably:
  • Configure the container registry
  • Configure object storage
  • Configure emails

In a future blog post, I'll show how to configure one cool feature of GitLab which is the service desk which can be useful for some projects.

Thoughts? Leave a comment