Тип сервиса
Сервис Moodle (buildable)
Среда выполнения PHP для Moodle, собранная из вашего Git-репозитория, в котором закреплён релиз Moodle и добавлены ваши плагины и темы.
Этот сервис запускает ваш код: его образ собирается из Git-репозитория, а каждая сборка развёртывается в окружение.
На этой странице
В StackMaster
Как Moodle (buildable) работает в StackMaster
Image
The service runs the prebuilt wodby/moodle image: one Moodle release with its Composer packages on PHP-FPM 8.4, in /var/www/html. There is no build and no source repository. New Moodle point releases arrive as new image revisions through service updates; the next deployment upgrades the database.
Moodle's code can't be changed: plugins and themes can't be added, and installing them from Moodle's web interface is turned off ($CFG->disableupdateautodeploy), because the image replaces the code on every deployment.
Settings file
The image's config.php takes every setting from the container's environment:
- Database.
DB_HOST,DB_PORT,DB_NAME,DB_USERNAMEandDB_PASSWORDfrom thedblink.DB_KINDselects Moodle's driver:mariadb,mysqlifor MySQL, orpgsql. Tables use themdl_prefix unlessMOODLE_DB_PREFIXis set. When the linked server has a CA certificate (DB_SSL_CA), Moodle connects over TLS; PostgreSQL also verifies the server against that certificate. - Address.
$CFG->wwwrootisMOODLE_WWWROOTwhen set, otherwise the app's main route (WODBY_PRIMARY_URL, which the container gets throughrouteMetadata). With anhttps://address,$CFG->sslproxyis on, because TLS ends before the request reaches Nginx. Moodle answers on that one address only: requests for another domain of the app are redirected to it. A new main route takes effect when the service is redeployed. - Data.
$CFG->datarootisMOODLE_DATAROOT,/mnt/files/moodledataon the shared volume.$CFG->localcachediris/tmp/moodle-localcache, inside each container. - Sessions. With a Redis or Valkey service linked as
redis, sessions are stored there (REDIS_HOST,REDIS_PORT,REDIS_PASSWORD, key prefixmoodle_sess_). Otherwise they are files in the data directory. - Router.
$CFG->routerconfiguredis on: the Moodle Nginx service sends requests for unknown paths tor.php. - Locked settings.
$CFG->disableupdateautodeployand$CFG->preventexecpathare on. - Mail. Moodle sends mail with PHP's
mail(), which the image delivers to thesendmaillink (MSMTP_HOST,MSMTP_PORT).
Data
The moodledata volume is mounted at /mnt/files and shared by every replica and the cron worker through the linked storage service. Uploaded files, the file-based caches and the temporary directory are kept there. The database holds everything else.
Cron
The moodle-cron derivative runs the image's moodle-cron, which keeps Moodle's cron running: each php admin/cli/cron.php --keep-alive=900 run polls for tasks for 15 minutes and the next run follows. Until Moodle is installed, cron fails and is tried again a minute later. On stop, the current task finishes first.
Installation and upgrades
Moodle's web installer is not used. After every deployment the service's Install or upgrade Moodle action runs the image's moodle-update:
- First deployment: it installs Moodle into the empty database with
admin/cli/install_database.php. The administrator is created from the service's settings:admin-username(defaultadmin, variableMOODLE_ADMIN_USERNAME),admin-password(required, secret,MOODLE_ADMIN_PASSWORD) andadmin-email(optional,MOODLE_ADMIN_EMAIL). The site's full and short names are the app's title and name (MOODLE_SITE_FULLNAME,MOODLE_SITE_SHORTNAME); both can be changed in Moodle later. - A password that doesn't meet Moodle's password policy must be changed at the first sign-in. Without an admin email, Moodle asks for it at the first sign-in.
- Without an admin password, the action fails and asks for one; nothing is installed.
- Later deployments: it runs
php admin/cli/upgrade.php --non-interactive. The upgrade turns maintenance mode on while it runs. - The installer never runs over existing tables: if the database can't be read, the action fails instead.
- Changing the admin settings after the first deployment does not change the account; change it in Moodle.
Actions
- Purge all caches runs
php admin/cli/purge_caches.php.
PHP settings
The image sets max_input_vars to 5000, as Moodle requires, limits uploads and form posts to 256 MB, matching the Nginx service, and turns zend.exception_ignore_args on, so stack traces don't show argument values. In production environments PHP doesn't display errors.
Limits
- Moodle 5.3 needs MariaDB 11.4 or later, MySQL 8.4 or later or PostgreSQL 17 or later.
- It has no development workspace.
Check the result
- Site administration > Server > Environment shows Moodle's own checks.
php admin/cli/cfg.php --name=versionprints the installed version; it fails before installation.- The deployment's post-deploy log shows the install or upgrade output.
php admin/cli/cron.php --listin the cron worker lists the tasks running now.
Buildable Moodle on Wodby
This service is the moodle service built from the app's repository: its guidance applies to settings, data, cron, installation and upgrades. This page covers what differs.
Image
The image is built from the app's Git repository on top of wodby/moodle-php: PHP-FPM with the same Wodby setup as the prebuilt Moodle image (config.php, moodle-update, moodle-cron, PHP settings), but no Moodle. The service's versions are PHP versions. Start the repository from the Moodle boilerplate. It holds:
.moodle-version: the Moodle release to run, such as5.3.1, required. Moodle 5.1 and later 5.x releases are supported.public/: the app's plugins and themes at their place in Moodle'spublic/tree, such aspublic/local/myplugin.
The repository's pipeline runs wodby ci run -- moodle-install-release before wodby ci build. In the build directory it downloads the release from Moodle's GitHub tag, installs its Composer packages, adds the repository's public/ files and Wodby's config.php, and replaces everything else. It fails when a file in public/ is already part of Moodle, so Moodle's own code is never replaced. The PHP image and the Nginx service are then built from the same directory, so Nginx serves the plugins' files. The image build fails when Moodle is missing, for example when the pipeline doesn't run moodle-install-release.
Moodle's version changes only when the repository changes it: new image revisions bring PHP and Wodby's scripts, not a new Moodle. Upgrading Moodle means changing .moodle-version and deploying; the deployment upgrades the database.
Plugins
After every deployment the Install or upgrade Moodle action runs moodle-update, as the moodle service does. Moodle's upgrade installs plugins that are new in the repository and upgrades those whose version.php version went up. Uninstall a plugin in Moodle's administration before removing it from the repository.
Installing plugins from Moodle's web interface stays turned off: the code is part of the image.
Cron
The moodle-buildable-cron worker runs the app's own image, so cron tasks of the repository's plugins run too.
Обзор
Технический профиль Moodle (buildable)
Версии
Основан на
Репозиторий исходного кода
Публичный Helm-чарт
Постоянные тома
Стеки
Стеки, в которые входит Moodle (buildable)
CI/CD
Сборка Moodle (buildable) из Git-репозитория
Vanilla Moodle
Используйте его как есть или клонируйте в свой Git-аккаунт.
wodby/moodle-boilerplateCI-провайдеры
StackMaster CI встроен в платформу: пайплайн описывается в файле .wodby/pipeline.yml в репозитории. Для подключённого репозитория те же шаги может выполнять внешний CI-провайдер с помощью StackMaster CLI.
Реестры контейнеров
Собранные образы по умолчанию попадают в StackMaster Registry или во внешний реестр, подключённый как интеграция.
Переменные окружения из интеграций
Интеграция с переменными один раз сохраняет учётные данные стороннего сервиса. Подключите её к Moodle (buildable), и StackMaster передаст их в контейнер как переменные окружения во время работы, а не при сборке образа.
Конфигурация
Конфигурация сервиса Moodle (buildable)
Тома
Настройки
Действия
Связи сервиса
Каждая связь — это подключение Moodle (buildable) к другому сервису. На какой сервис указывает связь, задаёт стек. На карточках перечислены публичные сервисы, которые подходят для каждой связи.
db
Сервисы, которые подходят для этой связи
sendmail
Сервисы, которые подходят для этой связи
moodledata
Сервисы, которые подходят для этой связи
redis
Сервисы, которые подходят для этой связи