Repository navigation
Expand file tree
/
Copy pathwrangler.jsonc
More file actions
113 lines (113 loc) · 5.45 KB
/
Copy pathwrangler.jsonc
File metadata and controls
113 lines (113 loc) · 5.45 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "bindws-relay",
"main": "src/index.ts",
"compatibility_date": "2026-08-01",
"compatibility_flags": ["nodejs_compat"],
// Logs and traces go to Workers Observability, and to any OTLP endpoint
// named in `destinations` once it is created in the dashboard
// (docs/11-hosting-bindws.md, Observe). Each relay writes one JSON meter
// line per usage flush; traces cover the Worker's own fetches and
// binding calls. Sampling keeps the trace bill in check.
"observability": {
"enabled": true,
"logs": { "enabled": true },
"traces": { "enabled": true, "head_sampling_rate": 0.1 }
},
// Metrics: uncomment to write the same meter numbers as Analytics Engine
// data points, queried with SQL or the Grafana plugin. Workers Paid only.
// "analytics_engine_datasets": [{ "binding": "METRICS", "dataset": "bindws_relays" }],
// Production: the apex as a custom domain, every subdomain routed by the
// wildcard. The wildcard needs proxied placeholder DNS records for *.bind.ws.
// The third route catches custom domains: with Cloudflare for SaaS a
// customer's hostname enters this zone, and only a route matching any
// host sends it to the Worker (docs/11-hosting-bindws.md, Custom domains).
"routes": [
{ "pattern": "bind.ws", "custom_domain": true },
{ "pattern": "*.bind.ws/*", "zone_id": "491aaf5e1c12976e9828199686a81733" },
// The catch-all brings custom hostnames to the Worker. It needs Cloudflare
// for SaaS enabled on the zone first (docs/11-hosting-bindws.md).
{ "pattern": "*/*", "zone_id": "491aaf5e1c12976e9828199686a81733" }
],
"vars": {
// Relays live at wss://<name>.<DOMAIN>; in `wrangler dev` use <name>.localhost.
// Requests for any other host fall back to the relay named DEV_RELAY.
"DOMAIN": "bind.ws",
"DEV_RELAY": "dev",
"PUSH_CALLBACK_ORIGINS": "[]",
// Custom domains: the zone custom hostnames are created in, and the name
// owners point their CNAME at. CF_API_TOKEN is a secret, set with
// `wrangler secret put CF_API_TOKEN`; without it the feature is off.
"ZONE_ID": "491aaf5e1c12976e9828199686a81733",
"CNAME_TARGET": "customers.bind.ws",
// Fuel: free allowances per relay per month, and the sats charged beyond
// them, paid by zaps to LIGHTNING_ADDRESS naming SERVICE_PUBKEY. Leave
// the address empty to run without top-ups (allowances still apply).
"LIGHTNING_ADDRESS": "bindws@getalby.com",
"SERVICE_PUBKEY": "6b559c0816c3b9ec03c2f0cedb8a56efe83746f8c56e543e36e1973c04ef0384",
"FREE_EVENTS_MB": "100",
"FREE_MEDIA_MB": "1024",
"FREE_ACTIVE_HOURS": "100",
"FREE_ROWS_WRITTEN": "250000",
// Prices follow what Cloudflare bills us for the same thing, at about
// 1.5x, converted at 77,000 USD per bitcoin. `node scripts/margin.mjs`
// checks them against the rate of the day (docs/15-costs-and-margins.md).
// SQLite storage 0.20 USD/GB-month -> 260 sats
// R2 storage 0.015 USD/GB-month -> 20 sats
// DO duration 12.50 USD/M GB-s at 128 MB -> 7.3 sats per hour awake
// rows written 1.00 USD/M -> 1,300 sats
// egress free -> not priced
"SATS_PER_GB_MONTH_EVENTS": "400",
"SATS_PER_GB_MONTH_MEDIA": "30",
"SATS_PER_ACTIVE_HOUR": "11",
"SATS_PER_MILLION_ROWS": "2000"
},
"durable_objects": {
"bindings": [{ "name": "RELAY", "class_name": "Relay" }]
},
// Blossom media for every relay, keyed <name>/<sha256> in one bucket.
"r2_buckets": [{ "binding": "MEDIA", "bucket_name": "bindws-media" }],
// Custom domains: hostname -> relay name, read by the Worker for any
// request whose host is outside DOMAIN.
"kv_namespaces": [{ "binding": "HOSTS", "id": "77f19f73b8e44ee28085991137feb162" }],
// POST /lease creates objects for anyone, so it is capped per address and overall.
"ratelimits": [
{ "name": "LEASE_LIMIT_IP", "namespace_id": "1001", "simple": { "limit": 5, "period": 60 } },
{ "name": "LEASE_LIMIT_ALL", "namespace_id": "1002", "simple": { "limit": 60, "period": 60 } }
],
"migrations": [{ "tag": "v1", "new_sqlite_classes": ["Relay"] }],
// `wrangler dev --env dev`: no routes, so local hostnames (<name>.localhost)
// reach the Worker unchanged instead of being rewritten to the route host.
// vars and bindings are not inherited by environments, hence the repeat.
"env": {
"dev": {
"routes": [],
"vars": {
"DOMAIN": "bind.ws",
"DEV_RELAY": "dev",
"PUSH_CALLBACK_ORIGINS": "[]",
"ZONE_ID": "",
"CNAME_TARGET": "customers.bind.ws",
"LIGHTNING_ADDRESS": "",
"SERVICE_PUBKEY": "",
"FREE_EVENTS_MB": "100",
"FREE_MEDIA_MB": "1024",
"FREE_ACTIVE_HOURS": "100",
"FREE_ROWS_WRITTEN": "250000",
"SATS_PER_GB_MONTH_EVENTS": "400",
"SATS_PER_GB_MONTH_MEDIA": "30",
"SATS_PER_ACTIVE_HOUR": "11",
"SATS_PER_MILLION_ROWS": "2000"
},
"durable_objects": {
"bindings": [{ "name": "RELAY", "class_name": "Relay" }]
},
"r2_buckets": [{ "binding": "MEDIA", "bucket_name": "bindws-media" }],
"kv_namespaces": [{ "binding": "HOSTS", "id": "77f19f73b8e44ee28085991137feb162" }],
"ratelimits": [
{ "name": "LEASE_LIMIT_IP", "namespace_id": "1001", "simple": { "limit": 5, "period": 60 } },
{ "name": "LEASE_LIMIT_ALL", "namespace_id": "1002", "simple": { "limit": 60, "period": 60 } }
]
}
}
}