Get Started in 5 Minutes
This guide walks you through deploying a complete Moodle LMS instance using ipMoodle’s automated deployment script.Prerequisites: Docker and Docker Compose installed on your system. See Prerequisites for details.
Installation Steps
Configure Environment Variables
Set your site URL and database credentials:The deployment script will automatically generate a
.env file with these values:Run the Deployment Script
Make the script executable and run it:The script performs three automated stages:
The first build takes 3-5 minutes as Docker compiles PHP extensions. Subsequent builds use cached layers and are much faster.
Access Moodle
Once deployment completes, you’ll see:Open your browser and navigate to your
SITE_URL. You’ll see the Moodle installation wizard.Complete Moodle Setup
Follow the Moodle web installer:
- Choose language: Select your preferred language
- Database configuration: Use these values:
- Database type:
PostgreSQL - Host:
db - Database name: Value of
DB_NAME(default:moodle) - Username: Value of
DB_USER(default:moodle) - Password: Value of
DB_PASS(default:moodle)
- Database type:
- Confirm paths:
- Web address: Your
SITE_URL - Moodle directory:
/var/www/html - Data directory:
/var/www/moodledata
- Web address: Your
- Create admin account: Set up your Moodle administrator credentials
- Site configuration: Configure site name, description, and settings
The database host is
db (not localhost) because it references the Docker Compose service name.What Just Happened?
The deployment script automated the following:Environment File
Generated
.env with your configuration variablesDocker Image
Built custom PHP 8.2-FPM image with Moodle extensions
Four Containers
Started database, app, cron, and web services
Moodle Code
Downloaded and extracted Moodle 4.3 into
./htmlPermissions
Set correct ownership for www-data user
Network
Created isolated
moodle-net bridge networkVerify Your Deployment
Check that all services are running:All containers should show
Up status. If any container is restarting, check logs with docker compose logs <service>.Understanding the Stack
Your Moodle instance runs on four interconnected services:Service Details
Database (db)- Image:
postgres:16-alpine - Data: Persisted to
./db_data - Network: Internal
moodle-net
- Image: Custom PHP 8.2-FPM build
- Code: Mounted from
./html - Uploads: Mounted to
./moodledata - Environment: Database credentials from
.env
- Image: Same as app container
- Purpose: Runs Moodle’s
admin/cli/cron.phpevery minute - Command:
- Image:
nginx:alpine - Ports:
80:80(maps host port 80 to container) - Config: Custom FastCGI configuration from
nginx/default.conf
File Structure
After deployment, your directory structure looks like:Next Steps
Configure PHP Settings
Adjust memory limits, upload sizes, and execution timeouts
Set Up SSL/HTTPS
Secure your Moodle instance with TLS certificates
Backup & Restore
Learn how to protect your data with regular backups
Monitoring
Monitor container health and resource usage
Common Commands
Troubleshooting
Port 80 already in use
Port 80 already in use
If another service is using port 80, modify Then access Moodle at
docker-compose.yml:http://localhost:8080.Moodle shows blank page
Moodle shows blank page
Check PHP-FPM logs:Common causes:
- Database connection failed (check
DB_*variables) - File permissions incorrect (run permission commands from deploy.sh)
- PHP fatal error (check logs for stack trace)
Database connection refused
Database connection refused
Ensure the database container is running:Verify database credentials match in
.env and Moodle config:Cron not running
Cron not running
Check the cron container logs:Verify the crontab is installed:Expected output:
*/1 * * * * /usr/local/bin/php /var/www/html/admin/cli/cron.phpFor more detailed troubleshooting, see Troubleshooting Guide.