Skip to content

feat: Add task to clean up containers with deleted roles #1524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Pavel-Guseynov
Copy link

This merge request introduces a new task, app:deleted_roles, to the deploy process. This task is designed to address an existing issue where containers associated with roles that have been deleted from the configuration persist indefinitely on the server.

Currently, when a role is removed from the application configuration, any running containers previously assigned that role are not automatically cleaned up. This can lead to an accumulation of orphaned containers over time, which is not only inefficient but also poses a potential security risk as these containers might be running outdated or vulnerable code.

The app:deleted_roles task identifies these orphaned containers by comparing the roles present in the current configuration with the roles inferred from the names of existing containers. Containers whose roles are no longer defined in the configuration are then targeted for removal.

This task is strategically placed in the deploy process to run after the stale_containers task, ensuring a comprehensive cleanup of both stale and orphaned containers during a normal deployment.

Implementation Details
The current implementation infers the deleted role name from the container name. While this approach is not ideal and relies on consistent naming conventions, it provides a functional solution for the immediate problem. At this time, i cannot foresee situations where this guessing mechanism would lead to incorrect container identification and deletion, given our current deployment patterns. Future improvements could involve storing role information more explicitly with the container metadata.

Adds a new task `app:deleted_roles` to the  deploy process. This task is responsible for identifying and cleaning up containers that have roles which no longer exist in the current configuration.
@Pavel-Guseynov Pavel-Guseynov force-pushed the feature/cleanup_deleted_roles branch from aa4db60 to 978a5fe Compare April 23, 2025 11:41
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.

None yet

1 participant