Which Server Size for GitLab
Our plans with at least 8 GB, against GitLab's figures. VPS vCPUs are shared threads of the host processor; GitLab advises against burstable instances, so for a busy team a dedicated server, whose cores are all yours, is the steadier choice.
| Plan | Memory | Cores | For GitLab | Price |
|---|---|---|---|---|
| Silver VPS | 8 GB | 4 vCPUs | Memory-constrained setup | $46.50/mo |
| Gold VPS | 12 GB | 6 vCPUs | Memory-constrained setup | $60.00/mo |
| Diamond VPS | 16 GB | 8 vCPUs | Meets GitLab's baseline | $73.50/mo |
| Platinum VPS | 24 GB | 12 vCPUs | Meets GitLab's baseline | $100.00/mo |
| AMD Ryzen 9 5950X dedicated | 128 GB | 16 cores | Meets GitLab's baseline | $399.00/mo |
GitLab also asks for at least 40 GB of disk for the application, plus room for every repository, on SSD storage.
1. Prepare the Server
On Ubuntu 24.04, secure the server and install Docker. Point gitlab.example.com at it and allow ports 80, 443 and 2424 in the firewall. Port 22 stays with the server's own SSH.
sudo mkdir -p /srv/gitlab export GITLAB_HOME=/srv/gitlab
2. Write the Compose File
In /srv/gitlab/compose.yaml. Replace VERSION with a current release from GitLab's tags (GitLab advises pinning a version rather than using latest in production):
services:
gitlab:
image: gitlab/gitlab-ce:VERSION-ce.0
container_name: gitlab
restart: always
hostname: gitlab.example.com
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
gitlab_rails['gitlab_shell_ssh_port'] = 2424
ports:
- "80:80"
- "443:443"
- "2424:22"
volumes:
- /srv/gitlab/config:/etc/gitlab
- /srv/gitlab/logs:/var/log/gitlab
- /srv/gitlab/data:/var/opt/gitlab
shm_size: "256m"cd /srv/gitlab sudo docker compose up -d sudo docker compose logs -f gitlab # the first start takes several minutes
With an https external_url and ports 80 and 443 reachable, GitLab requests a Let's Encrypt certificate for itself during the first start.
3. Sign In as Root
sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
Sign in at https://gitlab.example.com as root with that password and change it straight away: the file is deleted on the first container restart after 24 hours. Then, under Admin → Settings → General → Sign-up restrictions, turn off sign-ups unless the server is meant to be public.
4. Push Over SSH
Add your SSH key under your profile's SSH Keys, then clone with the port in the address:
git clone ssh://[email protected]:2424/group/project.git
GitLab shows the same address on each project page, because gitlab_shell_ssh_port tells it the port.
5. Back It Up
sudo docker exec -t gitlab gitlab-backup create # archives land in /srv/gitlab/data/backups # the backup does not include these; copy them separately and keep them safe sudo cp /srv/gitlab/config/gitlab-secrets.json /srv/gitlab/config/gitlab.rb /root/
Without gitlab-secrets.json, a restore loses two-factor settings and encrypted CI variables. Send the archives and both files off the server, to a storage box or object storage, from a nightly timer.
CI Runners
GitLab CI jobs run on GitLab Runner, a separate program. Run it on a second server so builds never compete with GitLab for memory, and register it with a token from the project or Admin → CI/CD → Runners page. As with a self-hosted GitHub runner, a runner that can start Docker containers is effectively root on its server, so keep it to code you trust. Want something much lighter than GitLab? Forgejo runs on the smallest VPS.