Skip to content

feat!: rebuild proxy with multistore and cloudflare workers runtime#116

Merged
alukach merged 44 commits intomainfrom
refactor/multistore-readonly
Mar 24, 2026
Merged

feat!: rebuild proxy with multistore and cloudflare workers runtime#116
alukach merged 44 commits intomainfrom
refactor/multistore-readonly

Conversation

@alukach
Copy link
Copy Markdown
Contributor

@alukach alukach commented Mar 17, 2026

What I'm changing

Pushed by a recent spike of high ALB egress bills, this PR swaps out the data proxy for a data proxy written with multistore. This allows us to deploy the data proxy onto Cloudflare Workers, thereby pushing all egress charges directly to S3 and in line with the AWS Open Data Program.

This is a read-only proxy, write operations will be added at a later date.

How I did it

Deployed to Cloudflare Workers. We're currently serving ~4M requests per day and are seeing an error rate of ~0.001%

Custom URLs

Obtaining custom URLs without migrating all of the source.coop DNS settings over the Cloudflare was a bit of a challenge. I opted to host the proxy workers on coolnewgeo.com (an unused domain owned by Radiant Earth):

  • data.coolnewgeo.com - prod
  • staging.data.coolnewgeo.com - staging

Custom Hostnames have been set up under coolnewgeo.com for data.source.coop and data.staging.source.coop, both pointing to a null fallback origin of fallback.coolnewgeo.com (which has a DNS A record pointing to 192.0.2.1).

Configured routes on the workers connect these custom hostnames to each worker environment:

routes = [
{pattern = "data.source.coop/*", zone_name = "coolnewgeo.com"},
{pattern = "a.data.source.coop/*", zone_name = "coolnewgeo.com"},
{pattern = "b.data.source.coop/*", zone_name = "coolnewgeo.com"},
{pattern = "c.data.source.coop/*", zone_name = "coolnewgeo.com"},
{pattern = "d.data.source.coop/*", zone_name = "coolnewgeo.com"},
]

[env.staging]
routes = [
{pattern = "data.staging.coolnewgeo.com/*", zone_name = "coolnewgeo.com"},
{pattern = "data.staging.source.coop/*", zone_name = "coolnewgeo.com"},
]

How to test it

This has been running in production for the past week and is used by https://source.coop.

PR Checklist

  • This PR has no breaking changes.
  • I have updated or added new tests to cover the changes in this PR.
  • This PR affects the Source Cooperative Frontend & API,
    and I have opened issue/PR #XXX to track the change.

Related Issues

TODO

  • Setup autodeploy for staging on merges to main
  • Setup autodeploy for production on releases
  • Setup autodeploy for PRs

currently reducing the data proxy to read-only anonymous access
alukach and others added 8 commits March 17, 2026 23:26
…ath-mapping crates

Replace 6 boilerplate source files (worker_backend, worker_infra,
fetch_connector, noop_creds, tracing_layer, routing) and their test
with imports from the new multistore-cf-workers and multistore-path-mapping
crates. The XML list rewriting is now handled by multistore core via
MappedRegistry's display_name and ListRewrite.

Files deleted:
- src/worker_backend.rs (WorkerBackend -> multistore-cf-workers)
- src/worker_infra.rs (JsBody, response helpers -> multistore-cf-workers)
- src/fetch_connector.rs (FetchConnector -> multistore-cf-workers)
- src/noop_creds.rs (NoopCredentialRegistry -> multistore-cf-workers)
- src/tracing_layer.rs (WorkerSubscriber -> multistore-cf-workers)
- src/routing.rs (path parsing -> multistore-path-mapping + simplified lib.rs)
- tests/routing.rs (covered by multistore-path-mapping tests)

Source reduced from 9 files / ~1,520 lines to 3 files / ~700 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract request classification logic from lib.rs into src/routing.rs
- Add comprehensive tests in tests/routing.rs (31 tests total)
- Move wasm-only deps to target-specific dependencies so tests run natively
- Remove unused _method param from classify_request
- Add request-level debug logging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alukach alukach marked this pull request as ready for review March 23, 2026 23:09
@alukach alukach changed the title refactor!: rework proxy to use multistore on cloudflare workers runtime refactor!: rebuild proxy with multistore and cloudflare workers runtime Mar 23, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

🚀 Latest commit deployed to https://source-data-proxy-pr-116.source-coop.workers.dev

  • Date: 2026-03-24T02:43:33Z
  • Commit: 32e0394

@alukach alukach changed the title refactor!: rebuild proxy with multistore and cloudflare workers runtime feat!: rebuild proxy with multistore and cloudflare workers runtime Mar 24, 2026
@alukach alukach merged commit 3e07478 into main Mar 24, 2026
12 checks passed
@alukach alukach deleted the refactor/multistore-readonly branch March 24, 2026 02:48
alukach pushed a commit that referenced this pull request Mar 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.0.0](v1.1.0...v2.0.0)
(2026-03-26)


### ⚠ BREAKING CHANGES

* rebuild proxy with multistore and cloudflare workers runtime
([#116](#116))

### Features

* add Analytics Engine request logging
([#119](#119))
([d9ab62f](d9ab62f))
* rebuild proxy with multistore and cloudflare workers runtime
([#116](#116))
([3e07478](3e07478))


### Bug Fixes

* deserialize before caching
([295b965](295b965))
* Return 502 on API error instead of empty list
([d0ff1f0](d0ff1f0))
* scrutinise list type more closely
([d63e4f8](d63e4f8))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: source-release-bot[bot] <265100246+source-release-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant