Skip to content

Self-hosting GitLab: A complete HomeLab deployment

Git Self-Hosting

Video write-up

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.

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.

Authenticate

  • Create a Personal Access Token: Profile → Access tokens (for admin/testing, enable all scopes carefully).

  • Login with glab:

glab --help
glab auth --help
glab auth login