Skip to content

Allow updating a specific app via once update <app>#26

Open
florentdestremau wants to merge 2 commits intobasecamp:mainfrom
florentdestremau:update-app-command
Open

Allow updating a specific app via once update <app>#26
florentdestremau wants to merge 2 commits intobasecamp:mainfrom
florentdestremau:update-app-command

Conversation

@florentdestremau
Copy link

@florentdestremau florentdestremau commented Mar 22, 2026

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

Copilot AI review requested due to automatic review settings March 22, 2026 22:08
@florentdestremau florentdestremau changed the title Allow updating a specific app via once update <app> Allow updating a specific app via once update <app> Mar 22, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 update to 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.

Comment on lines +47 to +52
var changed bool
err := withApplication(ns, appName, "updating", func(app *docker.Application) error {
var err error
changed, err = app.Update(ctx, progress)
return err
})
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a problem, if you use this command I assume you plan to deploy the app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants