---
title: "Deploy Coolify"
description: "Deploy and host Coolify on Railway"
category: "Automation"
url: https://railway.com/deploy/coolify-1
---

# Deploy Coolify

Deploy and host Coolify on Railway

**[Deploy Coolify on Railway](https://railway.com/template/coolify-1)**

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

- **Creator:** fournyp's Projects
- **Category:** Automation

## Template content

### Coolify https://raw.githubusercontent.com/coollabsio/coolify/main/public/coolify-transparent.png

- **Source:** https://github.com/FournyP/coolify-railway-template
- **Health check:** /api/health
- **Public domain:** Yes

### Coolify Realtime https://raw.githubusercontent.com/coollabsio/coolify/main/public/coolify-transparent.png

- **Source:** https://github.com/FournyP/coolify-railway-template

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Documentation

![Coolify logo](https://raw.githubusercontent.com/FournyP/coolify-railway-template/main/assets/coolify-logo.png)

# Deploy and Host Coolify on Railway

Coolify is an open-source, self-hostable PaaS — an alternative to Heroku, Netlify and Vercel that deploys applications, databases and services onto servers you own. This template runs the Coolify control plane on Railway, with the full web UI, while your actual workloads are built and deployed over SSH on your own remote servers.

![Coolify](https://raw.githubusercontent.com/FournyP/coolify-railway-template/main/assets/coolify-banner.png)

## About Hosting Coolify

Coolify is a Laravel application: an nginx + php-fpm web tier, a Horizon queue worker, a scheduler, and a websocket server for live logs and the in-browser terminal. It stores every server, application, secret and SSH key in Postgres, and uses Redis for queues and cache. Coolify itself never builds a container image — it generates shell scripts and pipes them over SSH to the servers you register, where `git clone` and `docker build` actually run. That makes it a natural fit for Railway: the control plane runs as an ordinary stateless web service with no Docker socket and no privileged access, while the heavy build work happens on your own hardware. Railway handles the domain, TLS, Postgres, Redis and private networking, so there is no VPS to patch just to keep the dashboard online.

## Common Use Cases

- Self-hosted PaaS for deploying apps to your own VPS fleet (Hetzner, OVH, bare metal)
- Git-push deployments, preview environments and automatic TLS on servers you control
- Managed databases and one-click services on your own infrastructure
- A control plane that stays reachable even when a target server is rebuilt or replaced

## Dependencies for Coolify Hosting

- A Postgres database (all durable state)
- A Redis instance (queues and cache)
- At least one remote server you own, reachable over SSH, with Docker installed

### Deployment Dependencies

- Coolify: https://coolify.io
- Documentation: https://coolify.io/docs
- Source repo for this template: https://github.com/FournyP/coolify-railway-template

## Implementation Details

### Architecture Components

This template deploys four components:

- **Coolify**: nginx, php-fpm, Horizon and the scheduler in one container under s6-overlay. The only public service, served on port 8080 with a `/api/health` healthcheck.
- **Coolify Realtime**: soketi (port 6001) and the terminal server (port 6002). Private — reached only through the Coolify service's nginx.
- **Postgres**: every server, application, secret and encrypted SSH key.
- **Redis**: queues and cache.

### Websocket Routing

Upstream Coolify fronts these services with Traefik and routes `/app` and `/terminal/ws` to the realtime container. Railway exposes one public port per service, so this template moves that routing into the nginx already inside the Coolify image — same paths, same host. The browser connects to `wss:///app` and `wss:///terminal/ws` with no client-side configuration.

### Stateless by Design

No volume is attached. SSH keys are re-materialised from Postgres into the container's storage directory on every boot, so the service can be redeployed or moved freely. Postgres is the only copy of your keys and settings — back it up.

### Service Configuration

- **Dashboard**: the complete Coolify UI, API, backups and notifications
- **Live logs and terminal**: streamed over websockets on the same public domain
- **Scaling**: keep both services at 1 replica and app sleeping off — Horizon and the scheduler must keep running, and a second replica would run every scheduled job twice
- **Required variables**: `APP_KEY`, `APP_URL`, `ROOT_USERNAME`, `ROOT_USER_EMAIL`, `ROOT_USER_PASSWORD`, the `DB_*` and `REDIS_*` references, and matching `PUSHER_APP_ID` / `_KEY` / `_SECRET` on both services

### After Deploying

1. Log in with the root credentials you set.
2. Set the instance FQDN in **Settings** to your Railway domain.
3. **Keys &amp; Tokens** → add your SSH key. **Servers** → add and validate your server.
4. Deploy a project. The build runs on your server, not on Railway.

Note: `APP_KEY` encrypts every registered server's SSH key — never change it, and never lose it. `ROOT_USER_EMAIL` is validated against DNS, and `ROOT_USER_PASSWORD` is checked against HaveIBeenPwned; an invalid value silently skips account creation.

## License Information

Coolify is open-source under the Apache 2.0 license. This Railway template is MIT-licensed. See the respective repositories for full details.

## Why Deploy Coolify on Railway?

Self-hosting a PaaS usually means a VPS you have to keep patched, monitored and online — the one machine that must never go down, because it is what deploys everything else. Running the Coolify control plane on Railway removes that machine: Railway manages the dashboard, its database, its domain and its TLS, while your servers stay yours and do the building. You get self-hosted deployments without babysitting the thing that does the self-hosting.

## Notes

- Nothing is built on Railway. Every build runs on the server you deploy to; configure a dedicated build server in Coolify if yours are small.
- This instance holds the SSH keys to every server you register, behind one password on a public domain. Use a long unique root password and enable 2FA immediately.
- The seeded `localhost` server (id 0) is permanently unreachable here and shows red. It is cosmetic — ignore it, and never attach a resource to it.
- Railway bills egress at $0.05/GB; deployment log streaming counts.
- Source repo: https://github.com/FournyP/coolify-railway-template
- Docs: https://coolify.io/docs

## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Automate WhatsApp workflows with Evolution API, n8n, and Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

Open this page in a browser: https://railway.com/deploy/coolify-1
