Skip to main content

Self-hosting GitLab: A complete HomeLab deployment

In this video, I self-host GitLab in my HomeLab with Docker using my Boilerplates template, apply resource-friendly optimizations, and harden the instance post-install. I also show how I organize deployments and secrets in Projects and Groups, use the glab CLI, and manage updates with pipelines.

Instructions
#

Generate a Docker Compose GitLab setup via Boilerplates
#

boilerplates compose list
boilerplates compose generate gitlab

cd gitlab
docker compose up -d

Retrieve the initial root password
#

docker exec gitlab grep 'Password: ' /etc/gitlab/initial_root_password

Post-install hardening
#

  • Deactivate sign-ups (public instances): Admin Area → Settings → General → Sign-up restrictions
  • Change the initial root password: Profile icon → Edit profile → Password
  • Enable two-factor authentication (2FA): Profile icon → Edit profile → Two-Factor Authentication

Performance optimizations
#

  • The Boilerplates template uses smart defaults and resource-friendly settings to trim memory usage (observed reductions from ~7 GiB down to ~3 GiB in small setups; thanks to nucez from the Discord community).
  • Use the provided defaults first; tune further based on your host resources and workload.

GLab CLI quickstart
#

Install GLab CLI
#

Check out: https://docs.gitlab.com/editor_extensions/gitlab_cli/#installation

Authenticate
#

  1. Create a Personal Access Token: Profile → Access tokens (for admin/testing, enable all scopes carefully).
  2. Login with glab:
glab --help
glab auth --help
glab auth login
# Select: GitLab Self-Managed or GitLab Dedicated
# Host: your instance (e.g., http://localhost or https://gitlab.example.com)
# Use SSH for Git, HTTP for API (when behind Traefik HTTPS)

References
#

Christian Lempa
Author
Christian Lempa
IT & Tech Nerd | DevOps and Automation FanBoy