Skip to content

Moodle 5.1+ integration container fails to boot in CI (public/ dir + composer install + moodlehtml volume copy) #72

Description

@erseco

Problem

The Moodle 5.1.x integration CI leg (added in #62) consistently fails to boot its container: the readiness check logs Couldn't connect to server / Recv failure: Connection reset by peer for the entire wait window and ends with Moodle did not become ready in timeno tests ever run. The established 4.5.5 and 5.0.1 legs boot fine. The 5.2.1 image showed the same symptom earlier. This red leg now blocks every PR.

Root cause

From the container image entrypoint (erseco/alpine-moodle, rootfs/docker-entrypoint-init.d/02-configure-moodle.sh):

Since Moodle 5.1, all web-accessible files are located inside the /public directory.

For Moodle 5.1+ the entrypoint detects /var/www/html/public, rewrites the nginx docroot to /var/www/html/public, and runs composer install at startup. First boot is therefore substantially slower and heavier than for 4.5.x/5.0.x.

On top of that, docker-compose.yml mounts an empty named volume at moodlehtml:/var/www/html. On first boot Docker copies the image's entire /var/www/html tree into that volume before the app is usable — and for 5.1 that tree is larger (public/ + composer vendor/). The copy + composer install exceed even the extended 10-minute readiness window, so the container never reports ready.

Fix

  • Drop the moodlehtml:/var/www/html volume from docker-compose.yml. A CI container runs exactly once (no restart), so persisting the code tree across restarts provides no benefit there; the image is self-contained. Removing it eliminates the slow first-boot image→volume copy entirely. moodledata (uploads/sessions) is kept. This has zero effect on a single CI run's correctness and only changes cross-restart code persistence for local dev, where the code is already sourced from the image on every boot.
  • Dump docker compose logs on readiness timeout in the Makefile upd target, so any future boot failure is diagnosable from the CI log instead of an opaque "did not become ready".

Non-goals

  • Do not change the Moodle image itself (upstream erseco/alpine-moodle).
  • Do not drop the moodledata volume.
  • Do not touch application code or the test suite.

Test plan

Infra-only change (docker-compose + Makefile); no unit-test surface. Verification is the CI integration matrix itself: the 5.1.x leg must boot and run tests (not time out), and 4.5.5/5.0.1 must remain green.

Acceptance criteria

  • moodlehtml volume removed from docker-compose.yml (mount + declaration); YAML still valid.
  • Makefile upd prints recent moodle container logs on readiness timeout.
  • CI: the Moodle 5.1.x integration leg boots and runs the suite (no "did not become ready" timeout).
  • CI: 4.5.5 and 5.0.1 integration legs remain green.
  • No application-code or test changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtestingRelated to test coverage or test infrastructure

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions