https://github.com/etherbeing/plus-moodle
https://github.com/etherbeing/plus-moodle
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/etherbeing/plus-moodle
- Owner: etherbeing
- Created: 2026-03-07T08:10:30.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-03-07T12:37:32.000Z (4 months ago)
- Last Synced: 2026-03-07T15:41:23.392Z (4 months ago)
- Language: Shell
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Plus Moodle Automation
This repository treats the Moodle source as a submodule and layers Docker, Docker Compose, Docker Swarm, and GitHub Actions automation on top so you can keep a production-grade instance aligned with `main`.
## Quick start
1. Copy the environment template and fill in the runtime values (or use the helper below):
```bash
./scripts/generate-env.sh
```
This creates `.env` from `.env.example` and populates `MOODLE_ADMIN_PASS`, `DB_PASSWORD`, and `DB_ROOT_PASSWORD` with cryptographically-secure randomness. Pass `--force` to regenerate secrets.
2. Pull the Moodle submodule (defaults to `MOODLE_BRANCH` in `.env`):
```bash
./scripts/update-submodules.sh
```
3. Start the stack locally for dev/testing:
```bash
./scripts/deploy.sh
```
The nginx proxy listens on `127.0.0.1:8080` so you can expose it through your own reverse proxy if needed.
## Deploying to Docker Swarm
1. Install the repo on your Swarm manager and configure the same `.env` values there.
2. Deploy the stack:
```bash
./scripts/deploy-stack.sh [stack-name]
```
If no name is provided it reads `STACK_NAME` from `.env` (default `moodle`).
3. The Swarm stack uses `stack.yml` and publishes only on `127.0.0.1:8080`, making it easy to attach any external proxy.
## GitHub Actions CI/CD
- Pushes to `main` build and push the Docker image to `ghcr.io/${{ github.repository }}` tagged with `latest` plus the commit SHA.
- The `deploy` job SSHs into `SWARM_HOST`, pulls the latest image, and runs `docker stack deploy --with-registry-auth -c stack.yml` using `STACK_NAME` from `.env`.
- Required secrets: `SWARM_HOST`, `SWARM_USER`, `SWARM_SSH_KEY`, `SWARM_PORT`, `SWARM_PROJECT_PATH`, and optional `GHCR_PAT` for private image pulls.
## Environment generation script
`scripts/generate-env.sh` mirrors `.env.example` and uses Python's `secrets` module to populate the admin and database passwords with cryptographically secure values (run with `--force` to regenerate). This keeps deployments from accidentally reusing weak credentials.
## Notes
- `.env.example` documents the values that feed both Compose and Swarm stacks. Keep `MOODLE_IMAGE` pointed at the registry value you push from GitHub Actions.
- The Docker image bundles Moodle's PHP dependencies, Composer, and cron so you can redeploy by simply updating the submodule and reinvoking the automation scripts.