Domains and HTTPS
Give an app a domain
Section titled “Give an app a domain”- Create a DNS
Arecord for the domain pointing at your Hub’s server IP (not the node’s). For exampleapp.example.com → 203.0.113.10. - In the dashboard, Edit the project and set Domain to
app.example.com.
Within a few seconds the Hub:
- adds a route for the domain to nginx on the Hub server,
- requests a free Let’s Encrypt certificate,
- switches the domain to HTTPS and redirects
http://tohttps://.
Traffic then flows: visitor → Hub (nginx) → private network → the node running the app. When the app moves to another node, the route follows it.
Several apps on one domain
Section titled “Several apps on one domain”Give each project the same Domain and a different Path (in Edit),
for example /api/ for one and nothing (the whole domain) for another. The
Hub serves each under its path and strips the path before the request
reaches the app, so a request for https://example.com/api/users arrives at
the API project as /users. A domain and path can only belong to one
project.
This is how db.asdl.online/rest/v1/ is served: a PostgREST container run as
a Hub project with path /rest/v1/, which the Hub can run on any node.
Renewals
Section titled “Renewals”Certificates last 90 days. certbot on the Hub server renews them
automatically and nginx reloads to use the new one. To check renewals work:
sudo certbot renew --dry-run(Older certbot versions wait a random few minutes before starting — that is normal.)
Checking a domain
Section titled “Checking a domain”# Does DNS point at the Hub?dig +short app.example.com
# Which certificate is served, and until when?echo | openssl s_client -connect app.example.com:443 -servername app.example.com 2>/dev/null \ | openssl x509 -noout -subject -enddateOn the Hub server, the generated routes are in
/etc/nginx/asdl-hub.d/routes.conf and the Hub logs every change:
journalctl -u asdl-hub | grep -E "Nginx|Certificate"