Deploy Forgejo

Git forge with PostgreSQL, persistent volume, HTTPS, and Git-over-SSH.

Deploy Forgejo

/var/lib/postgresql/data

Just deployed

/data

Deploy and Host Forgejo with Railway

Forgejo wordmark

Forgejo is a lightweight, self-hosted Git forge — a community fork of Gitea. Host your repositories, issues, pull requests, and packages without depending on GitHub.

About Hosting Forgejo

This template deploys Forgejo 16 with PostgreSQL, a persistent volume for repository data, a public HTTPS domain, and Git-over-SSH through Railway's TCP proxy. Database credentials, the public URL, and SSH endpoints are wired with Railway reference variables so the instance is ready after the first boot. Open the URL and register — the first user becomes the administrator. Self-registration stays enabled until you turn it off in Site Administration.

Common Use Cases

  • Self-host GitHub-style repositories, issues, and pull requests
  • Keep private code off GitHub while still using Git over HTTPS or SSH
  • Run a small team forge with packages, LFS, and webhooks
  • Mirror upstream repositories for backup or air-gapped workflows

Dependencies for Forgejo Hosting

  • Forgejo 16 (forgejoclone/forgejo:16, Docker Hub mirror of the official image — Railway templates cannot pull from Codeberg)
  • Railway PostgreSQL (private network)
  • Persistent volume mounted at /data
  • Railway TCP proxy on container port 22 for Git SSH

Deployment Dependencies

Implementation Details

After deploy, open the generated *.up.railway.app URL and register the first account. That user is the admin. Git HTTPS works immediately. Git SSH uses Railway's TCP proxy host and port (RAILWAY_TCP_PROXY_DOMAIN / RAILWAY_TCP_PROXY_PORT), shown in the service variables after the proxy is attached.

Forgejo's web installer enables "Disable self-registration" by default, which fails unless you also create an admin on that form. This template skips the installer (INSTALL_LOCK=true) so that trap does not appear.

Custom domains for SSH need a CNAME to the TCP proxy hostname. HTTP(S) custom domains are attached on the Forgejo service as usual.

Why Deploy Forgejo 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 Forgejo 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.


Template Content

More templates in this category

View Template
Garage S3 Storage
Ultra-light S3 server: fast, open-source, plug-and-play.

PROJETOS
8
View Template
Redis
Self Host Latest Redis with Railway

8
View Template
EasyImg
Simple self-hostable Nuxt.js personal image hosting system.

Muhammad Bilal
0