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. As explained in the Clever Cloud cron documentation, to have access to environment variable, you must wrap your commands in a bash script with login shell (bash -l
).
Add a cron.sh
file to the root of the application:
#!/bin/bash -l
cd ${APP_HOME}
php admin/cli/cron.php
And make it executable:
chmod u+x cron.sh
Declare the cron in Clever Cloud
Create a clevercloud/cron.json
file with a string to run cron.sh
every minute:
[
"* * * * * $ROOT/cron.sh"
]
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.
🎓 Further Help
See Moodle installation documentation for further help and development configuration.
Did this documentation help you ?