kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Migrate kolibri-server into the Python monorepo

Open rtibbles opened this issue 5 months ago • 5 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Migrate kolibri-server from its standalone repo into platforms/ as a uv workspace member. It builds a .deb published to Launchpad PPAs and a GitHub Pages APT repo — not a wheel — so it follows the new platforms/ pattern, not the python_packages/ one used for plugins.

First publishing platform member under #13720, after the Pi image (#14967) established the platforms/ co-location pattern. Follows the completed plugin migrations (#14663 setup, #14666 sentry, #14948 oidc-client, #14949 oidc-provider, #14950 opensearch). Its publish pipeline is the most involved in the tree, so it sets the pattern for members that publish.

Complexity: High (publish CI) · Target branch: develop

Context

kolibri-server runs Kolibri behind nginx + uwsgi for higher-concurrency serving. Standalone repo contains:

  • config: kolibri_server_setup.py, nginx.conf, uwsgi.ini, hashi_uwsgi.ini;
  • debian/ packaging;
  • pyproject.toml at version = "0.0.0";
  • runtime deps launchpadlib + keyring;
  • test deps pytest + vcrpy;
  • scripts/launchpad_copy.py, Makefile, tests/.

The release pipeline (release.yml) is a 9-job DAG, triggered on release: published (tag v<version>) or workflow_dispatch:

  • check_version gates the whole run on the git tag matching debian/changelog (dpkg-parsechangelog).
  • Launchpad path: build a signed source package → dput to ppa:learningequality/kolibri-proposed → wait for binaries → copy to all supported Ubuntu series → manual approval (environment: release) → promote kolibri-proposed → stable kolibri PPA.
  • scripts/launchpad_copy.py drives that path via launchpadlib (check-source, wait-for-published, copy-to-series, promote).
  • GitHub Pages path: build a binary .deb → assemble a reprepro APT repo → deploy to GitHub Pages (environment: github-pages).
  • Secrets/vars: LP_CREDENTIALS (Launchpad OAuth), GPG_SIGNING_KEY + GPG_PASSPHRASE (source signing), DEBIAN_REPO_SIGNING_KEY + vars.DEBIAN_REPO_SIGNING_KEY_ID (Pages repo signing).
  • launchpad.credentials is a private (owner-only) file, never committed.

kolibri-server currently versions independently (0.5.x). It is slated for eventual removal — deployment role being reworked, cf. kolibri-installer-debian#141. The migration is interim: prove the platforms/ pattern without over-investing, but the publish integration still has to keep working.

The Change

  • Move the repo into platforms/debian-server/.
  • Register it as a uv workspace member (shared lockfile), per #14663 — it builds a .deb, never a wheel.
  • Add kolibri = { workspace = true } — kolibri_server_setup.py imports kolibri.utils/kolibri.core, so it resolves kolibri from the workspace.
  • Preserve git history via git filter-repo --to-subdirectory-filter + merge --allow-unrelated-histories.
  • Bind the .deb version to the Kolibri version (it imports kolibri directly, so it's already coupled), generating the changelog from the Kolibri version as debian does.
  • The version moves from 0.5.x to Kolibri's 0.19.x — monotonic, so apt upgrades cleanly.
  • Reconcile the check_version tag↔changelog gate with that binding.
  • Make the release pipeline manual (workflow_dispatch only) for now — drop the release: published auto-trigger.
  • Bring scripts/launchpad_copy.py across, keeping the multi-series copy + proposed→stable promotion working.
  • Carve out the GitHub Pages APT repo: remove the build_binary_package + publish_github_pages_ppa jobs from server's pipeline.
  • Build server's .deb in pr_build_kolibri.yml, a sibling to the kolibri deb job, against the PR's own Kolibri.
  • Install that built server .deb into the Pi image (INSTALL dist/*server*.deb), replacing the apt-get install kolibri-server from the released APT source.
  • Trim installtest.yml to its nginx/uwsgi serving assertion.
  • Run the trimmed server smoke test in pr_build_kolibri.yml's smoke-test block against the built .deb.
  • Collapse duplicated PR scaffolding (pre-commit, pull-request-target) into the monorepo's copies.
  • Prefix-name migrated workflow files (platform-debian-server-*.yml).
  • Add server's pytest tests/ as a row in a new Stage-2 platform Python tests matrix job in tox.yml (shared across platforms/ members), carrying its python-version and distro-info system dep.

Out of Scope

  • Migrating other installers — separate per-repo tasks under #13720.
  • Archiving the source repo.
  • Behavioural changes to the Launchpad path — like-for-like migration (dependency bumps allowed where migration requires).
  • Reworking the supported-Ubuntu-series list.
  • Migrating server's GitHub Pages APT repo — deferred to the APT-domain issue, which uses server's .deb as its low-risk pilot.
  • Deduping the shared Launchpad/changelog tooling — the debian migration consolidates server's and debian's copies.
  • Admin/infra setup (secrets, release environment, keeping the old Pages URL alive) — tracked as admin tasks on #13720.
  • Making the build/validation CI blocking — the WHL smoke-test fan-in remains the sole blocking gate.

Acceptance Criteria

Code migration

  • [ ] Repo content at platforms/debian-server/.
  • [ ] server config (nginx.conf, uwsgi.ini, debian/, scripts/) kept.
  • [ ] pyproject.toml linked to the workspace (kolibri = { workspace = true }).
  • [ ] .deb version bound to the Kolibri version via a generated changelog, replacing the independent 0.5.x scheme.
  • [ ] launchpad.credentials gitignored and absent from the migrated tree's history.
  • [ ] Passes monorepo pre-commit without per-file ignores.
  • [ ] History + git blame preserved via git filter-repo.

Workspace integration

  • [ ] uv workspace member; included by uv sync --group dev --all-packages.
  • [ ] Import name added to known-first-party in root pyproject.toml's ruff isort config.

Publish / release pipeline

  • [ ] The Launchpad path of release.yml runs from the monorepo, triggered manually (workflow_dispatch).
  • [ ] The Pages jobs are excluded (→ APT-domain issue).

Build / validation CI

  • [ ] server's .deb builds in pr_build_kolibri.yml against the PR's Kolibri.
  • [ ] The Pi image installs the built server .deb, not the released one.
  • [ ] The trimmed installtest.yml nginx/uwsgi smoke test runs in pr_build_kolibri.yml's smoke-test block.
  • [ ] server's pytest tests/ runs as a row in the Stage-2 platform Python tests matrix job, in stage2_required_checks's needs:.
  • [ ] Duplicated PR scaffolding collapsed into existing monorepo workflows.

Runtime

  • [ ] The .deb built from platforms/debian-server/ installs and serves Kolibri behind nginx/uwsgi as before.

References

  • Source repository: https://github.com/learningequality/kolibri-server
  • uv workspaces: https://docs.astral.sh/uv/concepts/projects/workspaces/

AI usage

Used Claude Code to draft this issue from the migration-framework design; I drove scope and decisions. Claude read the source repo's release.yml and Makefile to ground the publish-CI details and checked them against the monorepo's conventions.

rtibbles avatar Jul 05 '26 00:07 rtibbles

Plan: Migrate the standalone kolibri-server repo into the Kolibri monorepo at platforms/debian-server/ as a uv workspace member, binding its .deb version to Kolibri, integrating its Launchpad publish pipeline and PR build/smoke-test into the monorepo's CI, while preserving git history.

  • [ ] 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

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

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Jul 12 '26 23:07 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 13 '26 03:07 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 13 '26 07:07 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jul 14 '26 04:07 rtibblesbot

Fixed in #14998

rtibbles avatar Jul 15 '26 04:07 rtibbles