Deploy Moodle
Moodle 5.3.1 LMS with Postgres: auto-installed, cron, persistent storage
Just deployed
/var/lib/postgresql/data
Just deployed
/var/www/moodledata
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
- Moodle documentation
- Template source: 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 > Server > Email > 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.
Template Content