How to configure a script component on a compute node

Step 1. Drop

  • Drop the Bash component on a compute node.

Fig. Bash component properties

Step 2. Write a script and upload to the editor

  • Go to achieve content (on the left panel). This section displays the file directory of the application topology.

Fig. Open file directory of the application topology

  • Write a bash script (e.g., configure.sh)
#!/usr/bin/env bash
echo "Start configuring $NODE on compute $HOST"
echo "I have the ip address: $ip_address"

In this exmple, the script uses some environment variables, for instance NODE, HOST, and ip_address, which print the component name (e.g., Bash_1), the hosted compute node (e.g., Compute_1), the IP address of the hosted compute node at runtime, respectively.

tip

The environment variables of the Bash component are available in the configuration script for convenience. For more environment variables, see this section)

  • Upload configure.sh to the achieve content.

Fig. An example of the configure operation

Step 3. Choose an artifact

  1. Click on the Bash component, go to the Artifacts section. In this section, you can control the lifecycle of the Bash component by providing configuration scripts.
  2. Click configure / Select artifact and select the script configure.sh which you uploaded to the archieve content (in step 2).

Fig. Providing artifacts for a Bash component

Expected result

During the deployment, the deployment logs will print the following message when Bash_1 is configured on the compute node:

Start configuring Bash_1 on compute Compute_1
I have the ip address: 10.0.0.3