Allow updating a specific app via once update <app>#26
Allow updating a specific app via once update <app>#26florentdestremau wants to merge 2 commits intobasecamp:mainfrom
once update <app>#26Conversation
once update <app>
There was a problem hiding this comment.
Pull request overview
This PR extends the once update CLI command to optionally accept an application name so users can trigger an on-demand update check/deploy for a specific deployed app, while keeping once update as the self-update (binary update) entrypoint.
Changes:
- Update
once updateto accept an optional[app]argument and route execution accordingly. - Implement app update execution via
docker.Application.Update, printing deploy-style progress and a final “updated / already up to date” message.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var changed bool | ||
| err := withApplication(ns, appName, "updating", func(app *docker.Application) error { | ||
| var err error | ||
| changed, err = app.Update(ctx, progress) | ||
| return err | ||
| }) |
There was a problem hiding this comment.
This updates the app regardless of whether it's currently running. Since app.Update deploys a new container and re-registers with the proxy, once update <app> could unintentionally start an app that was previously stopped. If the intention is to match the background runner logic, add a guard (e.g., require app.Running or otherwise avoid deploying when the app is stopped) and return a clear message/error when the app isn't running.
There was a problem hiding this comment.
I don't think it's a problem, if you use this command I assume you plan to deploy the app
…it on self-update
The update command has been extended to accept an optional argument: the name of a deployed application.
Without an argument (
once update), the behaviour is unchanged: the Once binary is updated to the latest version.With an argument (once update my-app), the command forces an update check for the application.
This is the same logic used by the background runner (app.Update), but triggered on demand rather than on a 24-hour interval. Progress is printed to the console (download, starting, finished), just like once deploy.
To me this is useful when actively developping, allowing me to make a custom crontab and force update every 5 min for example.
full disclosure : this is coded with Claude code, I am not really proficient in go