From e5ecf1612751a12b5e2fbbd2f87906151439e4f5 Mon Sep 17 00:00:00 2001 From: craisin Date: Thu, 1 Jan 2026 11:53:25 -0800 Subject: [PATCH] add recreate --- composer-lens/app.py | 0 composer-lens/templates/index.html | 0 composer/agent.py | 21 +++++++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 composer-lens/app.py create mode 100644 composer-lens/templates/index.html diff --git a/composer-lens/app.py b/composer-lens/app.py new file mode 100644 index 0000000..e69de29 diff --git a/composer-lens/templates/index.html b/composer-lens/templates/index.html new file mode 100644 index 0000000..e69de29 diff --git a/composer/agent.py b/composer/agent.py index 38910a9..961f817 100644 --- a/composer/agent.py +++ b/composer/agent.py @@ -136,7 +136,7 @@ class Composer: """Sets the running status of the compose stack Args: - status: string containing "up", "down", or "restart" corresponding to the respective running state of the composer + status: string containing "up", "down", "restart", or "recreate" corresponding to the respective running state of the composer """ try: @@ -155,6 +155,14 @@ class Composer: self.docker.compose.restart( services=[self.name] ) + elif status == "recreate": + self.docker.compose.up( + build=True, + detach=True, + force_recreate=True, + quiet=True, + remove_orphans=True + ) else: logger.warn(f"Undefined status {status} - use up, down, or restart") except DockerException as error: @@ -241,7 +249,7 @@ class Service: """Sets the running status of the service Args: - status: string containing "up", "down", or "restart" corresponding to the respective running state of the service + status: string containing "up", "down", "restart", or "recreate" corresponding to the respective running state of the service """ try: @@ -261,6 +269,15 @@ class Service: self.parent.docker.compose.restart( services=[self.name] ) + elif status == "recreate": + self.parent.docker.compose.up( + build=True, + detach=True, + force_recreate=True, + quiet=True, + services=[self.name], + remove_orphans=True + ) else: logger.warn(f"Undefined status {status} - use up, down, or restart") except DockerException as error: