Key idea
Everything you run sits in a chain: account, project, environment, service. Each level lives inside the one above, so learn the chain once and every screen and command makes sense.
Each level sits inside the one above
staging and prod each get their own copy. Each square is a spherelet: the deployment runs on one or more of them.Account: who pays, and who's in
The account holds billing (one subscription, one card, one set of invoices) and its members. You can belong to several, say your employer's and your own, and each bills separately.
Project: one product
A project groups the services that make up one product: a shop, a marketing site, an internal tool. It doesn't run anything or cost anything by itself.
A good rule: if two things ship and break together, they belong in the same project.
Environment: one copy of the product
An environment is an isolated place for services to run, typically staging and prod. Each has its own network, secrets and limits, so production can't read a staging password.
Every service lives in exactly one environment. Running the same app in staging and production means deploying it twice, once into each.
Service: one running part
A service is one part of your app: a web server, a background worker, a scheduled job. It runs one container image, a packaged copy of your app and everything it needs, named like learn-hello-web:1.0.0. The part after the colon is the image tag, which says which build of the image to use.
A service runs on spherelets, one running copy each. Lesson 5.2.3 covers them.
Versions and the deployment ID
Each deploy records a version of the service: its image and settings at that moment, listed in its deploy history. Rolling back puts an earlier version back in place.
The deployment ID is what csph prints after a deploy. It identifies the service running in one environment, and commands like csph deployments rollback take it.
What records a version, and what doesn't
A version is recorded when the service is created, when you run csph deploy (even with the same image), and when a build from your repository deploys.
Saving a setting in the console doesn't record one; the setting goes into the next version you deploy. Restart, stop, start and scaling don't record one either. A rollback doesn't create a version; it makes an earlier one current again (lesson 5.7.4).
Try it on paper
Pick an app you've built or want to build. Write down one project name, the environments you'd want, and each service it needs. You'll choose types for those services next.
Check yourself