Configuration

After GitLab has been installed, we need to be able to reach it from the internet. Some of you may prefer to only have your GitLab instance and the rest of these services accessible on intranet, most of the steps here will be the same for you, just be sure to adjust all urls and ports as necessary.

NGINX

Setting up the various virtual hosts needed is a fairly simple task for those of you familiar with NGINX. Keep in mind that with git – especially if using git-lfs – processes can take take. Adjust the timeout values as necessary. The same is true for the Docker Registry if you plan to be uploading large images.

Copy
  • $DOMAIN
    • Your domain purchased and registered at your registrar.
      • futurehax
  • $TLD
    • The TLD for your domain
      • com
  • $GITLAB_SERVER_INTERNAL_IP
    • The IP address of your server running the GitLab instance on your intranet.
      • 10.1.1.1.2
  • $DOCKER_REGISTRY_SERVER_INTERNAL_IP
    • The IP address of your server running the Docker Registry on your intranet.
      • 10.1.1.1.2
    • This may or may not be the same server running your GitLab instance depending on your personal preferences.
      • 192.168.1.1.2
  • $MINIO_SERVER_INTERNAL_IP
    • The IP address of your server running the MinIO instance on your intranet.
      • 10.1.1.1.2

Take note of the client_max_body_size which controls your largest file upload size, as well as your various timeout values.

GitLab

GitLab is configured via a text file on the Gitlab server. This is a write protected file, so you will need to use sudo – or gksudo if you prefer a graphical text editor – to open the file.

sudo nano /etc/gitlab/gitlab.rb

After editing this file, you will need to reconfigure GitLab for your changes to take affect.

sudo gitlab-ctl reconfigure

There are quite a few available options here in the configuration, these are just the ones that worked for me. Feel free to browse and make adjustments as needed.

If you choose to utilize the built in backup functionality of GitLab, you can configure it to back your GitLab install up to Google Cloud Storage among other options. If you choose another method check the GitLab docs for that provider.

Copy
  • $DOMAIN
    • Your domain purchased and registered at your registrar.
  • $TLD
    • The TLD for your domain
  • $GITLAB_SERVER_INTERNAL_IP
    • The IP address of your server running the GitLab instance on your intranet.
  • $DOCKER_REGISTRY_SERVER_INTERNAL_IP
    • The IP address of your server running the Docker Registry on your intranet.
    • This may or may not be the same server running your GitLab instance depending on your personal preferences.
  • ¬†$MINIO_SERVER_INTERNAL_IP
    • The IP address of your server running the MinIO instance on your intranet.
  • $ARTIFACT_TMP_STORAGE
    • A local directory to temporarily store the artifacts as the are processed
  • $MINIO_KEY_ID
    • Configured when creating your MinIO container
  • $MINIO_KEY
    • Configured when creating your MinIO container
  • $SG_API_KEY
    • I utilize SendGrid to send all of our GitLab emails. You can get a free account and it should be more than enough for a small install, or upgrade if necessary later.
  • $GOOGLE_ACCESS_KEY_ID
    • Get this from your Google Cloud Storage console
  • $GOOGLE_ACCESS_KEY
    • Get this from your Google Cloud Storage console

GitLab Runners

Before making adjustments to your runner configs, you need to create and register them. You can find further instructions on how to do so on the Registering Runners instruction page. Once registered you can configure it manually.

I generally have at least 3 runners registered

  1. Docker Images
  2. iOS
  3. Everything else

Your runners are configured via a text file. This is a write protected file, so you will need to use sudo – or gksudo if you prefer a graphical text editor – to open the file.

sudo nano /etc/gitlab-runner/config.toml

After editing this file, you will need to restart your runners for your changes to take affect.

sudo gitlab-runner restart

Copy
  • $DOMAIN
    • Your domain purchased and registered at your registrar.
  • $TLD
    • The TLD for your domain
  • $MINIO_KEY_ID
    • Configured when creating your MinIO container
  • $MINIO_KEY
    • Configured when creating your MinIO container
  • $TOKEN
    • This token is generated by your runner when registering, do NOT change it!

Note the Docker runner uses the docker:docker image, is privileged, and mounts the docker socket.

Also note the iOS runner uses the shell executor, and must reside on an Apple computer, as the CI process relies on XCode to build and test.

The cache excerpt is to be copied into all of the runner configs.