Skip to content
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

Replace Nginx based session proxy with orchestrator proxy #417

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

Conversation

sitole
Copy link
Member

@sitole sitole commented Mar 11, 2025

Implements http proxy in orchestrator that replaces current nginx-based session proxy that is using dns server from orchestrator to route traffic.

  • Legacy Nginx session-proxy is intact and can still be used as it is, next step will be remove it when traffic migrated
  • Orchestrator proxy for now runs on port 5007 allowing smooth deployment
  • Support for pretty (for browsers) and json error messages when port in sandbox not listening
  • Proxy settings is taken from currently used client-proxy, so should be already battle-tested

@sitole sitole added the improvement Improvement for current functionality label Mar 11, 2025
@sitole sitole self-assigned this Mar 11, 2025
Copy link

linear bot commented Mar 11, 2025

@sitole sitole marked this pull request as ready for review March 11, 2025 16:34
@sitole sitole force-pushed the merge-session-proxy-to-orchestrator-e2b-1752 branch from de6b900 to 3f945bd Compare March 11, 2025 16:45
@ValentaTomas
Copy link
Member

Right now (for the deployment) we will have both proxies running at the same time?

@sitole
Copy link
Member Author

sitole commented Mar 11, 2025

Right now (for the deployment) we will have both proxies running at the same time?

Yea, both are running but for traffic new one is used. Actually it's just change of the port in client-proxy.

Comes to my mind, if you think its somehow invasive we can for example route traffic to now one just for some teams / enable it with some feature flag to enable quick revert. Request proxy is done in context where we know about exact client so gives us big space.

@sitole sitole force-pushed the merge-session-proxy-to-orchestrator-e2b-1752 branch from 3f945bd to 37893d3 Compare March 12, 2025 10:06
@sitole sitole requested a review from dobrac as a code owner March 12, 2025 10:06
@sitole sitole force-pushed the merge-session-proxy-to-orchestrator-e2b-1752 branch from 90e639d to 96c3425 Compare March 13, 2025 11:19
@sitole
Copy link
Member Author

sitole commented Mar 13, 2025

Related to 96c3425 commit

Reverts change that routed traffic to orchestrator proxy. After internal discussion we decided that we want to implement orchestrator proxy and then try to add feature-flags to enable it, but its dedicated to separated request.

Just if you want to test changes its needed to revert this commit, without it traffic will float via session-proxy instead.

@sitole sitole force-pushed the merge-session-proxy-to-orchestrator-e2b-1752 branch 2 times, most recently from bacbce6 to a8bbdd6 Compare March 13, 2025 13:04
Copy link
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

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

I think there's some problem with RPC after this change (I changed the port in client proxy). I can write / read files from sandbox (uses HTTP server). But I can't start command etc..

@sitole sitole force-pushed the merge-session-proxy-to-orchestrator-e2b-1752 branch from 2366375 to 31163b7 Compare March 17, 2025 14:21
@ValentaTomas
Copy link
Member

@sitole Building up to what @jakubno encountered—running the E2B SDK test suite (and also potentially the code interpreter tests) against your staging with might be a good early test for similar functionality.

@sitole sitole force-pushed the merge-session-proxy-to-orchestrator-e2b-1752 branch from 31163b7 to 3330b9f Compare March 18, 2025 14:41
@sitole sitole force-pushed the merge-session-proxy-to-orchestrator-e2b-1752 branch from 3330b9f to 709dd69 Compare March 18, 2025 14:42
@sitole
Copy link
Member Author

sitole commented Mar 18, 2025

With commit 3330b9f i fixed issue were envd randomly responds with connection reset by peer.
Disabling connections keep-alive on new proxy resolved issue.

I noticed current nginx session-proxy is missing keepalive setup (https://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive) and it looks like default value for missing keep-alive statement is empty, so keep-alive is disabled. That makes sense why current solution worked until now.

I don't like idea to disabling it just because envd complains. Iam mostly concerned about how this can affect traffic. Sure, keepalive was already disabled, but iam not sure if this behave exactly matches nginx vs golang http-proxy one.

I will continue with finding some relevant docs about golang http.server and handling idle connections.

cc @ValentaTomas @jakubno

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

Successfully merging this pull request may close these issues.

4 participants