From fe576d171e0a209b14ceab51748e7b3442701090 Mon Sep 17 00:00:00 2001 From: vkalapov <87693906+vkalapov@users.noreply.github.com> Date: Mon, 2 Feb 2026 12:08:23 +0200 Subject: [PATCH 1/2] Add new idle stop order examples LMCROSSITXSADEPLOY-3367 --- .../README.adoc | 109 ++++++++++++++++++ .../content/hello_world.zip | Bin 0 -> 299 bytes .../hello.mtar | Bin 0 -> 1692 bytes .../mta.yaml | 20 ++++ 4 files changed, 129 insertions(+) create mode 100644 blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc create mode 100644 blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/content/hello_world.zip create mode 100644 blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/hello.mtar create mode 100755 blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/mta.yaml diff --git a/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc b/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc new file mode 100644 index 0000000..421e9fd --- /dev/null +++ b/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc @@ -0,0 +1,109 @@ += Dependency-Aware Stop Order in Blue-Green Deployments +:toc: +:toclevels: 2 + +== Overview + +This example demonstrates how to use the `bg-dependency-aware-stop-order` parameter together with the `deployed-after` attribute to prevent transient failures during blue-green deployments of MTAs. + +In complex application setups, some modules depend on others being continuously available. During the final phase of a blue-green deployment, idle applications are restarted and stopped. If this happens in an incorrect order, dependent modules may temporarily lose access to their dependencies, leading to request failures. + +== Scenario + +The MTA consists of the following modules: + +* `provider-app` – a module that must remain available +* `consumer-app` – an application module that depends on `provider-app` + +The `consumer-app` module communicates with `provider-app` during runtime. If `provider-app` is stopped while `consumer-app` is still running, requests from `consumer-app` to `provider-app` will fail. + +== Problem + +During a standard blue-green deployment: + +. Idle versions of all modules are started. +. The deployment enters the final (resume) phase. +. Idle applications are stopped and restarted. + +Without dependency-aware ordering, `provider-app-idle` may be stopped while `consumer-app-idle` is still running, causing transient failures due to the temporary unavailability of `provider-app`. + +== Solution + +Enable dependency-aware stop order using one of the following options: + +* Set the global parameter `bg-dependency-aware-stop-order` in the deployment descriptor +* Use the deployment flag `--dependency-aware-stop-order` + +NOTE: When both are specified, the command-line flag `--dependency-aware-stop-order` takes precedence over the descriptor parameter. + +This ensures that during the final phase of the blue-green deployment: + +* Dependent modules are stopped first +* Dependencies remain available +* Dependencies are restarted before dependent modules are updated and started + + +== Example Deployment + +Deploy the application using the blue-green strategy: + +[source,bash] +---- + cf deploy hello.mtar --strategy blue-green --skip-testing-phase +Deploying multi-target app archive hello.mtar in org ... / space ... as ... +... +Operation ID: 42063835-fde4-11f0-b2f9-eeee0a981ee1 +Deploying in org "..." and space "..." +Detected MTA schema version: "3" +No deployed MTA detected - this is initial deployment of MTA with ID "hello-world" +Detected new MTA version: "1.0.0" +Creating application "provider-app-idle" from MTA module "provider-app"... +Uploading application "provider-app-idle"... +Started async upload of application "provider-app-idle" +Staging application "provider-app-idle"... +Application "provider-app-idle" staged +Starting application "provider-app-idle"... +Application "provider-app-idle" started and available at "..." +Creating application "consumer-app-idle" from MTA module "consumer-app"... +Uploading application "consumer-app-idle"... +Started async upload of application "consumer-app-idle" +Staging application "consumer-app-idle"... +Application "consumer-app-idle" staged +Starting application "consumer-app-idle"... +Application "consumer-app-idle" started and available at "..." +---- + +Resume phase: + +[source,bash] +---- +Detected new MTA version: "1.0.0" +Application "consumer-app-idle" stopped +Updating application "provider-app-idle"... +Renaming application "provider-app-idle" to "provider-app"... +Stopping application "provider-app"... +Starting application "provider-app"... +Application "provider-app" started and available at "..." +Updating application "consumer-app-idle"... +Renaming application "consumer-app-idle" to "consumer-app"... +Starting application "consumer-app"... +Application "consumer-app" started and available at "..." +Skipping deletion of services, because the command line option "--delete-services" is not specified. +Process finished. +Use "cf dmol -i 42063835-fde4-11f0-b2f9-eeee0a981ee1" to download the logs of the process. +---- + +We can see that with dependency-aware stop order enabled in the resume phase: + +* `consumer-app` is stopped before `provider-app` +* `provider-app` is restarted before `consumer-app` is started again + + +== Notes + +* This parameter affects only the final phase of a blue-green deployment. +* It does not affect the testing phase, during which both live and idle applications run in parallel. +* The feature is disabled by default and must be explicitly enabled. + +For more information, see: +https://help.sap.com/docs/btp/sap-business-technology-platform/parameters-and-properties#parameters diff --git a/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/content/hello_world.zip b/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/content/hello_world.zip new file mode 100644 index 0000000000000000000000000000000000000000..c81caa195935283aa83dee1bf9b2ba15c687c9e1 GIT binary patch literal 299 zcmWIWW@Zs#U|`^2`02ObCv2m*7cY><4a8hPoSB!BTA`OwlAH6{)^ZR#IEF zQQ+yS*Zcp!Uwz?)tT^}j8{(6u{n5L(!`a~yf478@@>(wCfkNr1x{&|zbBkit(&;3@KoZIO`nclkX<5a#(jC&44XfD zdF^kmxAl&`R@M5qzGA7ZosXrBtbBV`z$3P)`c8-arKdE`D!$Li!0`WnfHymbfVXbW zCSZ`50!46pUI^Lqxh07ydX&peFK>^YJ)mLn`q%5nwO>+G19x8doo4#TWbQJ{J$v2OoVocVYhLh%lDfsczpSs23 zt84Z9U&i09H<@r_ldR98=Z^n1pVZy{`}_HH6|-wccF8OXFZGhYcEskQa@%_zgxBk2 z^TA&ChI<{9G|=d?JltkyU;&%AT#{hQVO+luF0w|{!_ z1j8kkNoffu*4%%5xPirC(LvQt)tM(VXIidgyw~INiDySoc;l^N-(gb(EwRLwlXTf8`UV}EC9;mFz~if7Z}ZOr(ouIm_Z;7 z*m4ZSAdsIlm>6*8A5_O6r!Y_sf`KKCG3aLCN+HBMD~y?e0VUDF^CZj+Sa9QZRu{S% VxShqy2J#I%5HbP%(!v7b0RU_<6&U~k literal 0 HcmV?d00001 diff --git a/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/mta.yaml b/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/mta.yaml new file mode 100755 index 0000000..1388859 --- /dev/null +++ b/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/mta.yaml @@ -0,0 +1,20 @@ +_schema-version: 3.3.0 +ID: hello-world +version: 1.0.0 +parameters: + bg-dependency-aware-stop-order: true + +modules: +- name: provider-app + type: staticfile + path: content/hello_world.zip + parameters: + memory: 64M + +- name: consumer-app + type: staticfile + path: content/hello_world.zip + deployed-after: + - provider-app + parameters: + memory: 64M From fd83d528b3396c10fa490cbdca7be4ca534c7ea9 Mon Sep 17 00:00:00 2001 From: vkalapov <87693906+vkalapov@users.noreply.github.com> Date: Tue, 3 Feb 2026 10:35:33 +0200 Subject: [PATCH 2/2] Improvements from comments --- .../blue-green-dependency-aware-idle-stop-order/README.adoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc b/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc index 421e9fd..617efc6 100644 --- a/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc +++ b/blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc @@ -31,8 +31,9 @@ Without dependency-aware ordering, `provider-app-idle` may be stopped while `con Enable dependency-aware stop order using one of the following options: -* Set the global parameter `bg-dependency-aware-stop-order` in the deployment descriptor -* Use the deployment flag `--dependency-aware-stop-order` +Set the global boolean parameter bg-dependency-aware-stop-order (default: false) in the deployment descriptor, or enable it at deploy time using the command-line option: + +`cf deploy hello.mtar --strategy blue-green --dependency-aware-stop-order` NOTE: When both are specified, the command-line flag `--dependency-aware-stop-order` takes precedence over the descriptor parameter.