# Self-host Moodle

> A widely used, highly customizable learning management system for online courses.

- Page: https://levelrail.com/templates/moodle/
- JSON: https://levelrail.com/templates/moodle.json
- Category: Applications
- Licence: GPL-3.0-or-later (Copyleft license)
- Source: https://github.com/moodle/moodle
- Upstream docs: https://moodle.org

## Requirements
- Memory: about 1 GiB
- amd64: published, arm64: published
- Needs configuration before start: no
- Pinned image tag: 11.1

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| mariadb | mariadb | 11.1 | none | moodle_mariadb_data -> /var/lib/mysql |
| moodle | docker.io/bitnamilegacy/moodle | 4.3 | 8080 | moodle_data -> /bitnami/moodle; moodledata_data -> /bitnami/moodledata |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| mariadb | MYSQL_DATABASE | preset |
| mariadb | MYSQL_PASSWORD | generated |
| mariadb | MYSQL_ROOT_PASSWORD | generated |
| mariadb | MYSQL_USER | preset |
| moodle | ALLOW_EMPTY_PASSWORD | preset |
| moodle | MOODLE_DATABASE_HOST | preset |
| moodle | MOODLE_DATABASE_NAME | preset |
| moodle | MOODLE_DATABASE_PASSWORD | generated |
| moodle | MOODLE_DATABASE_PORT_NUMBER | preset |
| moodle | MOODLE_DATABASE_USER | preset |
| moodle | MOODLE_EMAIL | preset |
| moodle | MOODLE_PASSWORD | generated |
| moodle | MOODLE_SITE_NAME | preset |
| moodle | MOODLE_USERNAME | preset |

## Deploy

### CLI

```bash
levelrail-cli templates deploy moodle --name my-moodle
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/moodle/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## Questions

### Can I deploy Moodle on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Moodle, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image mariadb:11.1, docker.io/bitnamilegacy/moodle:4.3 is what you deploy there.

Self-host Moodle, Moodle docker compose file, deploy Moodle on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
