Key idea
Every web service gets a working HTTPS address on computesphere.app as soon as it's deployed. A custom domain puts a name you own in front of the same service, and the default address is what your domain's DNS record points at.
One request, end to end
app.example.com
A visitor, or anything making an HTTPS request.
Your record
Points your name at the service's default hostname.
HTTPS
Answers with your domain's certificate.
Internal address, e.g. http://d-7b21e4c9:8080. No public URL.
Hosted elsewhere
Connected with the DATABASE_URL secret. ComputeSphere doesn't run it.
The default URL
https://d-hello-web-3f9c2a71.computesphere.app
It's d-, the service's name, and the first eight characters of its deployment ID. The deployment ID stays the same across redeploys and rollbacks, so the address does too. It has a valid certificate from the start, and it's the address you've tested against so far.
Words you'll need
- DNS is the internet's phone book: it turns a name like
app.example.cominto the place that serves it. - Your DNS provider is whoever holds that phone book entry for your domain, set by its nameservers. It's often your registrar (where you bought the domain), sometimes Cloudflare or your cloud.
- A CNAME record says “this name is another name for that one”.
- The apex is the bare domain,
example.com, without anything in front.
Adding a custom domain
- Open the service. On its Overview, find the Custom domain card and choose Add domain.
- Enter the domain, for example
app.example.com. - Leave SSL certificate on Automatic; ComputeSphere issues and renews it (lesson 5.6.3).
- Read the DNS configuration table under the field. It lists the records to create at your DNS provider.
- Choose Add domain.
The domain then waits at Waiting for DNS until you create those records (next lesson). Once they're in place, ComputeSphere checks them, issues the certificate, and the domain turns Active.
Apex and www come as a pair
People type both, so adding example.com also sets up www.example.com, and the other way round. Both appear in the Custom domain card with their own status, and each needs its own DNS record.
Several domains, and turning the default URL off
A service can carry several independent domains, each with its own records, certificate and status. A domain belongs to one service at a time; adding one that's attached elsewhere is refused with this domain is already in use by another service.
Once a custom domain is serving, you can turn the default URL off so the service answers only on your domain. The switch is on the Networking card in the service's Settings, and stays on until a custom domain is active.
From the terminal, with the deployment ID from csph deployments list:
csph deployments domains add app.example.com --deployment <id>
csph deployments domains dns app.example.com --deployment <id>
csph deployments domains get app.example.com --deployment <id>
dns prints the records to create; get shows the domain's status, as pending_dns while it waits for your records. The account's Domains page lists the same domain with its certificate as Requested until it's issued.
Check yourself