Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3ee5d17
setup etc/hosts in roofts and add post-routing rule to catch requests…
0div Sep 2, 2025
55f0854
add comment explaining why we use a reserved IP address
0div Sep 2, 2025
423fb4b
golangci-lint
0div Sep 2, 2025
cbc7313
* inatroduce sandbox event proxy & handlers
0div Sep 3, 2025
15c81d2
Merge branch 'main' of https://github.com/e2b-dev/infra into setup-ne…
0div Sep 3, 2025
519c344
Merge branch 'main' of https://github.com/e2b-dev/infra into handle-s…
0div Sep 3, 2025
b653e4b
pass eventstore through new Sandbox interfaces
0div Sep 3, 2025
d73aea7
address context changes
0div Sep 3, 2025
b7d9dc8
add consts for event proxy port
0div Sep 4, 2025
b33479d
fix consts import
0div Sep 4, 2025
46e20cd
refactor event proxy instantiation, naming and default handler
0div Sep 4, 2025
2391dde
start event proxy server in main
0div Sep 4, 2025
08da808
rename event store args for readability
0div Sep 4, 2025
114f7e5
Merge branch 'main' of https://github.com/e2b-dev/infra into handle-s…
0div Sep 8, 2025
eff9dcf
Merge branch 'main' of https://github.com/e2b-dev/infra into setup-ne…
0div Sep 8, 2025
6748272
pass event address fc mmdds in orchestrator
0div Sep 9, 2025
37b4b5b
use new mmds event address field in envd and replace any pre-exsiting…
0div Sep 9, 2025
2834798
update consts
0div Sep 9, 2025
dc6f850
merge network prereqs branch (setup-networking-in-sandbox-for-events-…
0div Sep 9, 2025
226cf06
revert to TEST-NET-3 ip; gofumpt
0div Sep 9, 2025
9416004
Merge branch 'main' of https://github.com/e2b-dev/infra into handle-s…
0div Sep 9, 2025
5a16351
remove changes from setup-networking-in-sandbox-for-events-endpoint-e…
0div Sep 9, 2025
4d3c870
remove eventaddress from mmds
0div Sep 9, 2025
736edce
make fmt
0div Sep 9, 2025
870168a
add missing envd files
0div Sep 9, 2025
91373c3
make tidy
0div Sep 9, 2025
efe9dd6
go mod tidy in integration
0div Sep 9, 2025
7a86264
make tidy
0div Sep 10, 2025
aa76ab9
Merge branch 'handle-sandbox-events-at-the-orchestrator-level-e2b-296…
0div Sep 11, 2025
24e22bf
adapt to new tracer changes
0div Sep 11, 2025
02a8beb
Merge branch 'main' of https://github.com/e2b-dev/infra into handle-s…
0div Sep 11, 2025
ba09801
return error if redis-client is nil in ip setter
0div Sep 11, 2025
30b0af3
add redis url to integration tests env vars
0div Sep 11, 2025
93c674a
setup redis in start-services action
0div Sep 11, 2025
54833de
add noop impl. of event interfaces
0div Sep 11, 2025
7b5d6ee
fix merge conflict with main
0div Sep 12, 2025
4c96bff
remove unused pubsub
0div Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/actions/start-services/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,20 @@ runs:
make -C packages/clickhouse migrate-without-build
shell: bash

- name: Run Redis
run: |
echo "REDIS_URL=localhost:6379" >> .env.test

docker run -d --name redis -p 6379:6379 redis:7.4.2-alpine
shell: bash

- name: Start Services
env:
ENVD_TIMEOUT: "60s"
ORCHESTRATOR_SERVICES: "orchestrator,template-manager"
SANDBOX_ACCESS_TOKEN_HASH_SEED: "abcdefghijklmnopqrstuvwxyz"
TEMPLATE_MANAGER_HOST: "localhost:5008"
REDIS_URL: "localhost:6379"
ARTIFACTS_REGISTRY_PROVIDER: "Local"
STORAGE_PROVIDER: "Local"
ENVIRONMENT: "local"
Expand Down
2 changes: 1 addition & 1 deletion packages/api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ require (
golang.org/x/mod v0.25.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sync v0.15.0
golang.org/x/sync v0.17.0
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/time v0.11.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions packages/api/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/client-proxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ require (
golang.org/x/crypto v0.39.0 // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/tools v0.34.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions packages/client-proxy/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/db/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ require (
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.26.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 // indirect
Expand Down
4 changes: 2 additions & 2 deletions packages/db/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/docker-reverse-proxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ require (
github.com/rogpeppe/go-internal v1.13.1 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/text v0.26.0 // indirect
)
4 changes: 2 additions & 2 deletions packages/docker-reverse-proxy/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/envd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/mod v0.25.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/tools v0.34.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions packages/envd/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/orchestrator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
go.opentelemetry.io/otel/sdk/metric v1.36.0
go.opentelemetry.io/otel/trace v1.36.0
go.uber.org/zap v1.27.0
golang.org/x/sync v0.15.0
golang.org/x/sync v0.17.0
golang.org/x/sys v0.33.0
google.golang.org/grpc v1.73.0
google.golang.org/protobuf v1.36.6
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestrator/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions packages/orchestrator/internal/consts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package internal

import (
"github.com/e2b-dev/infra/packages/shared/pkg/env"
)

const (
// Private IP don't leave the sandbox through the network bridge, so we use a reserved IP address for it:
// See TEST-NET-3 on https://en.wikipedia.org/wiki/Reserved_IP_addresses
defaultSandboxEventIP = "203.0.113.0"
defaultEventProxyPort = "5010"
)

func GetSandboxEventIP() string {
return env.GetEnv("SANDBOX_EVENT_IP", defaultSandboxEventIP)
}

func GetEventProxyPort() string {
return env.GetEnv("SANDBOX_EVENT_PROXY_PORT", defaultEventProxyPort)
}
2 changes: 1 addition & 1 deletion packages/orchestrator/internal/events/events_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
)

type EventsService[T any] interface {
type EventService[T any] interface {
HandleEvent(ctx context.Context, event T)
Close(ctx context.Context) error
}
12 changes: 6 additions & 6 deletions packages/orchestrator/internal/events/mock_events_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import (
"context"
)

// MockEventsService implements EventsService interface for testing
type MockEventsService[T any] struct {
// MockEventService implements EventsService interface for testing
type MockEventService[T any] struct {
HandleEventFunc func(ctx context.Context, event T) error
CloseFunc func(ctx context.Context) error
}

func NewMockEventsService[T any]() *MockEventsService[T] {
return &MockEventsService[T]{
func NewMockEventsService[T any]() *MockEventService[T] {
return &MockEventService[T]{
HandleEventFunc: func(ctx context.Context, event T) error { return nil },
CloseFunc: func(ctx context.Context) error { return nil },
}
}

func (m *MockEventsService[T]) HandleEvent(ctx context.Context, event T) error {
func (m *MockEventService[T]) HandleEvent(ctx context.Context, event T) error {
return m.HandleEventFunc(ctx, event)
}

func (m *MockEventsService[T]) Close(ctx context.Context) error {
func (m *MockEventService[T]) Close(ctx context.Context) error {
return m.CloseFunc(ctx)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package events

import (
"context"
)

// NoopSandboxEventProxy is a simple Noop that doesn't do anything
type NoopSandboxEventProxy struct{}

func NewNoopSandboxEventProxy() *NoopSandboxEventProxy {
return &NoopSandboxEventProxy{}
}

func (m *NoopSandboxEventProxy) Start() error {
// No-op
return nil
}

func (m *NoopSandboxEventProxy) Close(ctx context.Context) error {
// No-op
return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package events

import (
"context"

"github.com/e2b-dev/infra/packages/shared/pkg/events/event"
)

// NoopSandboxEventsService is a simple Noop that doesn't do anything
type NoopSandboxEventsService struct{}

func NewNoopSandboxEventsService() *NoopSandboxEventsService {
return &NoopSandboxEventsService{}
}

func (m *NoopSandboxEventsService) HandleEvent(ctx context.Context, event event.SandboxEvent) {
// No-op
}

func (m *NoopSandboxEventsService) Close(ctx context.Context) error {
// No-op
return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package events

import (
"context"
"time"
)

// NoopSandboxEventStore is a simple Noop that doesn't do anything
type NoopSandboxEventStore struct{}

func NewNoopSandboxEventStore() SandboxEventStore {
return &NoopSandboxEventStore{}
}

func (m *NoopSandboxEventStore) SetSandboxIP(ctx context.Context, sandboxID string, sandboxIP string) error {
// No-op
return nil
}

func (m *NoopSandboxEventStore) GetSandboxID(ctx context.Context, sandboxIP string) (string, error) {
// No-op
return "", nil
}

func (m *NoopSandboxEventStore) DelSandboxIP(ctx context.Context, sandboxIP string) error {
// No-op
return nil
}

func (m *NoopSandboxEventStore) GetLastEvent(ctx context.Context, sandboxID string) (*SandboxEvent, error) {
// No-op
return nil, nil
}

func (m *NoopSandboxEventStore) GetLastNEvents(ctx context.Context, sandboxID string, n int) ([]*SandboxEvent, error) {
// No-op
return nil, nil
}

func (m *NoopSandboxEventStore) AddEvent(ctx context.Context, sandboxID string, event *SandboxEvent, expiration time.Duration) error {
// No-op
return nil
}

func (m *NoopSandboxEventStore) DelEvent(ctx context.Context, sandboxID string) error {
// No-op
return nil
}

func (m *NoopSandboxEventStore) Close(ctx context.Context) error {
// No-op
return nil
}
Loading
Loading