Skip to content

Commit 3d2eb1d

Browse files
committed
wip self hosting linux machine
1 parent 89cd0ad commit 3d2eb1d

File tree

6 files changed

+110
-162
lines changed

6 files changed

+110
-162
lines changed

deployment/self-hosting.mdx

Lines changed: 0 additions & 154 deletions
This file was deleted.

docs.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,14 @@
4949
]
5050
},
5151
{
52-
"group": "Deploy E2B",
52+
"group": "Infrastructure",
5353
"pages": [
54-
"deployment/byoc",
55-
"deployment/self-hosting"
54+
"infrastructure/architecture",
55+
"infrastructure/self-hosting",
56+
"infrastructure/byoc"
5657
]
5758
}
5859
]
59-
},
60-
{
61-
"anchor": "SDK Reference",
62-
"icon": "square-terminal",
63-
"href": "https://external-link.com/blog"
6460
}
6561
]
6662
},

infrastructure/architecture.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: "Architecture"
3+
description: "E2B infrastructure architecture overview"
4+
icon: "sitemap"
5+
---
6+
7+
8+
What services are needed to run E2B self-hosting?
9+
10+
11+
## Topics
12+
- Security
13+
14+
- Virtualization isolation
15+
- Using Firecracker over Docker
File renamed without changes.

infrastructure/self-hosting.mdx

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: "Self-Hosting"
3+
description: "Deploy E2B to your own cloud infrastructure"
4+
icon: "server"
5+
---
6+
7+
Self-hosting E2B allows you to deploy and manage the whole E2B open-source stack on your own infrastructure.
8+
This gives you full control over your sandboxes, data, and security policies.
9+
10+
We are currently officially supporting self-hosting on Google Cloud Platform (GCP) with Amazon Web Services (AWS), and on-premise support is coming soon.
11+
12+
<Note>
13+
If you are looking for a managed solution, consider our [Bring Your Own Cloud](/infrastructure/byoc) offering that will
14+
bring you the same security and control with the E2B team managing infrastructure for you.
15+
</Note>
16+
17+
## Google Cloud Platform
18+
19+
## Linux Machine
20+
All E2B services are AMD64 compatible and ready to be deployed on Ubuntu 22.04 machines.
21+
Tooling for on-premise clustering and load-balancing is **not yet officially supported**.
22+
23+
### Service images
24+
25+
For running E2B core, you need to build and deploy **API**, **Edge (client-proxy)**, and **Orchestrator** services.
26+
This will work on any Linux machine with Docker installed. Orchestrator is built with Docker but deployed as a static binary, because it needs precise control over the Firecracker MicroVMs in the host system.
27+
28+
Building and provisioning services can be similar to what we do with Google Cloud Platform builds and Nomad jobs setup.
29+
Details about architecture can be found in our [architecture](/infrastructure/architecture) sections.
30+
31+
### Client machine setup
32+
33+
#### Configuration
34+
35+
The Orchestrator (client) machine requires a precise setup to spawn and control Firecracker-based sandboxes.
36+
This includes a correct OS version installed (Ubuntu 22.04) with KVM. It's possible to run KVM with nested virtualization, but there are some performance drawbacks.
37+
38+
Most of the configuration can be taken from our client [machine setup script](https://github.com/e2b-dev/infra/blob/main/packages/cluster/scripts/start-client.sh).
39+
There are adjustments for the maximum number of inodes, socket connections, NBD, and huge pages allocations needed for the MicroVM process to work properly.
40+
41+
#### Static binaries
42+
43+
There is a need for a few files and folders to be present on the machine.
44+
For correctly working sandbox spawning, you need to have Firecracker, Linux kernel, and Envd binaries.
45+
We are distributing a pre-built one in the public Google Cloud bucket.
46+
47+
```bash
48+
# Access publicly available pre-built binaries
49+
gsutil cp -r gs://e2b-prod-public-builds .
50+
```
51+
52+
Static files and folder setup example. Please replace Linux and Firecracker with the versions you want to use.
53+
Ensure you use the same Linux and Firecracker versions for both sandbox build and spawning.
54+
55+
```bash
56+
sudo mkdir -p /orchestrator/sandbox
57+
sudo mkdir -p /orchestrator/template
58+
sudo mkdir -p /orchestrator/build
59+
60+
sudo mkdir /fc-envd
61+
sudo mkdir /fc-envs
62+
sudo mkdir /fc-vm
63+
64+
# Replace with the source where you envd binary is hosted
65+
# Currently, envd needs to be taken from your source as we are not providing it.
66+
sudo curl -fsSL -o /fc-envd/envd ${source_url}
67+
sudo chmod +x /fc-envd/envd
68+
69+
SOURCE_URL="https://storage.googleapis.com/e2b-prod-public-builds"
70+
KERNEL_VERSION="vmlinux-6.1.102"
71+
FIRECRACKER_VERSION="v1.12.1_d990331"
72+
73+
# Download Kernel
74+
sudo mkdir -p /fc-kernels/vmlinux-${KERNEL_VERSION}
75+
sudo curl -fsSL -o /fc-kernels/${KERNEL_VERSION}/vmlinux.bin ${SOURCE_URL}/kernels/${KERNEL_VERSION}/vmlinux.bin
76+
77+
# Download Firecracker
78+
sudo mkdir -p /fc-versions/${FIRECRACKER_VERSION}
79+
sudo curl -fsSL -o /fc-versions/${FIRECRACKER_VERSION}/firecracker ${SOURCE_URL}/firecrackers/${FIRECRACKER_VERSION}/firecracker
80+
sudo chmod +x /fc-versions/${FIRECRACKER_VERSION}/firecracker
81+
```

security.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "Security"
3+
description: "xxxx"
4+
icon: "shield"
5+
---
6+
7+
???
8+
Why we are not using Docker (E2B vs Docker Containers)
9+
Jailer, Firecracker, Virtualization
10+
BYOC link (for additional data residency needs)

0 commit comments

Comments
 (0)