---
title: "Deploy Moodle"
description: "Moodle 5.3.1 LMS with Postgres: auto-installed, cron, persistent storage"
category: "CMS"
url: https://railway.com/deploy/moodle-2
---

# Deploy Moodle

Moodle 5.3.1 LMS with Postgres: auto-installed, cron, persistent storage

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

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

- **Creator:** Agaz Self-Host
- **Category:** CMS
- **Total deploys:** 2

## Template content

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

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

### Moodle https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/moodle.png

- **Source:** https://github.com/aalfath/moodle-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host Moodle on Railway

Moodle is the open-source learning management system used by schools, universities and companies to run online courses. Teachers build courses with lessons, quizzes, assignments, forums and grades, and learners take part from a browser or the Moodle mobile app. It is written in PHP and licensed under GPL-3.0.

## About Hosting Moodle

This template runs Moodle 5.3.1 (latest stable) on PHP 8.4 and Apache, built from a public GitHub repo, with Railway's PostgreSQL. On first boot, the start script installs Moodle from the command line and creates the `admin` user with a generated password. The web installer is never exposed. Uploaded files and course backups live on a volume at `/var/www/moodledata`, and all other data lives in Postgres. Moodle's cron runs every minute inside the container. `/healthz` checks PHP and the database. After a version update, the database upgrade runs on its own at start.

## Common Use Cases

* Online courses and blended learning for schools, colleges and universities
* Employee onboarding, compliance and skills training inside a company
* Selling or sharing courses with quizzes, certificates and progress tracking

## Dependencies for Moodle Hosting

* PostgreSQL 17 or newer (Railway's Postgres is included)
* A volume for Moodle's data directory (included)

### Deployment Dependencies

* [Moodle 5.3 release notes and requirements](https://moodledev.io/general/releases/5.3)
* [Moodle documentation](https://docs.moodle.org/503/en/Main_page)
* [Template source: aalfath/moodle-railway-template](https://github.com/aalfath/moodle-railway-template)

### Implementation Details

**After deploy:** the first boot takes 3 to 4 minutes while Moodle installs. Until then the site shows "Moodle is starting". Then open the public URL and log in as `admin`. The password is `MOODLE_ADMIN_PASSWORD` in the Moodle service's Variables tab. Change it in Moodle after your first login, and set the admin email under your profile.

**Variables:** none to fill in. `MOODLE_URL` defaults to `https://${{RAILWAY_PUBLIC_DOMAIN}}`. If you add a custom domain, set it to `https://YOUR-DOMAIN` and redeploy. Optional variables, read only on the first install: `MOODLE_ADMIN_USER`, `MOODLE_ADMIN_EMAIL`, `MOODLE_SITE_NAME`, `MOODLE_SITE_SHORTNAME` and `MOODLE_LANG`.

**Email:** to send email (password resets, notifications), set up SMTP in Moodle under Site administration &gt; Server &gt; Email &gt; Outgoing mail configuration.

**Updates:** version bumps land in the template repo with a changelog entry, and Railway shows an "update available" notice on your project. Back up Postgres before you apply a major version. Plugins installed through the web UI would be lost on redeploy, so that installer is turned off. To add plugins, fork the repo and add them to the Dockerfile.

## Why Deploy Moodle 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 Moodle 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

- [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/moodle-2
