Article · 4 min read · Servers and performance
Your own server in front
An app on a home server has no public address, so its visitors have to come in somewhere else. That can be another of your own servers, one with a public address, rather than kubespin. The name’s record points at that server, it holds the s
An app on a home server has no public address, so its visitors have to come in somewhere else. That can be another of your own servers, one with a public address, rather than kubespin. The name’s record points at that server, it holds the site and the certificate, and it reaches the app over your kubespin: The mesh network.
Visitors then never cross kubespin, and the site keeps working while kubespin is down.
Which servers can be in front
A server can be in front of an app when it:
- has a public address;
- runs Plesk, which holds the site and its Let’s Encrypt certificate;
- is on the mesh, and so is the app’s server.
kubespin picks one by itself when you add a name: your mesh server first, since it’s your front door, then any other server that fits. Only when none fits does kubespin’s own host serve the name, under your plan’s kubespin: The starter allowance.
What kubespin sets up
- On the app’s server: a small forwarder (
alpine/socat, a pinned version) that listens on the server’s mesh address only and passes visitors to the app’s local port. Where ufw is on, only the server in front may reach that port. - On the server in front: a Plesk site for the name, with its certificate, passing visitors to the app’s mesh address.
- In your DNS: an A record for the name pointing at the server in front.
If the server in front stops qualifying, for example it left the mesh or lost Plesk, kubespin’s host takes over the name at the next check, so it keeps working.
In kubespin
- Open the app from Deployments and choose the Domains tab.
- Under each name, In front shows which server takes the visitors: kubespin, or one of yours, marked “(your server, over the mesh)”.
- Choose another to switch. Choosing kubespin moves it back to kubespin’s host.
When no server can be in front, the tab says why, for example that the app’s server isn’t on the mesh yet (“Join it from its page”), or that none of your servers with a public address and Plesk is on the mesh.
An app on a server with its own public address doesn’t need this: its names go straight to it.
Command line
The kubespin command has no domain commands yet. Use kubespin api, or a script with an API token:
kubespin api GET /deployments/$APP_ID/domains/fronts
API
curl -s -X PUT https://kubespin.io/api/v1/deployments/$APP_ID/domains/$NAME_ID/front \
-H "Authorization: Bearer $KUBESPIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"server_id": "'"$SERVER_ID"'"}'
It returns the name, with how set to front and front_server_id. {"server_id": null} moves it back to kubespin’s host.
GET /api/v1/deployments/{id}/domains/fronts returns whether the app needed a server in front, the fronts that can be, and why when none can.
[!permissions] Permissions Area: Deployments
Step Needs Default roles See which server is in front View Admin, Developer, Operator, Viewer Change it Manage Admin, Developer API token: Read only to look; Read and change to change it.