Apps of several services
How the services of one app get addresses, reach each other, rebuild on a push and roll back together.
Each service of an app is built from its own folder and repository, runs its own start command at its own size, and is checked on its own. One deploy builds every service, runs each release command once, then moves traffic to all of them together. The databases are started first.
Addresses
What a service is decides its address, never where it sits in the file.
web | api | api with public: true | worker | |
|---|---|---|---|---|
| Address | shop.acme.clusterz.eu and the app's verified custom domains | none | api.shop.acme.clusterz.eu, once that name resolves to Clusterz | none |
| Port | port, else the framework's, else 8080, given as PORT | the same | the same | none |
| Health check | health_check asked as visitors reach it; any answer below 500 is up | the same request, from the app's own network | as for the web | it keeps running |
| Networks | the app's own, the team's, and the one Clusterz routes over | the app's own and the team's | as for the web | as for a private api |
An app may have no web, as one of apis and workers does: it has no address, and the plan says "no address".
Reaching each other
Services reach each other by name on the app's own network: http://api:8080. from_service gives a service another's address: the app's address for the web, a public api's own, and the private one otherwise. The team's other apps reach a private api over the team's network.
Browsers
A private api is the smaller surface: no certificate, no cross-origin rules, nothing on the internet but the web. A browser, a phone app or another company's webhook can never reach it. Those either call the web's own server, which forwards to http://api:8080, or reach an api that says public: true.
Pushes
A push to any service's repository rebuilds and redeploys that service, and the others keep running. A push to the repository that holds clusterz.yaml reads the file again and applies what changed. Clusterz registers the push hook on every repository of the app.
Rollback
If one service fails its health check, every service goes back to the version that ran before.
Size and bill
Each service is sized on its own, and billed by its own size.
cluz services # each service, its state, size and address
cluz services scale web --instances 3 # one service's size; the app redeploysThe app's page shows each service with its state, its logs and its size.