Skip to content

Conversation

@mirkoCrobu
Copy link
Contributor

Motivation

closes #105

We could add a new app destroycommand (or a similar name) for stopping and removing all the data of an app.
In particular, we should do a docker-compose down and remove the .cache.

We should also consider adding a destroyed (or a better name) that is the default state of an app if it has not been run yet.
With this additional state, we would then be able to always return a state when listing the apps (right now apps and examples that have not been run, will show up as with no state).

Change description

Additional Notes

Reviewer checklist

  • PR addresses a single concern.
  • PR title and description are properly filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.

return stopAppWithCmd(ctx, dockerClient, app, "stop")
}

func StopAndDestroyApp(ctx context.Context, dockerClient command.Cli, app app.ArduinoApp) iter.Seq[StreamMessage] {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably just add the cleanup in this function

for msg := range cleanAppCacheFiles(app) {
			if !yield(msg) {
				return
			}
		}

return stopAppWithCmd(ctx, dockerClient, app, "down")
}

func DestroyAndCleanApp(ctx context.Context, app app.ArduinoApp) iter.Seq[StreamMessage] {
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems redundant, isn't just what the StopAndDestroyApp does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it behaves the same, except that stopAndDestroyApp only has an effect if the app is starting or running.
I just need to make sure that removing the status check won’t break anything before merging the two funcs.
Or maybe we can keep the status check on stopAndDestroyApp, and just add the cleanAppCacheFiles .

if appStatus.Status != StatusStarting && appStatus.Status != StatusRunning {
				yield(StreamMessage{data: fmt.Sprintf("app %q is not running", app.Name)})
				return
			}

@mirkoCrobu mirkoCrobu self-assigned this Dec 9, 2025
@mirkoCrobu
Copy link
Contributor Author

Add uninitialized status and set status information for app list

image

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.

Add a destroy app command

2 participants