Skip to content

obc data v2 · P4 — The VPS follows the bucket; service code deploys separately #2652

Closed

Description

@timohueser

Part of #2648. Read the epic first: it holds the model and the decisions.

Goal

Publishing data needs only R2 and one HTTPS request: no SSH and no outage. A rollback is instant. Deploying service code is a separate, rare step.

Scope

  1. obc data serve prod runs on the VPS as one systemd service. It extends the P3 program:

    • it polls planner/next.json and planner/catalog.json over public HTTPS, so it needs no R2 credentials;
    • it downloads the objects of a new release (routing package, search databases, offline bundles) and verifies each digest;
    • it starts that release's services beside the current ones;
    • it answers GET /planner-api/releases/<id>/ready;
    • it keeps the serving release and the rollback running, and stops older ones.
  2. One stable route. The follower is the only reverse proxy behind Caddy for /planner-api/ and /planner-offline/. It sends each request to the process of the release ID in the URL. Caddy is configured once and never rewritten; there are no systemd units per release.

  3. Publisher protocol (P2's update):

    • upload;
    • write planner/next.json;
    • wait at Router ready (up to 24 h, with heartbeat);
    • write planner/catalog.json.

    A dir target skips the wait.

  4. Format check. Each service binary reports the formats it reads (extend planner-service --obc-build-identity, and add the same to search and downloads). If a release needs a format the installed code cannot read, ready says not ready: needs planner-service with routing format 9, and the publisher waits without changing prod.

  5. Service code deploy. One script, outside obc data, builds the service binaries for the VPS target in data/planner-runtime.toml, copies them and restarts the follower. It runs only when service code changes.

  6. Delete:

    • the VPS install in host/obc-data-steps/src/planner/publish.rs;
    • tools/planner_publish.py, tools/planner_deploy.py, tools/planner_cleanup.py.

    The legacy units (obc-data-planner-*, obc-planner-*-{0,1}) and their Caddy files stay untouched until P8 cuts over.

  7. The tile Worker (planner/tiles) keeps reading the bucket. Check that it serves files of both kept releases.

Acceptance

Run a local test with a bucket served over HTTP:

  • publish, then the follower loads the release, then ready, then the switch;
  • a rollback is instant, with no download;
  • a format mismatch gives not ready, the publisher waits, and prod is unchanged;
  • a third release stops the oldest processes.

Run focused tests for the protocol, plus the suites of each crate you change. Report added and removed lines.

Depends on

P2 and P3.

Activity

  1. timohueser commented on Oct 12, 2026

    @timohueser
    OwnerAuthor

    This follow-up for P4 comes from the P3 review (#2671).

    • obc data serve has no /planner-offline/ route yet. iOS OfflineMapStore hard-codes https://releases.openbikecomputer.com/planner-offline/, so a Debug phone that reads local still downloads offline maps from the published service.
    • P4 makes the follower the only route for /planner-offline/ (scope item 2). So that P3's local override works end to end, iOS should take the offline API from the origin of the catalogue, not from a fixed host.
    • LocalFirstPlanner prefers an installed offline map that covers a request over the online source. A developer who tests local must remove such maps, or the companion README must say this. P3-b adds that sentence.

    Generated by Claude Code

  2. timohueser commented on Oct 12, 2026

    @timohueser
    OwnerAuthor

    P4 is complete in code. Five pull requests did it:

    PR Part Lines
    #2674 P4-b: each planner service names the formats that it reads +150 / −23
    #2676 P4-d: deploy the follower code; delete the legacy planner deploy +297 / −1238
    #2679 P4-a: the follower, obc data serve prod +1096 / −314
    #2684 P4-c: an R2 update switches only after the follower serves the release +738 / −118
    #2686 The follower ends the download of a current release that no release names +43 / −10

    Acceptance, tested with a bucket served over HTTP:

    The follower keeps its objects in its own store and deletes the objects that next, serving and rollback do not read. It deletes them only while no download runs (#2684, #2686).

    Still to do, outside the code: the owner installs the follower on the VPS once, with the steps in tools/vps/README.md (unit, deploy, Caddy route). The legacy routes stay until P8.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestinfraTooling, scaffold, CI, dev harness

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions