Skip to content

[Improve] Default new self-hosted installs to flat preview hostnames - #1484

Merged
mrubens merged 4 commits into
developfrom
feature/flat-preview-defaults-2doq0boz0gm0n
Aug 20, 2026
Merged

[Improve] Default new self-hosted installs to flat preview hostnames#1484
mrubens merged 4 commits into
developfrom
feature/flat-preview-defaults-2doq0boz0gm0n

Conversation

@roomote-community

Copy link
Copy Markdown
Contributor

​Opened on behalf of @mrubens. Follow up by mentioning @roomote, in the web UI, or in Discord.

What changed

  • Default fresh one-command, manual Compose, and DigitalOcean deployments to flat <task>-<port>-preview.<domain> preview hostnames.
  • Preserve existing preview domains and suffixes on installer and deployer reruns, while keeping --preview-domain as the dedicated namespace opt-in.
  • Avoid duplicate DigitalOcean app-domain DNS records when flat previews share the app domain, and align deployment checks and self-hosting documentation with the new default.

Why this change was made

Flat preview hostnames fit standard one-label wildcard DNS and certificate coverage. They avoid requiring a deeper *.preview.<domain> certificate for new self-hosted deployments, particularly behind tunnel or CDN providers.

Impact

New self-hosted installations publish preview URLs under the app domain with the reserved -preview suffix. Existing installations keep their configured hostname layout, so upgrades and reruns do not silently migrate active preview URLs.

Shell syntax, formatting, lint, type checks, Knip, and all deployment Compose shape checks passed. The sandbox could not run the validator's Caddy container adaptation or Terraform formatting because it exposes neither a Docker socket nor a Terraform binary.

@roomote-community

roomote-community Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

No code issues found. See task

  • deploy/scripts/deploy.sh:158 preserves the preview domain but resets a custom flat-host suffix to preview on rerun, changing existing preview URLs.
  • apps/web/src/app/api/caddy/ask/route.ts:83 rejects the hostname used by the preview settings TLS/DNS probe, so fresh flat-preview deployments report a healthy wildcard as unavailable.

Reviewed e1131f1

Comment thread deploy/scripts/deploy.sh Outdated
Review follow-ups for the flat preview hostname default:

- Preserve the preview *layout* (not a literal domain) on installer and
  deployer reruns: flat layouts follow the app domain across a domain
  change, dedicated preview domains are kept with a warning.
- Force the reserved suffix whenever the preview domain equals the app
  domain, including an explicit --preview-domain restating it, and pass
  operator-configured suffixes through unchanged in dedicated layouts
  (install.sh and deploy.sh now share the same matrix).
- Read .env values on reruns with the same tolerant pattern set_env_value
  writes (export prefix, leading whitespace, '=' in values) instead of a
  narrower inline awk, and read tfvars via a shared lib.sh helper that
  tolerates terraform fmt alignment.
- Default to flat previews (not the legacy nested layout) when a partial
  .env has no ROOMOTE_PREVIEW_DOMAIN.
- Require a 13-char base36 taskId prefix, and the configured subdomain
  suffix, before the Caddy on-demand TLS ask endpoint approves a
  hostname, so wildcard scanner probes of first-level subdomains cannot
  burn the Let's Encrypt per-domain rate limit under the flat default.
- Map zone-apex domains to "@"/"*" DNS record names in the DigitalOcean
  Terraform instead of emitting doubled names like
  "*.example.com.example.com".
- Validate PREVIEW_PROXY_SUBDOMAIN_SUFFIX through rendered
  `docker compose config` output per service instead of a raw YAML
  anchor check, and align the CI source asserts with the new code.
- Update apps/docs/homelab.mdx to the flat default DNS layout and note
  in SELF_HOSTING.md that nested previews need the dedicated namespace.
Comment thread apps/web/src/app/api/caddy/ask/route.ts
The Caddy on-demand TLS ask endpoint now requires a 13-char base36 taskId
prefix and the configured subdomain suffix, which rejected the settings
probe's roomote-preview-check-<timestamp> hostname: on fresh flat
deployments the certificate handshake failed and a healthy wildcard was
reported unavailable.

Build the probe hostname as a task-shaped label with the configured
suffix instead. The fixed synthetic taskId also keeps repeated probes on
one hostname so on-demand TLS does not mint a new certificate per probe.
The settings example hostname now includes the suffix too, so flat
deployments display the URL shape previews actually publish.
@mrubens
mrubens marked this pull request as ready for review August 20, 2026 00:58
@mrubens
mrubens merged commit 1a5cfaa into develop Aug 20, 2026
18 checks passed
@mrubens
mrubens deleted the feature/flat-preview-defaults-2doq0boz0gm0n branch August 20, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant