---
title: "Deploy GitLab CE + CI Runner: Git hosting and CI/CD, GitHub alternative"
description: "Private Git repos, merge requests, issues and CI/CD with a built-in runner"
category: "Other"
url: https://railway.com/deploy/gitlab-ce-fixed
---

# Deploy GitLab CE + CI Runner: Git hosting and CI/CD, GitHub alternative

Private Git repos, merge requests, issues and CI/CD with a built-in runner

**[Deploy GitLab CE + CI Runner: Git hosting and CI/CD, GitHub alternative on Railway](https://railway.com/template/gitlab-ce-fixed)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/gitlab-ce-fixed/manifest.json

- **Creator:** ProCode
- **Category:** Other
- **Total deploys:** 16

## Template content

### GitLab https://about.gitlab.com/images/ico/favicon-192x192.png

- **Image:** gitlab/gitlab-ce:19.5.5-ce.0
- **Start command:** `/bin/bash -c 'set -e; mkdir -p /var/opt/gitlab/etc-gitlab; if [ ! -L /etc/gitlab ]; then cp -an /etc/gitlab/. /var/opt/gitlab/etc-gitlab/ 2>/dev/null || true; rm -rf /etc/gitlab; ln -s /var/opt/gitlab/etc-gitlab /etc/gitlab; fi; set +e; /assets/init-container & child=$!; if [ -n "$GITLAB_RUNNER_TOKEN" ]; then ( m=/var/opt/gitlab/.railway-runner-$(printf %s "$GITLAB_RUNNER_TOKEN" | sha256sum | cut -c1-12); i=0; while [ ! -f $m ] && [ $i -lt 20 ]; do i=$((i+1)); sleep 30; curl -fsS -o /dev/null http://localhost/-/readiness || continue; gitlab-rails runner "t=ENV.fetch(%q(GITLAB_RUNNER_TOKEN)); if Ci::Runner.find_by_token(t) then puts %q(Railway sandbox runner: already registered) else r=Ci::Runner.new(runner_type: :instance_type, run_untagged: true, description: %q(Railway sandbox runner), registration_type: :authenticated_user, creator: User.find_by_username(%q(root))); begin; r.set_token(t); rescue NoMethodError; r.token = t; end; r.save!; raise %q(token lookup failed) unless Ci::Runner.find_by_token(t); puts %q(Railway sandbox runner: registered) end" && touch $m; done ) & fi; trap "gitlab-ctl stop sidekiq; gitlab-ctl stop puma; gitlab-ctl stop; rc=\$?; kill -TERM $child 2>/dev/null; wait $child; exit \$rc" TERM; wait $child'`
- **Health check:** /users/sign_in
- **Public domain:** Yes

### Runner https://about.gitlab.com/images/ico/favicon-192x192.png

- **Image:** alpine:3.22.2
- **Start command:** `/bin/sh -c 'echo H4sIAAAAAAACA6VYbVPbSBL+7l/RO/HFwCEpEJLsmcAdcZys98BOGZPdFLAqWR7bCrLGOyPZEMx/v+6ZkZBfSKpyVEGhmZ5+n6e759kvXj9KPDWuPIOPUXoa9KGbJQmXEGYqFROH3/IwS4WEgYxmXNZBJBy6QRTPgztQQTLoi1uYIn2jBV9F30U+jSARSRQGMYRieocnlDeV4isPU+VJc9JJ+WQaBylX3ihK46DvhNyTWrAnlavGECWQjjnMgixOiSmAWe8LkcLmH6K3yisuZ1HIawpUGsgUFZlMUFdAEQrpIlXiGIpkGI0WU8mngeQLJFmEMQ+SbKo5DkW27gzkOuLEpIcUVphhLhJAw1D7IJ5G6Kot4mFtNAZCNMHDqFqz3et++dRptXswF1k8ADUP4ljMITBaI3ur9/YuKGFMH4h5EotgoLRyKCLhgxX+ZGgeocZpCzDAgYy4ciuV7kW73ez6n5vd81anfcSq9x9bvdOTd/7yRt3Z+5f7yj14YBVkUCbvnrRO/zj54peW684r980r9wUS/9Y8/YRcWmcnH5tHTPJRpFJ55xr1XDQmj7aQI29J6eUvZ8xjzKn67a+v/dcHzgzlLumHos57J73mkTcLpBdH/SKvbEZaPpWJGHBUe48dwiVUn4EzSuEFXMPz56DG0TCtVDBn/UEkt7bhHng4FsCqmrWHG071vnFx3uuc+c32Z7/R8n/vvPNb7+vO7QMyfKhggJp4J+4o8WHEUwUR/mKAtNvHYsJ13DDBwkxKnqREqCDhM0rRMWabJsRgp9ytyLlW4rfOGfquumUV22ZgbUPN/mPEqv4tkVYwg+fFHaTcBGeKVHmMPnU7vzcbPdSYgcNLG2hNq9tpn2ECmk0nGuD2VhikUJLsWdZsm0i0+ApKH6I6vrpTeIVLXlsJQB2qO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et0/ePry/+h9Zpk5knMQuWpMHxU5SPjwxYSwzF5hedfBjQjYUJyXqNLh53hkvgvGS6KSzmbWpQepMym8PyGxhanEpx9/89g+la8eRktalsWLF8YL2DAV+iLeaw0thqNS3dwEP9EERlG/JJQPKJmHF6VjSctUP1HzkBRw7zxoZ8jOlspGUKb2a99Fy+ePqFu/xEt09s9DX4HyiCmfMVGAAA | base64 -d | gunzip > /opt/rs.sh && chmod +x /opt/rs.sh && exec /opt/rs.sh boot'`

## Documentation

# Deploy and Host GitLab on Railway

GitLab Community Edition is the free, MIT-licensed edition of GitLab: Git repositories, merge requests with code review, issues and boards, wikis and CI/CD pipelines in one application. This template runs the official GitLab image, pinned to an exact release, with HTTPS on your Railway domain and Git over SSH through a TCP proxy. A CI runner ships with it, switched off: paste one Railway token and every pipeline job runs in its own Railway sandbox. You get a private GitHub alternative on your own infrastructure without setting up a server, a reverse proxy, certificates or a runner machine.

## About Hosting GitLab

GitLab ships as one container that runs everything it needs: PostgreSQL, Redis, Gitaly for repository storage, Sidekiq for background jobs, Puma for the web app and nginx in front. This template configures it for a single Railway service using [GitLab's own low-memory settings](https://docs.gitlab.com/omnibus/settings/memory_constrained_envs/), and keeps repositories, the database, uploads, GitLab's configuration and secrets, and the SSH host keys on one volume. CI/CD variables, two-factor secrets and SSH fingerprints survive every redeploy. The root password is generated for you. First boot takes about six minutes while GitLab sets up its database; redeploys take about three.

## Common Use Cases

- **Private Git hosting for a team**: repositories, branches and history on infrastructure you control, cloned over HTTPS or SSH.
- **Code review with merge requests**: open a merge request from a branch, review the diff, approve and merge in the browser.
- **Issue tracking and planning**: issues, issue boards and a wiki next to the code they describe.
- **CI/CD without a runner machine**: pipelines defined in `.gitlab-ci.yml` run on the bundled runner, each job in a fresh Railway sandbox with the Docker image the job names.

## How to Use GitLab After Deployment

1. Wait for the GitLab service to show **Active**. The first boot takes about six minutes.
2. Open the service's public URL (GitLab service, **Settings**, **Networking**).
3. Sign in as `root`. The password is `GITLAB_ROOT_PASSWORD` in the GitLab service's **Variables** tab.
4. GitLab opens with two setup screens, **Create your first project** and **Set up your profile**. Fill them in or press **Skip** on each.
5. Add your SSH key: avatar menu, **Edit profile**, **SSH Keys**. SSH clone URLs use the TCP proxy host and port, for example `ssh://git@example.proxy.rlwy.net:12345/group/project.git`, and the project page shows the exact one.
6. Decide who may register. New accounts need an administrator's approval by default; to turn sign-up off, go to **Admin**, **Settings**, **General**, **Sign-up restrictions**.
7. To run pipelines, switch the runner on: in your project's **Settings**, **Tokens**, create a token for this environment, paste it as `RAILWAY_TOKEN` on the **Runner** service and deploy. GitLab already lists the runner under **Admin**, **CI/CD**, **Runners**, and it goes online a few minutes later.

## Dependencies for GitLab Hosting

- GitLab (`gitlab/gitlab-ce`, pinned to an exact release): the whole application, with a volume at `/var/opt/gitlab`.
- Runner (`alpine`): GitLab Runner with a driver that starts one [Railway sandbox](https://docs.railway.com/sandboxes) per job. Off until `RAILWAY_TOKEN` is set.

### Deployment Dependencies

- [GitLab](https://about.gitlab.com)
- [GitLab Docker installation docs](https://docs.gitlab.com/install/docker/)
- [GitLab source (MIT)](https://gitlab.com/gitlab-org/gitlab)

### Implementation Details

**Memory:** GitLab idles at about 3.2 to 3.5 GB on this template. The Hobby or Pro plan is required; Free and Trial services cannot hold it.

**Configuration:** every GitLab setting lives in `GITLAB_OMNIBUS_CONFIG` as `gitlab.rb` lines separated by semicolons. To change one, add a line at the end and redeploy.

**CI runner:** each job gets its own sandbox, which is created when the job starts and destroyed when it ends, so you pay for sandbox time only while jobs run ([sandbox pricing](https://docs.railway.com/sandboxes#pricing)). The job's `image:` is honoured, artifacts work, and `allow_failure` exit codes are passed through. Not supported yet: `services:`, a cache kept between jobs, and Docker commands inside a job. Images need a shell (`sh` or `bash`). Run more jobs at once with `RUNNER_CONCURRENT`. The Runner service itself uses about 2 MB of memory while off and about 50 MB while on.

**Switched off to save memory:** Prometheus monitoring and the Kubernetes agent server. The container registry and GitLab Pages are off too, since each needs its own hostname.

**Email:** GitLab sends no email until you add SMTP settings. Append them to `GITLAB_OMNIBUS_CONFIG` (`gitlab_rails['smtp_enable'] = true; gitlab_rails['smtp_address'] = 'smtp.example.com'; ...`, per [GitLab's SMTP docs](https://docs.gitlab.com/omnibus/settings/smtp/)). Railway allows outbound SMTP on the Pro plan only.

**How to Upgrade:** change the image tag on the GitLab service to a newer `gitlab/gitlab-ce` release and redeploy. Follow [GitLab's upgrade path](https://docs.gitlab.com/update/upgrade_paths/) and stop at each required version on the way. You can also turn on automatic image updates (GitLab service, **Settings**, **Source**, **Configure Auto Updates**) with **Patches only**, which keeps you on the same minor version. The pre-update volume backup is Pro plan only, so back up first on Hobby.

## Is GitLab Free?

GitLab Community Edition is MIT-licensed with no user limit. The paid Premium and Ultimate tiers add features on top; repositories, merge requests, issues, wikis and CI/CD are all in the free edition. On Railway you pay only for the resources the service uses.

## Why Choose This Template

- **CI that runs on Railway, with nothing else to set up.** A GitLab Runner ships with the template, switched off. Paste one Railway project token on the Runner service and pipelines start. GitLab registers the runner by itself, so there is no runner machine to rent and no registration token to copy.
- **Every job in its own clean machine.** Each job runs in a fresh Railway sandbox with the Docker image the job asks for, and the sandbox is destroyed when the job ends, so one job's leftovers never reach the next.
- **You pay for CI only while jobs run.** Sandboxes bill per second while a job runs; between jobs the runner itself uses about 50 MB of memory.
- **Your data survives redeploys.** Repositories, the database, GitLab's configuration and secrets, and the SSH host keys live on one volume, so CI/CD variables, two-factor secrets and SSH fingerprints stay put.
- **Git over SSH works out of the box**, through a TCP proxy, with clone URLs that show the right host and port.
- **Pinned to an exact GitLab release.** Templates that track the `latest` tag pull whatever GitLab released most recently on every deploy, so a redeploy can break a working instance (GitLab refuses to start when an update skips one of its required upgrade versions), a new environment can run a different release from your current one, and two environments that look identical can drift apart.

We keep this template current: when GitLab ships a new release, we test it on a fresh deployment and then move this template's pinned version forward, so every new deployment gets the newest release we have seen work. Your existing deployment stays on its version until you choose to update it.

With a pinned release, updating is a choice you make and can test first:

1. Duplicate your environment: open the environment dropdown in the top bar, choose **+ New Environment**, then **Duplicate Environment**, and approve the staged changes.
2. In the copy, open the GitLab service, go to **Settings**, **Source**, change the image tag to the release you want, and deploy the change.
3. Test the copy. If it works, back up your main environment and make the same tag change there. Follow [GitLab's upgrade path](https://docs.gitlab.com/update/upgrade_paths/) when moving across several releases.

## FAQ

**Why does my pipeline stay pending?**
The runner is off until you set `RAILWAY_TOKEN` on the Runner service (step 7 above). You can also register a runner on a machine you run: **Admin**, **CI/CD**, **Runners**, **Create instance runner** ([GitLab Runner docs](https://docs.gitlab.com/runner/)).

**Can a job reach my other Railway services?**
Yes. Job sandboxes join the environment's private network, so `service.railway.internal` addresses work. The token you paste works only inside this project's environment.

**Does Git over SSH work?**
Yes. Railway's TCP proxy forwards to GitLab's SSH server, and clone URLs already carry the proxy host and port.

**Can I use my own domain?**
Add the custom domain under **Settings**, **Networking**, then set `GITLAB_HOST` to it and redeploy so GitLab's links and HTTPS clone URLs use it.

**How do I back up GitLab?**
Run `gitlab-backup create` in the GitLab service's shell, then keep `/etc/gitlab/gitlab-secrets.json` with the backup ([GitLab's backup docs](https://docs.gitlab.com/administration/backup_restore/backup_gitlab/)). [GitLab's restore docs](https://docs.gitlab.com/administration/backup_restore/restore_gitlab/) cover the way back.

## Why Deploy GitLab on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying GitLab on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — Self-hosted virtual tabletop for role-playing games (license required)
- [Double Commander in your browser](https://railway.com/deploy/double-commander-in-your-browser) — The Double Commander file manager in the cloud, from any device

Open this page in a browser: https://railway.com/deploy/gitlab-ce-fixed
