A server for GitLab: official requirements, runners and space for repositories
A self-hosted GitLab is not one service but a whole set: the web application on Puma, Sidekiq background jobs, the Gitaly repository storage, PostgreSQL, Redis, Nginx and, by default, Prometheus monitoring as well. It all installs as a single package, but it needs memory to match. That is why the table above keeps plans with 4 cores and 8 GB of memory or more: GitLab starts on less, but working with it is unpleasant.
What the official documentation says
For a single-server installation, GitLab names 8 vCPU and 16 GB of memory as the baseline configuration. The lower limit for a memory-constrained server is 8 GB. A few more important points from the requirements:
- burstable CPUs, where a core runs at full power only for short periods, are not recommended: under load GitLab is CPU-bound all the time;
- swap is best disabled or kept to a minimum, since performance drops sharply when it is actively used;
- ARM processors are supported;
- the disk should be SSD, with no network file systems for repositories.
There is also a separate guide for small servers: disable Prometheus and the exporters, switch Puma to single-process mode, and cut Sidekiq threads from 20 to 10. This way GitLab fits into about 2.5 GB of memory and 1 GB of swap, but it's an option for a personal server for one or two people, without large pipelines and with noticeable interface lag. For a team, treat 8 GB as the minimum and 16 GB of memory as the normal configuration.
Disk: where the space goes
The documentation allows 40 GB for the application itself, 5–10 GB for the PostgreSQL database (12 GB or more for the Ultimate edition), and for repositories no less than their total size. In practice the space is eaten not so much by source code as by:
- build artefacts and CI job logs: set a default expiry for artefacts;
- the Container Registry: every image push adds layers, and without a cleanup policy the registry grows without end;
- Git LFS and the package registry;
- local backups created by
gitlab-backup create.
Start with 80–100 GB on NVMe and watch the growth in the storage usage section of the admin area. Move backups off the server right away: this is supported out of the box, to S3-compatible storage or to a separate machine, with suitable plans on the VPS for backups page. Save /etc/gitlab/gitlab-secrets.json and gitlab.rb separately: they are not part of the standard backup, and without the secrets file a restored GitLab can't decrypt tokens and CI variables.
Runners: on a separate machine
It's better not to install GitLab Runner on the server running GitLab itself. Builds, tests and docker build easily take up all the cores and memory, and while they run the interface and git operations slow down for the whole team. On top of that, CI jobs execute arbitrary code from repositories, and keeping them next to GitLab's database and secrets is an unnecessary risk. The usual setup is a main server at a fixed price and one or more runners with the Docker executor that can be created and removed as needed. Choosing such a machine is covered on the VPS for CI/CD runners page; set the concurrent parameter in the runner configuration no higher than the number of cores.
Where to host the server
Choose a location close to your team and your runners: git push and clone of large repositories, pushing images to the Container Registry and downloading artefacts in every pipeline are sensitive both to latency and to bandwidth. If the runners and GitLab sit in the same data centre, or better yet on the host's private network, builds get cache and artefacts faster and don't use external traffic. For code that falls under requirements to store data in Russia, the server must be in a Russian location.
Installation and maintenance
The easiest way is the official package for Ubuntu, Debian or AlmaLinux: it contains all the components and updates through the package manager. The Docker option is supported too, but updates and backups need more attention there. A few practical points:
- SSH for git runs on port 22 by default, so move the server's system SSH to another port or set up a separate one for GitLab;
- connect an external SMTP for merge request and password reset emails;
- update regularly and along the official upgrade path: you can't jump over several major versions at once, and the required intermediate versions are listed in the documentation;
- take a disk snapshot in the host's panel before every update.