infra icon indicating copy to clipboard operation
infra copied to clipboard

Handle internal sandbox events from sandboxes in orchestrator

Open 0div opened this issue 4 months ago • 4 comments

Description

Setup networking in sandbox for events endpoint and handle sandbox events at the orchestrator level.

  • [x] implement sandbox event proxy server to capture http requests to events endpoints inside sandboxes
  • [x] create handler abstraction
  • [x] map sandboxIPs-to-sandboxIDs
  • [x] introduce consts.go file in orchestrator and add the sandbox event IP and port

Test

[infra]
$ make build-and-upload/envd # with mmds changes 
$ make build-and-upload/template-manager # with changes from https://github.com/e2b-dev/infra/pull/1107
$ make build-and-upload/orchestrator # with changes from this PR 
$ make plan
$ make apply 

[E2B/template/base]
$ e2b template build

[Sandbox]
user@e2b:~$ cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::  ip6-localnet
ff00::  ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 e2b.local
203.0.113.0 events.e2b.dev 

$ e2b sbx sp base
user@e2b:~$ curl -X POST http://events.e2b.dev/proc -d '{ "pid": 123 }'

{"event_ack": true }

0div avatar Sep 03 '25 00:09 0div

@sitole @dobrac , i made the /etc/hosts update dynamically with new MMDS event address field. I tried a few IPs from local link range (169.254.0.1, 169.254.0.7) but it doesn't work, so i kept it to TEST-NET-3 IP for now

0div avatar Sep 09 '25 02:09 0div

@sitole once https://github.com/e2b-dev/infra/pull/1107 is merged, i can add integration test here

0div avatar Sep 11 '25 22:09 0div

https://github.com/e2b-dev/infra/pull/1107 is merged so we can rebase this one. Probably you can build on top of https://github.com/e2b-dev/infra/pull/1233 that adds gin http server for hyperloop server.

sitole avatar Sep 22 '25 13:09 sitole