How to configure a connection between two script components

In the topology, users can define how a SOURCE node connects to a TARGET node. For example, they may configure how a web application (i.e., a SOURCE node) connects to a database (i.e., a TARGET node).

Step 1. Drop

  • Drop two Bash components on two compute nodes (e.g., Bash_1 and Bash_2).

Step 2. Connect

  • Click on the connect_to_data_endpoint point of Bash_1 and connect to the data_endpoint of Bash_2:

Fig. Connect two script components

In this example, Bash_1 and Bash_2 are the SOURCE node and the TARGET node of the relationship, respectively.

Step 3. Configure source node

  • Click on Bash_1.
  • Provide the artifact for the operation post_configure_source. This operation will be executed on Compute_1 after the operation configure has completed successfully.

Fig. Provide post_configure_source

You may use this operation to configure Bash_1 to connect to Bash_2. For example:

#!/usr/bin/env bash
# Hello I am a script Bash_1 executing on Compute_1 to connect with Bash_2 at 10.0.0.4.
echo "Hello I am a script $SOURCE_NODE executing on $SOURCE_HOST to connect with $TARGET_NODE at $TARGET_IP."

In this example, some environment variables from both the source and target nodes (e.g., SOURCE_IP, TARGET_IP) are available in the script. For more environment variables, see this section.

Step 4. Add source node (optional)

  • Click on Bash_1.
  • Provide the artifact for the operation add_source. This operation will be executed on Compute_2 after Bash_1 has completed successfully.

Fig. Orchestration workflow between source node and target node

You may use add_source to notify Bash_2 that Bash_1 has completedly successfully. For example:

#!/usr/bin/env bash
# Hello I am a script Bash_1. I have completed and running at 10.0.0.3.
echo "Hello I am a script $SOURCE_NODE. I have completed and running at $SOURCE_IP."

Expected result

During the deployment, the resulting workflow between Bash_1 and Bash_2 is as follows:

Fig. Orchestration workflow between source node and target node

  • The orchestrator setups the TARGET node first (i.e., it calls the operation configure of Bash_2 on Compute_2).
  • Afterwards, it setups the SOURCE node to connect to the TARGET node (i.e., it calls the operation configure and post_configure_source of Bash_1 on Compute_1).
  • After the SOURCE node has started successfully, the orchestrator notifies the TARGET node (i.e., it calls the operation add_source of Bash_1 on Compute_2).