Skip to content

chore: move websocket proxy #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

danyalprout
Copy link
Contributor

@danyalprout danyalprout commented May 6, 2025

Description

Initial pass for #202

  • This PR moves the websocket proxy code from base/flashblocks-websocket-proxy into this repo.
  • Added 2615ec4 to combine the CI Github Actions into the workflow (I'll add the release one separately)
  • Added 7e9bdfc to fix a clippy issue

danyalprout and others added 28 commits February 23, 2025 15:12
feat: initial project setup
chore: add support for hostname prometheus tag and global tags
Support Multiple Upstream WebSocket Connections for HA Setups
* feat(PROTO-945): implement Redis-based rate limiting and update dependencies

- Added RedisRateLimit for distributed rate limiting, allowing connection tracking across multiple instances.
- Updated Cargo.toml to include new dependencies for Redis and related packages.
- Enhanced README with Redis integration instructions and usage examples.
- Modified main.rs to support Redis configuration via command-line arguments.
- Updated Cargo.lock with new package versions and dependencies.

* Add redis-tools to github action for test runs
fix: parse multiple upstream url
* reset redis counters on boot

* updates to use heartbeat/cleanup mechanism for tracking

* pr comment updates, add tests, move sempahore
…0c24ec2'

git-subtree-dir: websocket-proxy
git-subtree-mainline: 7f64a27
git-subtree-split: 3135bb9
Copy link

vercel bot commented May 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rollup-boost ⬜️ Ignored (Inspect) Visit Preview May 7, 2025 3:24pm

@danyalprout danyalprout marked this pull request as ready for review May 6, 2025 21:44
Comment on lines +30 to +54
Builds of the websocket proxy [are provided](https://github.com/base/flashblocks-websocket-proxy/pkgs/container/flashblocks-websocket-proxy).
The only configuration required is the rollup-boost URL to proxy. You can set this via an env var `UPSTREAM_WS` or a flag `--upstream-ws`.


You can see a full list of parameters by running:

`docker run ghcr.io/base/flashblocks-websocket-proxy:master --help`

### Redis Integration

The proxy supports distributed rate limiting with Redis. This is useful when running multiple instances of the proxy behind a load balancer, as it allows rate limits to be enforced across all instances.

To enable Redis integration, use the following parameters:

- `--redis-url` - Redis connection URL (e.g., `redis://localhost:6379`)
- `--redis-key-prefix` - Prefix for Redis keys (default: `flashblocks`)

Example:

```bash
docker run ghcr.io/base/flashblocks-websocket-proxy:master \
--upstream-ws wss://your-sequencer-endpoint \
--redis-url redis://redis:6379 \
--global-connections-limit 1000 \
--per-ip-connections-limit 10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update the image URLs when I add the docker deployment and have new images

@danyalprout
Copy link
Contributor Author

The CI issue for contender is fixed in #204

Copy link
Collaborator

@0xKitsune 0xKitsune left a comment

Choose a reason for hiding this comment

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

Since we are adding another service independent from rollup-boost, I think its best to restructure the repo to use Cargo workspaces. This will provide a clean separation between services/dependencies.

@danyalprout
Copy link
Contributor Author

Thanks for looking @0xKitsune, happy to add it as a workspace setup if ya'll prefer.

cc @ferranbt if I understood, you had a preference to keep them separate/just add a subfolder? (Though I may have misunderstood)

@0xKitsune
Copy link
Collaborator

0xKitsune commented May 8, 2025

Happy to add it as a workspace setup if ya'll prefer

Sounds good, yeah I think a workspace would be best here rather than standalone crates. Workspaces will simplify dependency management across services without duplicating deps in Cargo.toml or needing to keep versions in sync. It also makes the repo a bit more maintainable as more components get added. Lmk if I am overlooking something here but my preference would be to go with workspaces.

Comment on lines +6 to +7
pull_request:

Copy link
Collaborator

@0xKitsune 0xKitsune May 8, 2025

Choose a reason for hiding this comment

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

Is there a benefit to run this workflow on all PRs or can we update to only run on PRs to main?

@@ -0,0 +1,308 @@
mod test {
Copy link
Collaborator

@0xKitsune 0xKitsune May 8, 2025

Choose a reason for hiding this comment

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

Wdyt about moving integration tests to a tests/ dir? This way it looks like the integration feature flag can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants