unoverse 0.1.85 → 0.1.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -493,7 +493,7 @@ resource "aws_iam_access_key" "bedrock" {
493
493
  resource "aws_acm_certificate" "public" {
494
494
  count = local.has_domain ? 1 : 0
495
495
  domain_name = local.api_host
496
- subject_alternative_names = var.canvas_public ? ["unoverse.${var.domain}"] : []
496
+ subject_alternative_names = var.canvas_public ? ["canvas.${var.domain}"] : []
497
497
  validation_method = "DNS"
498
498
 
499
499
  lifecycle {
@@ -625,7 +625,7 @@ resource "aws_lb_listener_rule" "canvas" {
625
625
  }
626
626
  condition {
627
627
  host_header {
628
- values = ["unoverse.${var.domain}"]
628
+ values = ["canvas.${var.domain}"]
629
629
  }
630
630
  }
631
631
  }
@@ -661,7 +661,7 @@ resource "aws_route53_record" "api" {
661
661
  resource "aws_route53_record" "unoverse" {
662
662
  count = local.dns_auto && var.canvas_public ? 1 : 0
663
663
  zone_id = var.route53_zone_id
664
- name = "unoverse.${var.domain}"
664
+ name = "canvas.${var.domain}"
665
665
  type = "A"
666
666
 
667
667
  alias {
@@ -9,7 +9,7 @@ output "deploy_host" {
9
9
  }
10
10
 
11
11
  output "alb_dns_name" {
12
- description = "Point api.<domain> (and unoverse.<domain> when canvas_public) at this — CNAME/ALIAS. Created automatically when route53_zone_id is set."
12
+ description = "Point api.<domain> (and canvas.<domain> when canvas_public) at this — CNAME/ALIAS. Created automatically when route53_zone_id is set."
13
13
  value = aws_lb.public.dns_name
14
14
  }
15
15
 
@@ -24,7 +24,7 @@ output "acm_validation_records" {
24
24
 
25
25
  output "canvas_url" {
26
26
  description = "Public Canvas URL (canvas_public = true only) — add it to the client origins."
27
- value = var.canvas_public ? (local.has_domain ? "https://unoverse.${var.domain}" : "http://${aws_lb.public.dns_name}:3001") : "canvas is admin-only (direct http://<instance-ip>:3001 from admin_cidr)"
27
+ value = var.canvas_public ? (local.has_domain ? "https://canvas.${var.domain}" : "http://${aws_lb.public.dns_name}:3001") : "canvas is admin-only (direct http://<instance-ip>:3001 from admin_cidr)"
28
28
  }
29
29
 
30
30
  output "api_url" {
@@ -116,17 +116,18 @@ resource "digitalocean_firewall" "app" {
116
116
  port_range = "4105"
117
117
  source_load_balancer_uids = [digitalocean_loadbalancer.public.id]
118
118
  }
119
- # Canvas (operator UI): the DO LB has NO host-based routing (Caddy did), so the
120
- # public LB carries ONLY the api host :4105. Canvas is an OPERATOR tool —
121
- # admin-only direct access, same trust ring as SSH and Dozzle. It still calls
122
- # the platform at https://api.<domain> like any client.
123
- # POC (canvas_public = true): :3001 ALSO accepts the public LB, which serves
124
- # Canvas at https://api.<domain>:3001. Direct-IP access stays admin-only either way.
119
+ # Canvas (operator UI). Direct access to :3001 on the droplet stays admin-only, same
120
+ # trust ring as SSH and Dozzle, whatever else is true.
121
+ # With canvas_public: whichever load balancer fronts it may reach :3001 too the canvas
122
+ # LB when there is a domain, the main one when there is not. Naming both here would open
123
+ # 3001 to an LB that is not serving Canvas in that mode.
125
124
  inbound_rule {
126
- protocol = "tcp"
127
- port_range = "3001"
128
- source_addresses = [var.admin_cidr]
129
- source_load_balancer_uids = var.canvas_public ? [digitalocean_loadbalancer.public.id] : []
125
+ protocol = "tcp"
126
+ port_range = "3001"
127
+ source_addresses = [var.admin_cidr]
128
+ source_load_balancer_uids = var.canvas_public ? (
129
+ local.has_domain ? [digitalocean_loadbalancer.canvas[0].id] : [digitalocean_loadbalancer.public.id]
130
+ ) : []
130
131
  }
131
132
 
132
133
  outbound_rule {
@@ -183,18 +184,16 @@ resource "digitalocean_loadbalancer" "public" {
183
184
  }
184
185
  }
185
186
 
186
- # POC (canvas_public = true, DECIDED 2026-07-29): Canvas rides the SAME LB on a
187
- # second port — https://canvas.<domain>:3001 (a SAN on the api certificate, an A record to this same LB). ONE load balancer total: DO LBs can't
188
- # host-route, and a clean second hostname would cost a second LB; the POC takes
189
- # the port in the URL instead. Domainless: same second port, plain HTTP.
187
+ # DOMAINLESS ONLY. Without a hostname there is nothing to route by, so Canvas takes a
188
+ # second port on this LB's IP. With a domain it gets its own load balancer below and a
189
+ # clean https://canvas.<domain> see the note there.
190
190
  dynamic "forwarding_rule" {
191
- for_each = var.canvas_public ? [1] : []
191
+ for_each = var.canvas_public && !local.has_domain ? [1] : []
192
192
  content {
193
- entry_port = 3001
194
- entry_protocol = local.has_domain ? "https" : "http"
195
- target_port = 3001
196
- target_protocol = "http"
197
- certificate_name = one(digitalocean_certificate.api[*].name)
193
+ entry_port = 3001
194
+ entry_protocol = "http"
195
+ target_port = 3001
196
+ target_protocol = "http"
198
197
  }
199
198
  }
200
199
 
@@ -206,12 +205,49 @@ resource "digitalocean_loadbalancer" "public" {
206
205
  }
207
206
  }
208
207
 
208
+ # CANVAS GETS ITS OWN LOAD BALANCER, so its URL carries no port.
209
+ #
210
+ # Supersedes the 2026-07-29 decision to run one LB and put :3001 in the URL. A port in a
211
+ # hostname is not a URL anyone ships: it breaks the expectation that https means 443, it
212
+ # has to be explained to every operator, and it leaks an implementation detail of the
213
+ # ingress into the address bar. The reason for it was real — DigitalOcean load balancers
214
+ # route on PORT only, never on the Host header, so one LB genuinely cannot serve two
215
+ # hostnames — but the conclusion was wrong. The right answer to "the product cannot do
216
+ # this" is a second load balancer, not a worse address.
217
+ #
218
+ # ~$12/month, and only when a domain is set AND Canvas is public. Domainless universes
219
+ # keep the second port on the main LB above: with no hostname there is nothing to route by,
220
+ # so a second LB would buy nothing.
221
+ resource "digitalocean_loadbalancer" "canvas" {
222
+ count = local.has_domain && var.canvas_public ? 1 : 0
223
+ name = "${var.name}-canvas-lb"
224
+ region = var.region
225
+ droplet_ids = [digitalocean_droplet.app.id]
226
+ redirect_http_to_https = true
227
+ http_idle_timeout_seconds = 600
228
+
229
+ forwarding_rule {
230
+ entry_port = 443
231
+ entry_protocol = "https"
232
+ target_port = 3001
233
+ target_protocol = "http"
234
+ certificate_name = one(digitalocean_certificate.api[*].name)
235
+ }
236
+
237
+ # Canvas has no /health of its own; the root answering is the liveness signal.
238
+ healthcheck {
239
+ port = 3001
240
+ protocol = "http"
241
+ path = "/"
242
+ }
243
+ }
244
+
209
245
  resource "digitalocean_record" "canvas" {
210
246
  count = local.has_domain && var.canvas_public && var.manage_dns ? 1 : 0
211
247
  domain = var.domain
212
248
  type = "A"
213
249
  name = "canvas"
214
- value = digitalocean_loadbalancer.public.ip
250
+ value = digitalocean_loadbalancer.canvas[0].ip
215
251
  ttl = 300
216
252
  }
217
253
 
@@ -44,7 +44,7 @@ output "lb_ip" {
44
44
 
45
45
  output "canvas_url" {
46
46
  description = "Public Canvas URL (canvas_public = true only) — add it to the IdP's allowed origins."
47
- value = var.canvas_public ? (local.has_domain ? "https://canvas.${var.domain}:3001" : "http://${digitalocean_loadbalancer.public.ip}:3001") : "canvas is admin-only (direct http://<droplet-ip>:3001 from admin_cidr)"
47
+ value = var.canvas_public ? (local.has_domain ? "https://canvas.${var.domain}" : "http://${digitalocean_loadbalancer.public.ip}:3001") : "canvas is admin-only (direct http://<droplet-ip>:3001 from admin_cidr)"
48
48
  }
49
49
 
50
50
  output "api_url" {
@@ -35,6 +35,9 @@ locals {
35
35
  local.provision_pg ? lookup(local.prices, local.s.pg, 0) : 0,
36
36
  lookup(local.prices, local.s.redis, 0),
37
37
  local.prices["lb"],
38
+ # Canvas's own load balancer, so its URL needs no port. Only with a domain: without
39
+ # one it shares the main LB's IP on a second port and costs nothing extra.
40
+ local.has_domain && var.canvas_public ? local.prices["lb"] : 0,
38
41
  ])
39
42
  }
40
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unoverse",
3
- "version": "0.1.85",
3
+ "version": "0.1.86",
4
4
  "description": "The Unoverse front door — create a Studio project, a universe, or a client app, and launch Studio.",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "type": "module",