Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Fix stopping an app that deploys on compose slots

Juan Denisbee7a4a1aaae
diff --git a/backend/app/services/application_lifecycle_service.py b/backend/app/services/application_lifecycle_service.py
index 0341ab1a..58009d66 100644
--- a/backend/app/services/application_lifecycle_service.py
+++ b/backend/app/services/application_lifecycle_service.py
@@ -216,7 +216,6 @@ def stop_application(app, *, user_id=None):
WorkerProcessService.each(app, 'stop')
# A stopped app keeps no warm standby running behind it.
if getattr(app, 'slot_deploys_enabled', False):
- from app.services.slot_deploy_service import SlotDeployService
SlotDeployService.stop_standby(app)
else:
result = DockerService.compose_down(
diff --git a/backend/tests/test_plan87_compose_slots.py b/backend/tests/test_plan87_compose_slots.py
index c69c6093..6597856a 100644
--- a/backend/tests/test_plan87_compose_slots.py
+++ b/backend/tests/test_plan87_compose_slots.py
@@ -360,6 +360,11 @@ def test_lifecycle_and_status_follow_the_live_project(app, compose_world):
lifecycle.restart_application(row)
assert w.compose_calls[-1] == ('shop-b', 'restart')
+ lifecycle.stop_application(row)
+ assert w.compose_calls[-2:] == [('shop-b', 'stop'), (sc.original_project(row), 'stop')], \
+ 'the live project stops, then the standby'
+ assert row.status == 'stopped'
+
index = _ContainerIndex([
{'id': '1', 'name': 'shop-b-web-1', 'project': 'shop-b', 'state': 'running'},
{'id': '2', 'name': 'x-web-1', 'project': sc.original_project(row), 'state': 'exited'},