Self-host GitLab with CI on Railway: what it needs
Short answer: yes. GitLab Community Edition runs on Railway from one template: the official Omnibus image with a persistent volume, Git over SSH through a TCP proxy and a GitLab Runner that registers itself. It needs real memory: the template’s own idle measurement is about 3.9 GB, so a paid plan is required. CI works, but only for shell-based jobs, because Railway cannot run Docker inside a container.
Deploy GitLab on RailwayWhen this makes sense
GitLab bundles Git hosting, merge requests with review, issues, boards, wikis and CI/CD. Self-hosting suits teams that want code on infrastructure they control, or want one tool for repositories and pipelines. The template documentation lists these uses:
- private Git hosting for a team,
- code review with protected branches and approval rules,
- issues, boards and wikis next to the code,
- lightweight pipelines for tests, linting, builds and scripted deploys,
- a central GitLab for external runners on your own VMs or Kubernetes.
If you only need a place to push code for a hosted deploy, a hosted Git service is simpler. GitLab is a large application to operate.
What the template deploys
| Service | What it does |
|---|---|
| GitLab | Official gitlab-ce Omnibus image (19.4.1) with nginx, Puma, Sidekiq, Gitaly, gitlab-shell, PostgreSQL and Redis in one container; volume at /var/opt/gitlab; public domain and an SSH TCP proxy |
| GitLab Runner | Version 19.4.1, shell executor, with its own volume for configuration |
Everything GitLab needs to keep sits on that single volume, because Railway allows one volume per service. GitLab runs as a single replica for the same reason.
Deploy it, step by step
- Use a paid plan. The template notes give Hobby as the minimum. Trial’s 1 GB per service is not enough for GitLab.
- Deploy the template. No input is required; the root password and a runner bootstrap token are generated.
- Wait for the first boot. The healthcheck allows up to 30 minutes. The template author measured about three minutes locally with 4 vCPUs; first-boot time on Railway was not measured.
- Sign in as
rootwithGITLAB_ROOT_PASSWORDfrom the GitLab service variables. Change the password. - Decide on sign-ups. Turn them off under Admin, Settings, General if the instance is private.
- Add your SSH key in your GitLab preferences. The clone URL shown by GitLab already uses the TCP proxy host and port.
- Check the runner under Admin, CI/CD, Runners. “Railway shell runner” should appear online a few minutes after GitLab is healthy.
How CI works here
Jobs run directly inside the runner container as the gitlab-runner user. Available tools are git, git-lfs, curl, bash, jq, make, Python 3, rsync, zip, unzip and the SSH client. Add more in the runner’s Dockerfile.
The runner registers itself using a short-lived token that GitLab creates for root, scoped only to creating a runner and expiring in 30 days. The runner revokes the token after use. The template author tested a full pipeline on the shell runner locally.
Two cautions from the source: jobs share the runner container, so use this runner only for projects you trust; and image: is ignored, so pipelines written for Docker runners may need changes.
What it costs
Railway bills usage, and GitLab is memory-heavy. The idle RAM figure below was measured locally by the template author a few minutes after first boot. The “typical” figures and all dollar amounts are estimates, calculated at $10 per GB of RAM, $20 per vCPU and $0.15 per GB of volume per month.
| Load | RAM | Estimated monthly cost |
|---|---|---|
| Idle (measured: GitLab 3.9 GB, runner 23 MB) | about 3.9 GB | about $41 |
| Typical, 5 to 25 developers (estimated) | about 5.5 GB | about $72 |
Puma workers are about 700 MB each, and the defaults fit a 4 to 8 GB service. Memory, not storage, is the main cost driver.
Backups and upgrades
- Backups: Railway volume backups cover the GitLab volume. For an application-level backup, run
gitlab-backup createin the GitLab service shell, copy it off the volume, and keep a copy of/etc/gitlab/gitlab-secrets.jsonwith it. - Upgrades: GitLab and the runner are pinned in their Dockerfiles. Follow GitLab’s upgrade path one required stop at a time and keep the runner on the same minor version. Major upgrades of the bundled PostgreSQL are not automatic; back up first.
Limitations
- No container registry or Pages by default; they need extra domains and ports.
- Outbound SMTP for notification email needs Railway Pro.
- GitLab cannot run multiple replicas in this setup.
- Logs under
/var/log/gitlabare not persisted; they are streamed to Railway’s log view. - For very large installations GitLab recommends external PostgreSQL, Redis and object storage, which this template does not cover.
Browse more guides.
FAQ
How do I sign in for the first time?
Wait until the GitLab service is healthy; the first boot configures GitLab and creates the database, which takes several minutes. Open the public URL and sign in as root with the generated GITLAB_ROOT_PASSWORD from the GitLab service variables, then change it. New sign-ups need admin approval by default; turn sign-up off under Admin, Settings, General if the instance is private.
Can pipelines build Docker images?
Not on the bundled runner. Railway has no Docker-in-Docker, so the runner uses the shell executor and ignores the image: and services: keywords in .gitlab-ci.yml. For container-based jobs, register an external Docker runner against your GitLab URL.
Is my data kept across redeploys?
Yes. Repositories, the database, uploads and configuration live on one volume mounted at /var/opt/gitlab. The template also keeps /etc/gitlab on that volume, so gitlab-secrets.json and the SSH host keys survive redeploys. Back up with gitlab-backup create and keep a copy of gitlab-secrets.json, which is not part of that backup.
What are the licence terms?
According to the template's NOTICE.md, GitLab Community Edition is MIT and the Omnibus packaging is Apache-2.0; bundled components keep their own licences. GitLab Runner is MIT. The template is a community template and is not affiliated with or endorsed by GitLab Inc.