Key idea
A running app reads its environment variables once, when it starts. So a configuration change reaches it only when new spherelets start with it, on a redeploy, and a code change only after a new build.
You changed a variable and the app still shows the old value. Nothing is broken: the change is saved, but your app hasn't started with it yet.
Redeploys are rolling: new spherelets start next to the old ones, which stop only once the new ones are healthy. Applying a change doesn't take your app offline (lesson 5.7.2 shows how).
Change by change
| You change | How it reaches the app |
|---|---|
| A service's variables or secrets, in the console | The console asks Apply changes? Choose Save & redeploy |
A service's variables or secrets, with csph | csph redeploys the service for you |
| The environment's shared variables or secrets | Saving redeploys every running service in the environment automatically. A stopped service gets them when it's next started; a cron job, on its next run |
| The health check | Redeploy to apply changes? → Redeploy now |
| The spherelet count | Apply changes? → Save & redeploy. No build: it runs more or fewer copies of the same version |
| Your code, pushed to GitHub | Redeploy → Build & deploy |
A NEXT_PUBLIC_… or VITE_… variable | Save it and choose Save & rebuild, or later Redeploy → Build & deploy, because these are copied into the build |
Now or later
When you save, the console asks whether to apply the change now. Save & redeploy saves it and rolls it out. Save only saves it without applying it, and the app keeps the old values until the next redeploy. The health check card asks the same question with Redeploy now and Later.
Save only (or Later) is useful for several changes at once, say three variables and a health check: choose it for all but the last, and get one rollout instead of four.
The catch is forgetting. A saved value looks right in Settings while the app still uses the old one. If Settings and the app disagree, redeploy first.
Build & deploy or Deploy only
For a service built from a repository, Redeploy offers two options:
- Build & deploy builds the latest commit on your branch, then rolls it out. Use it for code and for
NEXT_PUBLIC_…/VITE_…variables. - Deploy only rolls out the image you already have with the current settings. It's faster, and enough for ordinary variables, secrets and health checks.
A service deployed from an image only has the second.
Check yourself