Replies: 4 comments 1 reply
|
So far i can't think of anything wrong with the given plan. :) I will note that a bunch of points from the discussions at PTS are documented here: https://github.com/orgs/cpan-testers/discussions/21 |
Following up to IRC discussion: If there are no special YAML features required, I would rather store it in JSON. |
|
I think this is nearing completion: I've added details on how the SquashFS archiving will work, and how a reverse proxy will be used to do various tricks (canary deployments assuredly, real-time replication possibly). |
|
I've now decided that it would be better to keep the legacy shims separate from new development. This way, the Collector need not depend on CPAN::Testers::Schema and/or other modules that would make it more complex to deploy (MySQL connections and firewall access and API routes, oh my!). Instead, the legacy shim can be updated to copy to the Collector initially, and eventually, forward wholly to the Collector when the MySQL storage of test reports goes away. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The current system for managing the incoming test reports from testers has a few problems:
To have a better separation of concerns, this proposal describes a "CPAN Testers Collector" system. The Collector provides only the following functionality:
In this way, the Collector serves as the primary source of complete reports. Downstream systems can synchronize with the Collector periodically to derive their own data for specific functions like reporting and statistics.
Incoming Reports
The Collector will store reports in plain files, to reduce dependence on external systems. Report data will be stored in a directory path based on the report's UUID in hexadecimal format. The first and second pairs of UUID characters will be used for organizing the files into directories to prevent any single directory from being overly large.
To allow synchronization, the Collector will store lists of UUIDs in files organized using the date/time of the incoming report.
The JSON schema URL should be added to the report in a
$schemaproperty. The schema URL should contain versioning for converting reports to any future JSON schema.Ideally, all reporters would send JSON reports in the current, up-to-date format. In this case, the collector does not need to process the report and can quickly write it to disk. Unfortunately, this will not always be the case, so the collector will handle converting any prior report formats to the current, up-to-date format. In this way, the downstream systems which sync with the collector can have a single format to support for their derived data.
EDIT: Prior versions of this proposal had the Collector handling legacy Metabase formatting. Because the Metabase API requires saved state, the Collector will no longer do that. To implement the Metabase API requires keeping track of users by UUID so their data can be looked up when they submit a report. This is currently done in the MySQL database, and there's no reason to modify this if the preferred end-state is no reporter is using the Metabase API. Instead, the legacy Metabase shim currently in-place can forward the reports it gets to the Collector after doing its own transformation.
Storage Maintenance
The primary storage for reports will be a btrfs filesystem to allow for de-duplication and compression. As reports age, they are collected into squashfs files with increasing compression.
Each squashfs file is mounted, layered, underneath the primary btrfs filesystem. Incoming reports are written to the btrfs filesystem, and a periodic job uses the timestamp indexes to add new reports to their first weekly squashfs file. Individual squashfs files can be mounted to combine into monthly and yearly files. For example:
Every week, a new weekly /mnt/reports-2025-W33 is made from the reports in /mnt/reports-new. Once there are enough of those, they can be used to make a new monthly /mnt/reports-2025-07, and etc... for the yearly archive. There may be some temporary duplication of reports between the weekly and monthly archive files, but this should be no more than a few days' worth of data.
The current storage requirement is projected to be around 1TB for ~15 years of data (all the current system contains). Ideally, the largest SquashFS archive files will still be able to be synced between nodes for backups and replication.
Redundancy
To prevent downtime and protect against data loss, the Collector system and its storage should be replicated to 2 or 3 nodes in separate data centers, geographically distributed. Each node has its own direct DNS entry like
collector-1,collector-2, etc... under thecpantesters.orgdomain.A fastly configuration will be used to load balance incoming requests to active nodes. Nodes will cross-synchronize every few seconds using the timestamp files of the other nodes so that each node maintains a full copy of the data.
Synchronization API
The Collector will expose an HTTP API for listing report UUIDs uploaded during a specified time period. The API will be organized with date/time pieces as path parts. The final path part will also allow commas and ranges to specify multiple periods. The API will only ever return up to 100,000 IDs, sending back an HTTP link header with
rel="next"for where to pick up the next set of results. The API will only ever accept requests with a days part specified: No complete months or years will be allowed.Reverse Proxy
A Varnish proxy will live in front of the collector HTTP service. Varnish is chosen because it is fast, can do live updates, and is also used by Fastly so the configuration can be moved to the CDN if needed. The reverse proxy will mostly be transparent, but may cache some static pages and handle whatever cache validation it can (to prevent load on the collector HTTP service).
The reverse proxy will also enable canary deployments and could potentially do real-time replication of incoming reports to other nodes in the cluster.
Documentation and Discovery
The main
/page of the Collector will provide an informational page about submitting CPAN Testers reports: How to install a client, how to use that client to submit a report, etc... Additionally, it will link to API documentation for developing a CPAN Testers client. This documentation will be a versioned OpenAPI specification that consumes the separately-linked JSON schema that defines the report structure. The URL for these docs must contain the API version, and ideally we will expose an interactive application for testing the collector API.Testing and Debugging
We should provide a
collector-dev.cpantesters.orginstance that users can use for manual or automated testing of CPAN Testers reporters. This non-production system also allows for our own canary deployments: The reverse proxy can copy traffic from production to thecollector-devto test it as needed.All reactions