Skip to content

Migrate kolibri-server into platforms/debian-server - #14998

Merged
rtibbles merged 247 commits into
learningequality:developfrom
rtibblesbot:issue-14964-43bb0a
Jul 15, 2026
Merged

Migrate kolibri-server into platforms/debian-server#14998
rtibbles merged 247 commits into
learningequality:developfrom
rtibblesbot:issue-14964-43bb0a

Conversation

@rtibblesbot

@rtibblesbot rtibblesbot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

kolibri-server (nginx + uwsgi front end for Kolibri) has lived in a standalone repo, versioned independently at 0.5.x and built against a released Kolibri. This imports its full history under platforms/debian-server/ as a uv workspace member so it resolves kolibri from the workspace, and binds its .deb version to the Kolibri version via a generated debian/changelog (0.5.x0.19.x, monotonic so apt upgrades cleanly). It is the first publishing platforms/ member under the monorepo consolidation, following the Pi image's co-location pattern.

The code migration, workspace/version wiring, and the full CI/release-pipeline integration have all landed.

References

Part of #14964 (tracked under #13720). Source repository: https://github.com/learningequality/kolibri-server. Follows the platforms/ pattern from #14967.

Changes:

  • Import kolibri-server subtree with preserved history, scrub credentials
  • Wire debian-server as a uv workspace member
  • Bind the .deb version to Kolibri via a generated changelog
  • Prune migrated tree — collapse duplicated PR scaffolding, pass monorepo pre-commit
  • Migrate the Launchpad release workflow into the monorepo
  • Build server's .deb in pr_build_kolibri.yml against the PR's Kolibri
  • Install the built server .deb into the Pi image
  • Add a server serving smoke test to the PR build (replacing installtest.yml)
  • Add server pytest tests/ as a Stage-2 platform test matrix row

Reviewer guidance

  • pyproject.toml [tool.uv.workspace] — the platforms/* glob carries an exclude for raspberry-pi (no pyproject.toml); confirm uv sync --group dev --all-packages resolves cleanly and doesn't narrow the lock's Python floor via the member's requires-python.
  • platforms/debian-server/scripts/generate_changelog.py debian_upstream_version — verify PEP440 pre-release/dev versions get a ~ prefix so dpkg --compare-versions sorts them before the final (the upstream sed this replaces was a no-op); finals must munge to identity.
  • platforms/debian-server/pyproject.toml — the member is virtual (package = false, no build-system); confirm it is never treated as a wheel target and that kolibri = { workspace = true } is the only kolibri source.

AI usage

Used Claude Code to execute the pre-approved migration plan task-by-task (subtree import via git filter-repo, workspace wiring, changelog generator) under test-driven development. Verified with the member's pytest tests/, uv sync --all-packages, ruff, and dpkg-parsechangelog/dpkg --compare-versions in an Ubuntu container.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks
@rtibblesbot

🟡 Waiting for feedback

Last updated: 2026-07-15 04:17 UTC

jredrejo and others added 30 commits January 3, 2019 20:21
…bot/github_actions/actions/checkout-7

build(deps): Bump actions/checkout from 6 to 7
@github-actions github-actions Bot added DEV: backend Python, databases, networking, filesystem... SIZE: very large labels Jul 13, 2026
@rtibblesbot
rtibblesbot marked this pull request as ready for review July 13, 2026 00:54
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you opened the PR when more than half of the criteria are incomplete? Finish the work before asking for review.

@github-actions github-actions Bot added the DEV: dev-ops Continuous integration & deployment label Jul 13, 2026
@rtibblesbot

Copy link
Copy Markdown
Contributor Author

You're right — the PR was opened prematurely with only the code-migration and workspace-integration tasks done. The remaining acceptance criteria are now complete:

Publish / release pipeline

  • platform-debian-server-release.yml: Launchpad path only, workflow_dispatch-only (dropped the release: published auto-trigger), both GitHub Pages jobs removed. check_version no longer does the now-tautological tag-vs-changelog check — it refuses to publish a dev/local Kolibri build (.dev/+git/+local) to the PPA.

Build / validation CI

  • server_deb builds the .deb in pr_build_kolibri.yml, versioned to the PR's Kolibri (parsed from the whl job's tar artifact).
  • The Pi image installs that built .deb from file (no more apt-get install kolibri-server); the external apt source is removed.
  • A non-blocking server_smoke_test installs both PR-built debs and asserts Kolibri is served through nginx/uWSGI. The blocking smoke_tests gate still needs only the WHL jobs.
  • platform_tests runs the member's pytest tests/ as a Stage-2 matrix row, listed in stage2_required_checks.needs.
  • Redundant nested scaffolding (member pre-commit/dependabot/python-test/pre-commit-CI configs) removed; release.yml and installtest.yml lifted then deleted.

prek run passes over the migrated tree with no per-file ignores, and the member's pytest suite passes locally (50 passed, 3 dpkg-guarded skips). The server deb build and serving smoke test can only be exercised on CI, since the dev host has no dpkg.

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some concerns remain. Readme is inaccurate and the raspberry pi build seems to have been setup to no longer allow updates in the future.

RUN mkdir -p /etc/apt/keyrings
INSTALL 644 files/learningequality.asc /etc/apt/keyrings/learningequality.asc
INSTALL 644 files/learningequality-kolibri.sources /etc/apt/sources.list.d/
INSTALL 644 files/learningequality-kolibri-server.sources /etc/apt/sources.list.d/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why has this been removed? We still want it to be updated after installing, the same as the Kolibri base debian file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored in 473a40e. I had conflated two things: switching the initial install to the PR-built .deb did not require dropping the APT source. The source is back, so the Pi still upgrades kolibri-server from the released repo on later apt updates, exactly as it does for the kolibri deb (whose learningequality-kolibri.sources was always kept). The build-time install of the PR-built .deb is unchanged; only the update path is fixed.

@@ -1,5 +0,0 @@
Types: deb

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly for this file being deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored in 473a40e — recreated platforms/raspberry-pi/files/learningequality-kolibri-server.sources and its INSTALL in base.Pifile, so the released APT source is available for post-install upgrades.

Comment thread platforms/debian-server/README.rst Outdated
#. If you have further changes, you can keep editing and invoking ``make dist``
#. Finally, commit your changes and open a PR, including your entry in ``debian/changelog``

Pre-commit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is out of date and should be removed in favour of the repo prek config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a7d1903. Removed the standalone Pre-commit section (with its pip install pre-commit / pre-commit install steps) and pointed the dev workflow at the monorepo prek config instead (prek install at the repo root; see AGENTS.md).

Comment thread platforms/debian-server/README.rst Outdated
Automated release workflow
~~~~~~~~~~~~~~~~~~~~~~~~~~

Publishing a GitHub release triggers the ``build_debian.yml`` workflow, which:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is out of date. We should delete and correct information in the README.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a7d1903. Rewrote the release section to match the migrated pipeline: it no longer claims a GitHub-release-triggered build_debian.yml, but describes the workflow_dispatch-only platform-debian-server-release.yml — publishable-version gate (refuses dev/local builds), changelog generated from the Kolibri version rather than validated against a release tag, always-on manual approval, no Pages job. Also corrected the stale gh workflow run build_debian.yml / "Build Debian source package" trigger instructions.

@rtibbles rtibbles self-assigned this Jul 14, 2026

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generally good to go - let's cleanup the commit history that has been added (leaving the historic commit history from the original repository completely intact), there's a lot of flip flopping encoded in the commit history that we don't need.

@rtibblesbot

Copy link
Copy Markdown
Contributor Author

Cleaned up the migration commit history. The 19 flip-flopping commits I had added are now 8 logical commits, one per migration task:

  1. Wire debian-server as a uv workspace member
  2. Bind the kolibri-server .deb version to Kolibri
  3. Drop debian-server scaffolding the monorepo already provides
  4. Migrate the Launchpad release pipeline into the monorepo
  5. Build the kolibri-server .deb in the PR build
  6. Install the PR-built kolibri-server .deb into the Pi image
  7. Add a kolibri-server serving smoke test to the PR build
  8. Run kolibri-server pytest as a Stage-2 platform test row

The flip-flopping is gone — the Pi APT-source remove-then-restore, the changelog --output flag add-then-drop, the KOLIBRI_VERSION flag-vs-env churn, and the incremental smoke-test/changelog fixups are all folded into the commit they belong to.

The imported repository history and the merge commit (aaa1dea7c8) are completely untouched; git blame on the migrated files still points at the original authors. The rebuilt tree is byte-identical to the previous tip, so no content changed — only the commit grouping.

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one more thing - let's clean up the matrix and just do a single job while it's needed.

Commit history still feels a bit untidy, so let's clean it up again once this has been done.

Comment thread .github/workflows/tox.yml Outdated
KOLIBRI_HOME: .kolibri
run: uv run python -O -m pytest --reuse-db
platform_tests:
name: ${{ matrix.name }} tests

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not getting expanded properly when the job matrix gets skipped.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 22eeaae. The job is now a plain single job (debian_server_tests) with a static name: kolibri-server tests, so the check name no longer depends on ${{ matrix.name }} and resolves correctly even when the job is skipped by the pre_job/stage1 guard.

Comment thread .github/workflows/tox.yml Outdated
needs: [pre_job, stage1_required_checks]
if: ${{ needs.pre_job.outputs.should_skip != 'true' && needs.stage1_required_checks.result == 'success' }}
runs-on: ubuntu-latest
strategy:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this warrants a matrix for a single entry. Let's simplify it to a single job until its warranted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 22eeaae. Collapsed the single-entry matrix into a plain job (debian_server_tests), inlining the one row: Python 3.10 pinned directly and distro-info installed unconditionally. stage2_required_checks.needs and the docs/howtos/python_monorepo.md guidance were updated to match — a future second platforms/ member can reintroduce a matrix when one is warranted.

rtibblesbot and others added 8 commits July 14, 2026 21:05
Register the migrated kolibri-server tree as a virtual uv workspace
member: add kolibri as a workspace-resolved dependency, floor
requires-python to the root range, and pick it up in `uv sync
--all-packages` and ruff. Conform the imported sources to the monorepo
ruff config (dropping the member's own ruff block) and remove the
dormant, unused vcrpy scaffolding the suite never exercised.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the independent 0.5.x scheme with a `debian/changelog`
generated from the Kolibri version at build time. Add
`scripts/generate_changelog.py` (with a PEP440->Debian upstream-version
conversion so pre-releases sort before the final) and wire it into the
Makefile's `changelog` target, reading the version from
`KOLIBRI_VERSION` in the environment and falling back to `import
kolibri`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The filter-repo import carried in the standalone repo's own
pre-commit config, dependabot config, and pre-commit/python-test CI
workflows. All are superseded by the monorepo's repo-wide equivalents,
and nested `.github/` is ignored by GitHub Actions, so remove them.
Also correct the now out-of-date release and pre-commit sections of the
server README to point at the monorepo prek config and the
workflow_dispatch release pipeline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lift the standalone `release.yml` to
`.github/workflows/platform-debian-server-release.yml`: trigger on
`workflow_dispatch` only (dropping the release-published auto-trigger),
remove the GitHub Pages PPA jobs, keep the full Launchpad DAG (build ->
dput -> wait -> copy-to-series -> manual approval -> promote), gate on a
publishable (non-dev/local) Kolibri version, and target the changelog at
the runner's series directly instead of sed-patching it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a reusable `platform-debian-server-build_deb.yml`
(`workflow_call`) and a `server_deb` sibling of the `deb` job in
`pr_build_kolibri.yml`, so every PR builds the server .deb from
`platforms/debian-server/` versioned to that PR's Kolibri (parsed from
the whl job's tar artifact). The build runs `make deb` so the nginx
error/loading pages are generated, and excludes the tests directory from
the source tarball.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stage the freshly-built server .deb into the Pi image and install it
from file (mirroring how kolibri's own deb is installed), passing it
through the PR build DAG and the reusable Pi build workflow. The
released kolibri-server APT source is kept in place so the Pi still
upgrades kolibri-server from the repo on later apt updates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the standalone install-only `installtest.yml` matrix with a
non-blocking `server_smoke_test` job that installs both PR-built debs,
starts kolibri-server, and asserts Kolibri is served through nginx/uwsgi
(treating any 5xx as not-yet-ready while polling). The served port is
sourced once from nginx.conf. It stays out of the blocking
`smoke_tests` gate, matching the Pi smoke test precedent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a `platform_tests` matrix job in tox.yml that runs the member's
`pytest tests/` on its pinned Python with the `distro-info` system
dep, and list it in `stage2_required_checks.needs` so it blocks merge.
Note the new `platforms/*` workspace glob and the shared matrix in the
python-monorepo how-to.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rtibbles
rtibbles merged commit 7b1faa9 into learningequality:develop Jul 15, 2026
83 checks passed
@rtibblesbot
rtibblesbot deleted the issue-14964-43bb0a branch July 15, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DEV: backend Python, databases, networking, filesystem... DEV: dev-ops Continuous integration & deployment SIZE: very large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants