---
title: "Deploy Grav CMS"
description: "Fast Markdown CMS with no database, an admin panel and Redis cache."
category: "CMS"
url: https://railway.com/deploy/grav-flat-file-cms
---

# Deploy Grav CMS

Fast Markdown CMS with no database, an admin panel and Redis cache.

**[Deploy Grav CMS on Railway](https://railway.com/template/grav-flat-file-cms)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/grav-flat-file-cms/manifest.json

- **Creator:** blueorange
- **Category:** CMS

## Template content

### Grav https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/grav-light.svg

- **Source:** https://github.com/gridalpha/grav-railway
- **Health check:** /
- **Public domain:** Yes

### Redis https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/redis.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

# Deploy and Host Grav on Railway

![Grav logo](https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/grav-light.svg)

Grav is an open source **flat-file CMS**: every page is a Markdown file with YAML front matter, every setting is a YAML file, and there is no database to install, migrate or back up. It's built in PHP with Twig templates and Symfony components, has an admin panel for editing pages and media in the browser, and a package manager for hundreds of themes and plugins. Grav is MIT-licensed and has about 15,700 GitHub stars. This template runs Grav on Railway with a persistent volume that holds the whole site and Redis as a fast cache. It creates your admin account before the site goes public, so nobody can claim an unconfigured install, and the password is generated for each deploy. It's a lighter alternative to WordPress for blogs, docs and marketing sites, with fewer moving parts to secure and update. Hosting costs about $5–10/month on Railway.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **Grav** | Grav on Apache and PHP 8.4, built from the official `getgrav/grav` image with the latest Grav release baked in. Port `8080` with a public domain. Volume at `/var/www/html`. |
| **Redis** | Redis 8.2 with a password and a volume. Grav's page and object cache. |

The volume at `/var/www/html` is the whole site: pages, media, configuration, user accounts, themes and plugins. Redis only holds cache, so it can be cleared at any time.

---

## About Hosting Grav

Most small websites don't need a database. A blog, a documentation site or a company homepage is mostly text and images, and a flat-file CMS stores exactly that, as files. That makes Grav fast, easy to back up and easy to version with Git.

**Admin created before launch.** Grav normally shows a setup screen to whoever opens the URL first. This template creates the admin account from `GRAV_ADMIN_USER` and `GRAV_ADMIN_PASSWORD` before Apache starts listening, so the public URL never serves an unclaimed site.

**Seeded once, then yours.** The admin account, site title and cache settings are written on the very first boot. After that, the admin panel owns those files, so changing the variables later has no effect. Use the admin panel or edit the YAML files instead.

**Modular pages.** Build landing pages from reusable modular blocks, each a Markdown file with its own template, so layouts stay flexible without a page builder.

**Plugins for the basics.** Plugins add contact forms, sitemaps, SEO metadata and comments, all configured in YAML or the admin panel.

**Twig themes.** Themes are Twig templates with CSS, so a front-end developer can build or adjust one without learning a complex plugin API.

**Redis cache.** Grav caches compiled pages, Twig templates and configuration. This template points that cache at Redis, which keeps response times low and survives container restarts.

**Updates from the admin.** Grav's built-in package manager updates the core, themes and plugins from the admin panel, and because everything lives on the volume, updates persist across redeploys.

**Backups are just files.** Download a zip from the admin's backup tool or copy the `user` folder; restoring means unpacking it again.

**Fast by design.** Grav compiles pages once and serves them from cache, so a small container handles a surprising amount of traffic.

**Behind Railway's proxy.** HTTPS is handled at Railway's edge, and the wrapper configures Grav for the reverse proxy so links and redirects use your public URL.

Typical cost: **~$5–10/month** on Railway for Grav and Redis at small to medium traffic. Managed WordPress hosting usually costs more, and it still needs a database.

---

## Deploy Grav in Under 5 Minutes

1. Click **Deploy on Railway**. Optionally set `GRAV_SITE_TITLE` and `GRAV_ADMIN_EMAIL` first.
2. Copy `GRAV_ADMIN_PASSWORD` from the **Grav** service's **Variables**.
3. Open `https://your-domain/admin` and sign in as `admin`.
4. Pick a theme, edit the home page and add your first pages in the admin panel.
5. Install plugins such as a contact form, SEO tools or a blog from **Plugins**.

Your site is live at the public domain as soon as you save a page. Open it in a private window to see it the way visitors will.

---

## Common Use Cases

- **Blogs.** Write posts in Markdown with categories, tags and RSS.
- **Documentation sites.** Use a docs theme to publish product or API documentation.
- **Marketing and company sites.** Fast pages with no database to secure.
- **Portfolios.** Showcase work with image galleries and simple page layouts.
- **Landing pages.** Spin up a campaign site in minutes.
- **Multilingual sites.** Serve pages in several languages with Grav's built-in multi-language support.
- **Knowledge bases.** Organise help articles in folders, with search from the SimpleSearch plugin.
- **Event sites.** Publish schedules, speakers and updates quickly.
- **Personal wikis.** Keep notes as Markdown pages you can edit from anywhere.
- **Git-based publishing.** Keep content in a Git repository and sync it with the Git Sync plugin.
- **Client sites for agencies.** Give clients a simple admin panel without WordPress upkeep.

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `GRAV_ADMIN_PASSWORD` | 🔐 Auto-generated | First admin password. Needs upper and lower case letters and a digit. |
| `GRAV_ADMIN_USER` | ✅ Set | `admin`. 3–16 lowercase letters, digits, dashes or underscores. |
| `GRAV_ADMIN_EMAIL` | Optional | Used for password recovery. |
| `GRAV_SITE_TITLE` | Optional | Site title written on the first boot. |
| `GRAV_REDIS_HOST`, `GRAV_REDIS_PORT` | ✅ Auto-injected | Redis connection for the cache. |
| `GRAV_REDIS_PASSWORD` | ✅ Auto-injected | Redis password. |
| `GRAV_REDIS_DATABASE` | Optional | `0`. |
| `PORT` | ✅ Set | `8080`, where Apache listens. |

**After the first boot.** Change the password, title and cache settings in the admin panel; the variables only seed a new site.

**Security.** Keep the core, admin and plugins updated from the admin panel, use a strong password, and turn on two-factor authentication in your admin user settings.

**Custom domain.** Add your domain to the Grav service in Railway and redeploy; HTTPS certificates are issued automatically.

**Email.** Install and configure the Email plugin with an SMTP provider for contact forms and password resets.

---

## Grav vs. Alternatives

| | Grav on Railway | WordPress | Ghost | Hugo (static) |
|---|---|---|---|---|
| **Monthly cost** | ~$5–10 usage | Hosting plus database | Hosting or Ghost(Pro) | Static hosting |
| **Database needed** | ✅ None | ❌ MySQL | ❌ MySQL | ✅ None |
| **Browser admin panel** | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |
| **Content as Markdown files** | ✅ Yes | ❌ No | ⚠️ Markdown in DB | ✅ Yes |
| **Themes and plugins** | ✅ Hundreds | ✅ Thousands | ⚠️ Themes | ⚠️ Themes |
| **Easy Git versioning** | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
| **License** | ✅ MIT | ✅ GPL-2.0 | ✅ MIT | ✅ Apache-2.0 |

---

## Dependencies for Grav Hosting

- Railway account. Hobby is enough for most sites.
- Optional: an SMTP provider for contact forms and password recovery.
- Optional: a custom domain for your site.
- Optional: a Git repository if you want to sync content with Git Sync.

### Deployment Dependencies

- [Grav on GitHub](https://github.com/getgrav/grav): source code and releases
- [Grav documentation](https://learn.getgrav.org): content, themes and plugins
- [grav-railway](https://github.com/gridalpha/grav-railway): the Railway image used here
- [Railway Volumes](https://docs.railway.com/volumes): how the site persists

### Implementation Details

The image is built from `getgrav/grav:php8.4` with the latest Grav release unpacked at build time, so the first boot works offline and the same way every time. Apache is configured to listen on Railway's `PORT`. A new volume is seeded from the image; an existing one is never overwritten, so your content and updates stay put. Back up the volume before major Grav upgrades.

Redis runs with a password and only on Railway's private network. Clear Grav's cache from the admin dashboard at any time; with Redis, clearing the cache never touches your content.

---

## Frequently Asked Questions

**What is Grav?**
An MIT-licensed flat-file CMS that stores pages as Markdown files and settings as YAML, with a browser admin panel and no database.

**How much does it cost?**
About $5–10/month on Railway for Grav and Redis at typical traffic.

**How do I sign in?**
Go to `/admin` and use `admin` with the `GRAV_ADMIN_PASSWORD` from the Grav service's Variables.

**Where is my content stored?**
On the Railway volume at `/var/www/html`, as Markdown, YAML and media files. Each page is a folder holding its Markdown file and images. Back up the volume or sync it to Git.

**Do I need Redis?**
It's optional for Grav but included here as a fast cache. Without it, Grav falls back to its own file or memory cache.

**Can I change the admin password later?**
Yes, in the admin panel. Changing the variable after the first boot has no effect.

---

## Why Deploy and Host Grav 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 Grav on Railway, you get a fast, database-free website with an admin panel and persistent storage, for a small flat monthly cost.


## Similar templates

- [Libredesk - Complete Setup](https://railway.com/deploy/libredesk-complete-setup) — Complete self-hosted omnichannel customer support desk.
- [Paperless-ngx](https://railway.com/deploy/paperless-ngx-3) — Paperless-ngx — document management with OCR and full-text search
- [Instatic CMS - Postgres](https://railway.com/deploy/instatic-cms-postgres) — Design, build and manage powerful static sites from state-of-the-art CMS

Open this page in a browser: https://railway.com/deploy/grav-flat-file-cms
