aws-greengrass / aws-greengrass-nucleus

The Greengrass nucleus component provides functionality for device side orchestration of deployments and lifecycle management for execution of Greengrass components and applications. This includes features such as starting, stopping, and monitoring execution of components and apps, interprocess communication server for communication between components, component installation and configuration management.
Apache License 2.0
108 stars 46 forks source link

com.aws.greengrass.lifecyclemanager: New Lifecycle stage "Uninstall" #814

Open kris-sum opened 3 years ago

kris-sum commented 3 years ago

Feature Description We already have 'install', 'run', 'shutdown' etc as Lifecycle stages where we can configure scripts, but how about about an 'Uninstall' stage where we can perform any cleanup operations when a component is upgraded or removed.

Use Case If my component puts temporary data in the CWD, or needs to notify another component that it's being removed, it would be good to use this 'uninstall' stage which operates like the inverse of 'install', allowing us to call scripts when the current artifact is removed.

My particular use-case was to cleanup the filesystem after an install script installs dependencies - my dependencies ended up in /home/ggc_user/.local/share/virtualenvs/{instance_id}, and weren't removed when the component artifacts were removed. I'm aware that this isn't "The Right Way" to do things, but nonetheless I feel an Uninstall licecycle stage would be useful to others.

Note: Shutdown !== Uninstall, as components can be stopped/started without being uninstalled.

Proposed Solution Uninstall scripts should be executed before any artifact cleanup is performed. Uninstall scripts should have a default timeout value, so that uninstalls don't hang the system indefinitely.

MikeDombo commented 3 years ago

Thanks for the feedback Kris. We'll discuss this internally to determine a priority for our roadmap.

plafer commented 3 years ago

I second this. We really need this feature. Currently, we're hacking it by making the RUN script sleep forever once done, and we put the cleanup in the shutdown script.

breboulet commented 3 years ago

I second this. We really need this feature. Currently, we're hacking it by making the RUN script sleep forever once done, and we put the cleanup in the shutdown script.

Same here. Not having a clean uninstall stage is unfortunately making it a hard sell for a production environment :(

cgddrd-gardin commented 3 years ago

I'd also +1 this (I've thumbed up as well), it would be very very useful to have the ability to run a cleanup script when a component gets uninstalled.

sambonator1 commented 3 years ago

I opened a feature request through AWS Enterprise Support for this, not knowing this feature request existed here.
+1 for this feature please. Without it I cannot do a proper cleanup when components are removed.

chaithuprsnl commented 1 year ago

My use case is to install & uninstall an .exe file on a windows device using Greengrass component deployment. It would be great if this uninstall life cycle stage addresses this use case as well.