Moodle Installation Wizard
When you first access your Moodle site, you’ll be guided through the installation wizard.Confirm paths
Moodle will auto-detect these paths:
- Web address: Your
SITE_URL - Moodle directory:
/var/www/html - Data directory:
/var/www/moodledata
Database configuration
Enter the database settings (these match your
.env file):| Setting | Value |
|---|---|
| Database type | PostgreSQL |
| Database host | db |
| Database name | moodle (or your DB_NAME) |
| Database user | moodle (or your DB_USER) |
| Database password | moodle (or your DB_PASS) |
| Database port | 5432 |
| Tables prefix | mdl_ |
The database host is
db (not localhost) because containers communicate via Docker network.Review server checks
Moodle will verify that all required PHP extensions are installed. All checks should pass thanks to the custom Dockerfile configuration.
Install database tables
Moodle will create all necessary database tables. This process takes 2-3 minutes.
Configure administrator account
Create the primary admin user:
- Username
- Password
- Email address
- Site name
- Site description
Environment Variables
Your deployment uses these environment variables, configured in the generated.env file:
Core Variables
.env
Application Container Variables
Theapp service receives these environment variables from docker-compose.yml:22-27:
docker-compose.yml
PHP Configuration
The Dockerfile includes optimized PHP settings for Moodle atDockerfile:30-36:
moodle.ini
Customizing PHP Settings
To modify PHP configuration:- Edit the Dockerfile:
Dockerfile
- Rebuild the image:
PHP Settings Explained
PHP Settings Explained
- max_input_vars: Maximum input variables (default 5000 for large forms)
- memory_limit: Maximum memory per request (512M recommended for Moodle)
- upload_max_filesize: Maximum file upload size (512M for large course materials)
- post_max_size: Maximum POST data size (should match or exceed upload limit)
- max_execution_time: Maximum script execution time in seconds (600 = 10 minutes)
Database Configuration
The PostgreSQL container is configured with persistent storage atdocker-compose.yml:3-14:
docker-compose.yml
Accessing the Database
To connect directly to PostgreSQL:Database Backups
Create a backup:Cron Configuration
Moodle requires regular cron execution for maintenance tasks. This is handled automatically by thecron container at docker-compose.yml:36-48:
docker-compose.yml
The cron job runs every minute (
*/1 * * * *), executing Moodle’s maintenance script at /var/www/html/admin/cli/cron.php.Verifying Cron Execution
Check cron logs:- Log in as admin
- Navigate to Site administration → Server → Scheduled tasks
- Check that tasks show recent “Last run” times
File Permissions
The deployment script sets proper permissions atdeploy.sh:32-34:
deploy.sh
User and Group Configuration
The Dockerfile configures thewww-data user at Dockerfile:38:
Dockerfile
UID/GID 82 is the standard for
www-data in Alpine Linux, ensuring consistent file ownership.Fixing Permission Issues
If you encounter permission errors:Volume Mounts
The application uses three persistent volumes:Moodle Code (./html)
docker-compose.yml
Moodle Data (./moodledata)
docker-compose.yml
Database Data (./db_data)
docker-compose.yml
Network Configuration
All containers communicate via themoodle-net bridge network at docker-compose.yml:65-67:
docker-compose.yml
Container Communication
- app → db: Connects using hostname
db - web → app: Connects via FastCGI to
app:9000 - cron → app: Shares same code volumes
External Access
Only theweb container exposes ports to the host at docker-compose.yml:55-56:
docker-compose.yml
Database and application containers are not directly accessible from outside the Docker network, improving security.
Security Configuration
Change Default Credentials
Before exposing to the internet:- Edit
deploy.shand set a strongDB_PASS:
deploy.sh
- If already deployed, update the password:
Update Moodle Config
After changing database credentials, update./html/config.php:
config.php
Enable HTTPS
For production deployments, configure SSL/HTTPS. See SSL/HTTPS Configuration for details.Moodle Configuration File
After installation, Moodle creates./html/config.php with your settings:
config.php
Verifying Configuration
After configuration, verify everything is working:Verify PHP settings
In Moodle:
- Site administration → Server → PHP info
- Verify memory_limit = 512M
- Verify upload_max_filesize = 512M
Next Steps
With configuration complete:- Review Operations for ongoing maintenance
- Set up Backup & Restore procedures
- Configure Monitoring for production
- Explore Advanced Security hardening
Your Moodle installation is now ready for use. Consider setting up automated backups before adding production data.