---
title: "Deploy GitLab"
description: "GitLab CE: Git hosting and CI/CD, root password set at deploy"
category: "Other"
url: https://railway.com/deploy/gitlab-2
---

# Deploy GitLab

GitLab CE: Git hosting and CI/CD, root password set at deploy

**[Deploy GitLab on Railway](https://railway.com/template/gitlab-2)**

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

- **Creator:** Dektion
- **Category:** Other
- **Total deploys:** 1

## Template content

### GitLab https://devicons.railway.com/i/gitlab.svg

- **Source:** dektionstudio/railway-template-images
- **Health check:** /users/sign_in
- **Public domain:** Yes

## Documentation

# Deploy and Host GitLab on Railway

[GitLab](https://gitlab.com/gitlab-org/gitlab) Community Edition (MIT) is a complete DevOps platform in one app: Git repositories, merge requests, issues, wikis and CI/CD pipelines. This template runs the official GitLab CE Omnibus image (19.6.1) on Railway with the root password set at deploy, sign-up off and Git over SSH working.

## About Hosting GitLab

GitLab's Omnibus image bundles everything (Rails, Sidekiq, Gitaly, Postgres, Redis, nginx) in one container, and expects three directories to persist. A Railway service gets one volume, so this template mounts it at `/var/opt/gitlab` (repositories, the database, uploads) and moves `/etc/gitlab` onto it too. That matters more than it looks: `/etc/gitlab/gitlab-secrets.json` holds the keys that encrypt CI/CD variables, 2FA secrets and runner tokens, and a GitLab that generates a fresh one on every restart can no longer read any of them.

The root password comes from `GITLAB_ROOT_PASSWORD`, generated per deploy, so there's no first-visitor password form. New GitLab instances allow anyone to request an account; the start step turns sign-up off as soon as GitLab answers, and you add people under Admin, Users. Git over SSH goes through a Railway TCP proxy, and GitLab is told that host and port, so the clone URLs it shows are correct. Railway terminates HTTPS in front, and nginx inside GitLab listens on plain HTTP.

Before publishing I tested it on Railway. The sign-in page answered, the API returned 401 without credentials, and `/users/sign_up` redirected to sign-in because sign-up was off. Root signed in with the generated password and had admin rights. I created a project with a README, committed a file through the API and stored a masked CI/CD variable. The SSH port answered with an OpenSSH banner through the TCP proxy. After two restarts, root signed in again, the commit was there, and the CI/CD variable still decrypted to the same value, which only works when `gitlab-secrets.json` survived.

GitLab is heavy: it used about 3.4 GB of RAM (3.8 GB at peak during the first start), roughly $35 a month on Railway's usage pricing before CI jobs, so it needs a Hobby plan or higher. The first start takes about four minutes while GitLab configures itself. To fit one Railway service, the template turns off the parts that need more: the container registry, GitLab Pages, the Kubernetes agent server and the built-in Prometheus. Railway's Hobby volumes stop at 5 GB, which holds a team's code but not large binaries; Pro volumes go to 1 TB.

## Common Use Cases

- Private Git hosting for a team, with merge requests, code review and issues in one place
- CI/CD pipelines that build and test every push (with a GitLab Runner on another machine)
- Moving off a paid hosted plan while keeping the same workflow

## Dependencies for GitLab Hosting

None beyond Railway. CI/CD jobs need a GitLab Runner: register one from a server or your laptop with the token from Admin, CI/CD, Runners. Email (notifications, password resets) needs an SMTP provider, which Railway allows on the Pro plan; set it in `GITLAB_EXTRA_CONFIG`.

### Deployment Dependencies

- GitLab: https://gitlab.com/gitlab-org/gitlab
- Docker installation docs: https://docs.gitlab.com/install/docker/
- Image: `gitlab/gitlab-ce:19.6.1-ce.0`
- The wrapper this template builds: https://github.com/dektionstudio/railway-template-images/tree/main/gitlab

### Implementation Details

```
GITLAB_URL                  # open this and sign in as root
GITLAB_ROOT_PASSWORD        # root's password (generated)
GITLAB_EXTRA_CONFIG         # extra gitlab.rb lines, e.g. SMTP
/var/opt/gitlab             # the volume, including /etc/gitlab and gitlab-secrets.json
TCP proxy -> 22             # Git over SSH; GitLab shows its host and port in clone URLs
```

To upgrade, change `GITLAB_VERSION` in the wrapper's Dockerfile and follow GitLab's upgrade path for the versions in between.

## Why Deploy GitLab on Railway?

Your code, issues and pipelines run on a server you control, with HTTPS, SSH and backups of one volume to think about instead of a whole VM. Railway bills the resources GitLab uses, not a fixed machine size.


## 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-2
