Release Pipeline DR
The release_pipeline_dr.py
script is an example of how to perform a DR failover for two atoms within a single Boomi Environment and with an active-active DR configuration. The script will turn off schedules and listeners in the atom that is down and turn on schedules and listeners on the other atom. When the down atom come back online, it will initially sync with the Boomi platform and the action to turn off schedules and listeners will occur then. The script will loop through the release file that is used within the release_pipeline script. That way, the same processes that are deployed during the initial release will failover.
1import boomi_cicd
2
3
4# This script is used to turn off listener and batch schedules in primary atom and on in DR
5# The atoms are set up in an active-active configuration within the same environment
6# No persisted properties are being used on the primary atom
7
8# Open release json
9releases = boomi_cicd.set_release()
10
11# Get atom id
12atom_id = boomi_cicd.query_atom(boomi_cicd.ATOM_NAME)
13atom_dr_id = boomi_cicd.query_atom(boomi_cicd.ATOM_NAME_DR)
14
15for release in releases["pipelines"]:
16 component_id = release["componentId"]
17 # Turn off listener in primary and on in DR
18 if "listenerStatus" in release:
19 boomi_cicd.change_listener_status(component_id, atom_id, "pause")
20 boomi_cicd.change_listener_status(component_id, atom_id, "resume")
21
22 # Pause schedules in primary and resume in DR
23 if "schedule" in release:
24 # Get conceptual id of deployed process
25 conceptual_id = boomi_cicd.query_process_schedule_status(atom_id, component_id)
26 conceptual_id_dr = boomi_cicd.query_process_schedule_status(
27 atom_dr_id, component_id
28 )
29
30 boomi_cicd.update_process_schedule_status(
31 component_id, conceptual_id, atom_id, False
32 )
33 boomi_cicd.update_process_schedule_status(
34 component_id, conceptual_id_dr, atom_dr_id, True
35 )
Required Environment Variables
Environment Variable |
Description |
---|---|
BOOMI_ACCOUNT_ID |
The Boomi account ID. |
BOOMI_ATOM_NAME |
The name of the Boomi Atom. |
BOOMI_ATOM_NAME_DR |
The name of the Boomi Atom. |
BOOMI_BASE_URL |
The base URL for the Boomi API. https://api.boomi.com/api/rest/v1 |
BOOMI_PASSWORD |
The Boomi password. Atomsphere API Token is recommended |
BOOMI_RELEASE_FILE |
The name of the release JSON file to use. |
BOOMI_USERNAME |
The Boomi username. Atomsphere API Token is recommended |
Command Line Arguments
-r, –release_file: The release JSON file to use. If not specified, then the BOOMI_RELEASE_FILE environment variable will be used.
Release JSON File
1{
2 "pipelines": [
3 {
4 "processName": "An Example Batch Process",
5 "packageVersion": "2.0",
6 "componentId": "83d6013f-96f5-4a75-a97b-f4934b0ec2e8",
7 "notes": "This is an example set of notes",
8 "schedule": "0 0 1 * * * ; 30 0 2-7 * * *",
9 "automatedTestId": "used within automated_testing.py"
10 },
11 {
12 "processName": "An Example Listener Process",
13 "packageVersion": "1.0",
14 "componentId": "b24f310b-6a66-4e0d-97a3-26f1e812b79a",
15 "notes": "This is an example set of notes",
16 "listenerStatus": "RUNNING"
17 },
18 {
19 "processName": "An Example Custom Library",
20 "componentId": "7bd40730-6df3-4ba9-b4b2-ed9153dbca6d",
21 "packageVersion": "1.0",
22 "notes": "Initial deployment"
23 }
24 ]
25}