Skip to content

An open-source, faster Devin alternative

TypeScript

switch caddy to wildcare setup so we don't have scanners

Brian Reardonb4aefe47c540
diff --git a/.gitignore b/.gitignore
index 6340a92a..3cd1694a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ opensandbox-worker
# Worker env (secrets)
worker.env
+caddy.env
# Loom demo (private)
sdks/typescript/examples/loom/
diff --git a/deploy/ec2/Caddyfile b/deploy/ec2/Caddyfile
index f534c105..3c42d66a 100644
--- a/deploy/ec2/Caddyfile
+++ b/deploy/ec2/Caddyfile
@@ -1,12 +1,10 @@
-{
- on_demand_tls {
- ask http://localhost:8080/caddy/check
- }
-}
-
-https://*.workers.opensandbox.ai {
+*.workers.opensandbox.ai {
tls {
- on_demand
+ dns route53 {
+ access_key_id {env.AWS_ACCESS_KEY_ID}
+ secret_access_key {env.AWS_SECRET_ACCESS_KEY}
+ region us-east-2
+ }
}
reverse_proxy localhost:8080
}
diff --git a/deploy/ec2/README.md b/deploy/ec2/README.md
index 2380e5d8..ed9d2060 100644
--- a/deploy/ec2/README.md
+++ b/deploy/ec2/README.md
@@ -7,7 +7,7 @@
| Podman | 5.8.0 | Rootful, used for sandbox containers |
| CRIU | 4.2 | Checkpoint/restore for hibernation |
| crun | 1.26 | OCI runtime with +CRIU support |
-| Caddy | latest | On-demand TLS for `*.workers.opensandbox.ai` |
+| Caddy | latest | Wildcard TLS for `*.workers.opensandbox.ai` (DNS-01 via Route53) |
| Redis | 7.0.15 | Local, used for sandbox state/routing |
| Go worker | custom | `/usr/local/bin/opensandbox-worker` |
@@ -17,7 +17,7 @@
Internet
|
v
-Caddy (port 443) -- on-demand TLS for *.workers.opensandbox.ai
+Caddy (port 443) -- wildcard TLS for *.workers.opensandbox.ai (DNS-01 via Route53)
|
v
opensandbox-worker (port 8080) -- HTTP API + gRPC (9090)
diff --git a/deploy/ec2/caddy.service b/deploy/ec2/caddy.service
index c08767e6..ef3fc140 100644
--- a/deploy/ec2/caddy.service
+++ b/deploy/ec2/caddy.service
@@ -9,6 +9,7 @@ ExecStart=/usr/local/bin/caddy run --config /etc/caddy/Caddyfile
Restart=always
RestartSec=5
Environment=HOME=/root
+EnvironmentFile=/etc/opensandbox/caddy.env
[Install]
WantedBy=multi-user.target
diff --git a/deploy/ec2/setup-instance.sh b/deploy/ec2/setup-instance.sh
index b43fb138..792ee222 100755
--- a/deploy/ec2/setup-instance.sh
+++ b/deploy/ec2/setup-instance.sh
@@ -82,17 +82,21 @@ echo "==> Configuring Redis..."
echo " NOTE: Set a Redis password in /etc/redis/redis.conf manually"
# -------------------------------------------------------------------
-# Caddy
-# -------------------------------------------------------------------
-echo "==> Installing Caddy..."
-sudo apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl
-curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
-curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
-sudo apt-get update
-sudo apt-get install -y caddy
-# Stop the default caddy service — we use our own unit
-sudo systemctl stop caddy
-sudo systemctl disable caddy
+# Caddy (custom build with Route53 DNS module for wildcard certs)
+# -------------------------------------------------------------------
+echo "==> Installing Go (needed for xcaddy)..."
+GO_VERSION="1.23.6"
+curl -sL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | sudo tar -C /usr/local -xzf -
+export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
+
+echo "==> Building Caddy with Route53 DNS module..."
+go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
+xcaddy build --with github.com/caddy-dns/route53 --output /tmp/caddy-custom
+sudo mv /tmp/caddy-custom /usr/local/bin/caddy
+sudo chmod +x /usr/local/bin/caddy
+
+echo "==> Verifying Caddy has Route53 module..."
+caddy list-modules | grep route53 || { echo "ERROR: Caddy missing route53 module"; exit 1; }
echo "==> Installing Caddy config..."
sudo mkdir -p /etc/caddy
diff --git a/sdks/typescript/examples/run-all-tests.ts b/sdks/typescript/examples/run-all-tests.ts
index ea3b9df7..562666c5 100644
--- a/sdks/typescript/examples/run-all-tests.ts
+++ b/sdks/typescript/examples/run-all-tests.ts
@@ -23,6 +23,9 @@
import { execSync } from "child_process";
import * as path from "path";
+import { fileURLToPath } from "url";
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
const BOLD = "\x1b[1m";
const GREEN = "\x1b[32m";