forked from mikenomitch/opencode-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrangler.jsonc
More file actions
87 lines (80 loc) · 2.41 KB
/
wrangler.jsonc
File metadata and controls
87 lines (80 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "opencode-sandboxes",
"main": "src/index.ts",
"compatibility_date": "2025-05-06",
"compatibility_flags": ["nodejs_compat"],
"observability": {
"enabled": true,
},
// Static frontend served on the bare domain; run_worker_first ensures
// the Worker handles subdomain routing before assets are checked.
"assets": {
"directory": "./public/",
"binding": "ASSETS",
"run_worker_first": true,
},
// Environment variables used by the Sandbox SDK for R2 presigned URLs.
// ANTHROPIC_API_KEY, R2_ACCESS_KEY_ID, and R2_SECRET_ACCESS_KEY are set
// via `wrangler secret put`.
"vars": {
"DOMAIN": "<your-domain>",
"BACKUP_BUCKET_NAME": "sandbox-snapshots",
"CLOUDFLARE_ACCOUNT_ID": "<your-account-id>",
},
// R2 bucket for snapshot/restore. The first binding is used in the Worker
// to look up backup metadata. The second (remote) binding lets wrangler dev
// connect to the real bucket during local development.
"r2_buckets": [
{
"binding": "BACKUP_BUCKET",
"bucket_name": "sandbox-snapshots",
},
{
"bucket_name": "sandbox-snapshots",
"binding": "sandbox_snapshots",
"remote": true,
},
],
// Each sandbox runs in its own container built from ./Dockerfile.
// The Sandbox class is accessed via ctx.exports.Sandbox in the Worker.
"containers": [
{
"class_name": "Sandbox",
"image": "./Dockerfile",
"instance_type": "standard-1",
"max_instances": 20,
},
],
// Durable Object binding — makes the Sandbox class available on env.Sandbox.
// Note: This config will become unnecessary in the near future
"durable_objects": {
"bindings": [
{
"class_name": "Sandbox",
"name": "Sandbox",
},
],
},
// Required Durable Object migration for the Sandbox class.
// Allows each Sandbox to have a dedicated database associated with it
// Note: This config will become unnecessary in the near future
"migrations": [
{
"new_sqlite_classes": ["Sandbox"],
"tag": "v1",
},
],
// Bare domain serves the frontend; wildcard catches all subdomains
// for per-sandbox routing (e.g. my-sandbox.<your-domain>).
"routes": [
{
"pattern": "<your-domain>/*",
"zone_name": "<your-domain>",
},
{
"pattern": "*.<your-domain>/*",
"zone_name": "<your-domain>",
},
],
}