-
Notifications
You must be signed in to change notification settings - Fork 53
Add new idle stop order examples #109
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
vkalapov
wants to merge
2
commits into
main
Choose a base branch
from
bg-stop-reorder
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
110 changes: 110 additions & 0 deletions
110
blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/README.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| = 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 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. | ||
|
|
||
| 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 | ||
Binary file added
BIN
+299 Bytes
...green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/content/hello_world.zip
Binary file not shown.
Binary file added
BIN
+1.65 KB
blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/hello.mtar
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
blue-green-deploy-strategy/blue-green-dependency-aware-idle-stop-order/mta.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add one more line for an example without a global param in the descriptor but a cmd flag begin passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the example cli option usage to the parameter introduction.