---
title: Deploy Moodle with AI on Blossom
url: "/deploy/moodle/"
canonical_url: https://blossom88.com/deploy/moodle/
markdown_url: https://blossom88.com/deploy/moodle.md
summary: Create a Moodle course, give a learner a quiz, and keep the grade after a
  Container replacement.
categories:
- deployment
- learning
stack:
- PHP
- Apache
- PostgreSQL
---

# Deploy Moodle with AI on Blossom

[Moodle](https://moodle.org/) is a learning management system for courses,
assignments, quizzes, and grades. Start with a one-question quiz and see
what an enrolled learner sees.

## Ask Your Agent

> **Ask your AI agent:** Deploy Moodle on Blossom and help me make a short course with a quiz.
>
> Follow this guide: https://blossom88.com/deploy/moodle/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and choose a Blossom Cloud Location when you log in. You can also use [Blossom BYOC (bring your own cloud)](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#blossom-byoc).

## How It Runs

| Part | Role | Where |
|---|---|---|
| Moodle | Serve courses, quiz attempts, and course files | Blossom Persistent Service |
| PostgreSQL | Store users, courses, attempts, and grades | Blossom Managed Data |
| Volume | Keep the Moodle data directory and course uploads | Blossom Persistent Capacity |

## Deploy Moodle

Use managed PostgreSQL and one [Persistent Service](/docs/apps/persistent-services/)
with a Volume for Moodle’s data directory. Keep Blossom Account access
enabled while you set up the site. Have an administrator email ready.

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

Build from this [Dockerfile](/deploy/recipes/moodle/Dockerfile) and keep
its [configuration](/deploy/recipes/moodle/config.php),
[installer](/deploy/recipes/moodle/bootstrap.php), and
[startup script](/deploy/recipes/moodle/launcher-start.sh) alongside it.
The tested build used Moodle 5.3.1 LTS with PHP 8.4 and Apache. Link
managed PostgreSQL as `DATABASE_URL` and use a private
`MOODLE_ADMIN_PASSWORD` and `MOODLE_ADMIN_EMAIL` for first boot.

Expose port 80 through Blossom’s HTTPS endpoint. Moodle uses
`BLOSSOM_SERVICE_URL` as its canonical address unless `MOODLE_WWWROOT`
is set. Apache serves Moodle’s `public` directory and `/data/moodledata`
stays on the Volume. The startup script runs Moodle’s background tasks
alongside Apache. Keep one writer and keep both the database and Volume
when updating. Use Moodle’s [upgrade process](https://docs.moodle.org/503/en/Upgrading_Moodle)
for version changes.

</details>

<details class="optional-reading" markdown="1">
<summary>Commands your agent runs</summary>

    blossom app_plan:preview --data moodle-plan.yml
    blossom environment:update --id environment-100 --data moodle-source.yml
    blossom service:create --data moodle-web.yml
    blossom environment:deploy --id environment-100 --follow

</details>

## Give a Learner a Quiz

Sign in as the administrator. Create a course, add a **Quiz** activity,
and give a sample learner the Student role in that course. Sign in as the
learner, answer the question, and submit the attempt to see the grade.

![Answer the workshop readiness quiz as a learner.](/deploy/assets/images/moodle/moodle-quiz.webp)

> **Ask your AI agent:** Make a sample course with a one-question quiz. Enroll a test learner and check the grade after they submit it.

> Follow this guide: https://blossom88.com/deploy/moodle/



## Reopen the Grade on a New Container

Replace the Moodle Container while keeping the PostgreSQL link and Volume.
Sign in again as the same learner and open their original attempt.

![Review the same submitted quiz and grade after Container replacement.](/deploy/assets/images/moodle/moodle-grade.webp)


> **Ask your AI agent:** Replace the Moodle Container and check that the learner can still open the same quiz attempt and grade.

> Follow this guide: https://blossom88.com/deploy/moodle/



## What You Get

- A private Moodle site with a course and an enrolled learner
- A submitted quiz with a grade the learner can review
- Course data kept across Container replacements

Tested on Blossom: A learner submitted a quiz and reopened the original graded attempt after a different Moodle Container started.
