Domains

Web addresses for your apps, served over HTTPS.

Overview

A domain is a web address for one of your apps, served over HTTPS. EnclaveStack gets and renews the certificate; addresses ending in .localhost get one from its own certificate authority.

When to use it

  • Put an app on shop.example.com.
  • Try an app at https://web.localhost.
  • Several apps on one machine, each on its own address.

How it works

Caddy 2.10
One edge proxy container, created with the first domain, configured by the control plane.
Let’s Encrypt
Public certificates through ACME, by HTTP or, with a DNS zone, by DNS (wildcards too).
EnclaveStack CA
Certificates for .localhost; download the root once to trust it.

The edge listens on ports 80 and 443 and routes each hostname to its app’s private name, following the app’s replicas. Plain HTTP redirects to HTTPS unless you turn that off. Nothing is exposed until you choose the edge’s public address.

Architecture

Domains architectureThe edge terminates HTTPS and routes each hostname to its app.HTTPScertificateproxyVisitorEdge (Caddy)ports 80, 443Certificate authorityLet’s Encrypt or EnclaveStackAppweb.app.internal
The edge terminates HTTPS and routes each hostname to its app.
  • Visitor to Edge (Caddy): HTTPS
  • Certificate authority to Edge (Caddy): certificate
  • Edge (Caddy) to App: proxy

Flows

Adding a domain

  1. Point the hostname at this machine.
  2. Create the domain for an app.
  3. The edge gets a certificate and starts routing; the page shows when it is issued.

Set it up

In the console

  1. Open Domains and choose New domain.
  2. Enter the hostname and choose the app.
  3. Choose Create.

With the CLI

enclave domain create web-local --hostname web.localhost --app web --wait

With OpenTofu

OpenTofu configuration
resource "enclave_domain" "web_local" {
  name     = "web-local"
  hostname = "web.localhost"
  app      = "web"
}

Settings reference

Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.

enclave_domain
NameTypeUseWhat it does
apptextrequiredName of the app to route to.
hostnametextrequiredHostname, e.g. api.example.com or web.localhost. Changing it replaces the domain.
nametextrequiredName of the domain: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the domain.
portnumberoptionalApp port (default: the app's port).
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
redirect_httptrue or falseoptionalRedirect plain HTTP to HTTPS.
tlstextoptionalauto (Let's Encrypt), internal (EnclaveStack CA) or off. Default: internal for .localhost names, else auto.
zonetextoptionalZone to get the certificate through (ACME DNS-01): no inbound port needed, and the hostname may be a wildcard like *.example.com.
certificate_expires_attextoutputWhen the current certificate expires (RFC 3339).
certificate_issuertextoutputWho issued the current certificate.
certificate_statetextoutputissued, pending, failed or none.
idtextoutputResource ID.
urltextoutputWhere the app is served.

Limits and security

Good to know

  • Public certificates need ports 80 and 443 reachable from the internet, or a DNS zone.

Security

  • Certificates and keys stay on the machine, encrypted where stored.