Moodle
Moodle is a learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalised learning environments.
This doc explains how to configure Moodle from source. Alternatively, an already configured repository exists as well on Clever Cloud’s GitHub page.
How to Configure and Deploy Moodle on Clever Cloud
Download Moodle
You can download Moodle from https://download.moodle.org and initialize a Git repository at root with git init
.
Configure config.php
Duplicate config-dist.php
and rename it config.php
. Update the following variables as follows:
|
|
Commit changes.
Declare the PHP Application
On Clever Cloud Console, click Create > An application and choose a PHP application with Git deployment. Add a MySQL add-on during the process.
Set Up Environment Variables
Add the following environment variables to tour PHP application:
CC_PHP_VERSION="8"
MAX_INPUT_VARS="5000"
URL="<your-url"
If you don’t have an domain for your Moodle application yet, you’ll be able to add a test domain provided by Clever Cloud in step 6.
Set Up moodledata
Folder
In this step you enable storage outside of your application, which Moodle requires to run. Use a File System Bucket to store all uploaded files and appearance set ups away from the application server, as recommended by Moodle.
Create an FS Bucket add-on and link it to your PHP application. In your FS Bucket dashboard, find the path variable. It should look like this: CC_FS_BUCKET=/some/empty/folder:bucket-<bucket_id>
.
Add this variable to your PHP application and replace /some/empty/folder
by /moodledata
. Don’t forget to update changes.
Set Up Domain
Moodle needs an URL declared in variables to work properly. You can set it up in Domains names, from your PHP application menu. If you don’t have a domain name yet, you can use a cleverapp.io
subdomain provided by Clever Cloud for test purposes.
Don’t forget to update URL="<your-url"
if you haven’t yet.
Deploy
Get the remote in your application menu > Information > Deployment URL and add it to Git with git remote add clever <clever-remote-url>
. Then, push your code with git push clever -u master
💡 If you get a reference error when pushing, try this: git push clever main:master
.
Cron for Moodle
Moodle recommends to set up a Cron job that runs every minute. For the Cron to execute as a PHP file, you will need to add a shebang at the very top of admin/cli/cron.php
, like this: #!/usr/bin/env php
.
Declare the cron in Clever Cloud
Create a clevercloud/cron.json
file with a string to run admin/cli/cron.php
every minute:
[
"* * * * * $ROOT/admin/cli/cron.php"
]
You might encounter errors when the Cron tries to access moodledata
in your FS Bucket. For FS Bucket backups, look for a dedicated tool like rclone.
Note: this repository is already configured to run /admin/cli/cron.php
every minute as a cron job.
🎓 Further Help
See Moodle installation documentation for further help and development configuration.
Did this documentation help you ?