-
Notifications
You must be signed in to change notification settings - Fork 261
fix: AWS self-hosting setup issues #2110
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
Merged
+18
−11
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d3dc3ed
fix: AWS self-hosting setup issues
ya-luotao ccfd2d5
docs: add gsutil-free alternative for copy-public-builds step
ya-luotao 1593051
docs: add missing database migration step for both GCP and AWS
ya-luotao dc44529
docs: address review feedback
ya-luotao d3e2c94
fix: replace gsutil with aws CLI in copy-public-builds for AWS
ya-luotao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,12 @@ Check if you can use config for terraform state management | |
| - e2b-posthog-api-key (optional, for monitoring) | ||
| 9. Run `make plan-without-jobs` and then `make apply` | ||
| 10. Run `make plan` and then `make apply`. Note: This will work after the TLS certificates was issued. It can take some time; you can check the status in the Google Cloud Console | ||
| 11. Setup data in the cluster by running `make prep-cluster` in `packages/shared` to create an initial user, team, and build a base template. | ||
| 11. Run database migrations: `cd packages/db && make migrate` | ||
| > If using Supabase, the first migration (`20000101000000_auth.sql`) will fail because Supabase already provides the `auth` schema, `authenticated` role, and `auth.users` table. To skip it, manually mark it as applied before running `make migrate`: | ||
| > ```sh | ||
| > psql "$POSTGRES_CONNECTION_STRING" -c "INSERT INTO _migrations (version_id, is_applied) VALUES (20000101000000, true);" | ||
| > ``` | ||
| 12. Setup data in the cluster by running `make prep-cluster` in `packages/shared` to create an initial user, team, and build a base template. | ||
| - You can also run `make seed-db` in `packages/db` to create more users and teams. | ||
|
|
||
| ### GCP Troubleshooting | ||
|
|
@@ -140,17 +145,49 @@ Now, you should see the right quota options in `All Quotas` and be able to reque | |
| - `{prefix}supabase-jwt-secrets` - Supabase JWT secret (optional / required for the [E2B dashboard](https://github.com/e2b-dev/dashboard)) | ||
| - `{prefix}grafana` - JSON with `API_KEY`, `OTLP_URL`, `OTEL_COLLECTOR_TOKEN`, `USERNAME` keys (optional, for monitoring) | ||
| - `{prefix}launch-darkly-api-key` - LaunchDarkly SDK key (optional, for feature flags) | ||
| 6. Build Packer AMIs for the cluster nodes: | ||
| 6. Build the Packer AMI for cluster nodes (a single shared AMI used by all node types): | ||
| ```sh | ||
| cd iac/provider-aws/packer | ||
| # Build AMIs for control server, API, client, clickhouse, and build nodes | ||
| cd iac/provider-aws/nomad-cluster-disk-image | ||
| make init # install Packer plugins | ||
| make build # build the AMI (~5 min, launches a t3.large) | ||
| ``` | ||
| 7. Run `make build-and-upload` to build and push container images and binaries | ||
| 8. Run `make copy-public-builds` to copy Firecracker kernels and rootfs to your S3 buckets | ||
| > This requires `gsutil` to download from the public GCS bucket and `aws` CLI to upload to your S3 buckets | ||
| 8. Copy Firecracker kernels and rootfs to your S3 buckets. You have two options: | ||
|
|
||
| **Option A** — Using `make` (requires [`gsutil`](https://cloud.google.com/storage/docs/gsutil_install)): | ||
| ```sh | ||
| make copy-public-builds | ||
| ``` | ||
|
|
||
| **Option B** — Without `gsutil` (download from public GCS bucket via HTTPS, then upload to S3): | ||
| ```sh | ||
| # Set your bucket prefix (PREFIX + AWS_ACCOUNT_ID + "-") | ||
| BUCKET_PREFIX="e2b-YOUR_ACCOUNT_ID-" | ||
|
|
||
| # Download kernels and firecrackers | ||
| mkdir -p .kernels .firecrackers | ||
| for name in $(curl -s "https://storage.googleapis.com/storage/v1/b/e2b-prod-public-builds/o?prefix=kernels/" | python3 -c "import sys,json; [print(i['name']) for i in json.load(sys.stdin).get('items',[]) if int(i.get('size',0))>0]"); do | ||
| mkdir -p ".kernels/$(dirname "${name#kernels/}")" | ||
| curl -sL "https://storage.googleapis.com/e2b-prod-public-builds/$name" -o ".kernels/${name#kernels/}" | ||
| done | ||
| for name in $(curl -s "https://storage.googleapis.com/storage/v1/b/e2b-prod-public-builds/o?prefix=firecrackers/" | python3 -c "import sys,json; [print(i['name']) for i in json.load(sys.stdin).get('items',[]) if int(i.get('size',0))>0]"); do | ||
| mkdir -p ".firecrackers/$(dirname "${name#firecrackers/}")" | ||
| curl -sL "https://storage.googleapis.com/e2b-prod-public-builds/$name" -o ".firecrackers/${name#firecrackers/}" | ||
| done | ||
|
|
||
| # Upload to S3 | ||
| aws s3 cp .kernels/ "s3://${BUCKET_PREFIX}fc-kernels/" --recursive --profile default | ||
| aws s3 cp .firecrackers/ "s3://${BUCKET_PREFIX}fc-versions/" --recursive --profile default | ||
| rm -rf .kernels .firecrackers | ||
| ``` | ||
| 9. Run `make plan-without-jobs` and then `make apply` to provision the cluster infrastructure | ||
| 10. Run `make plan` and then `make apply` to deploy all Nomad jobs | ||
| 11. Setup data in the cluster by running `make prep-cluster` in `packages/shared` to create an initial user, team, and build a base template | ||
| 11. Run database migrations: `cd packages/db && make migrate` | ||
| > If using Supabase, the first migration (`20000101000000_auth.sql`) will fail because Supabase already provides the `auth` schema, `authenticated` role, and `auth.users` table. To skip it, manually mark it as applied before running `make migrate`: | ||
| > ```sh | ||
| > psql "$POSTGRES_CONNECTION_STRING" -c "INSERT INTO _migrations (version_id, is_applied) VALUES (20000101000000, true);" | ||
| > ``` | ||
|
||
| 12. Setup data in the cluster by running `make prep-cluster` in `packages/shared` to create an initial user, team, and build a base template | ||
|
|
||
| ### AWS Architecture | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can maybe replace
copy-public-buildsaws implementation to something like this instead: