Running lifecycle scripts on virtual machines
When a virtual application is deployed, the lifecycle scripts are copied to the deployed virtual machines.
Before you begin
If you must debug and adjust the scripts, connect to the virtual machines by using SSH.
SSH must be configured on the virtual machine that you want to work with. If you do not have an SSH set up for the virtual application instance that contains the virtual machine, see "Configuring SSH key-based access."
For
the purposes of troubleshooting plug-ins, you might also consider
installing the debug and unlock plug-ins to help you debug more effectively.
For more information, see:
- "Debug plug-in"
- "Unlock plug-in"
Procedure
Deployed node startup flow
- Run
0config.sh
in /0config - Download activator .zip files, and extract
them from
BOOTSTRAP_URL
. - Change to the
/0config/start
directory and run .sh scripts in numerical order. Scripts start with a number. These instructions use the example5_exec_vm_tmpl.sh
. - The script
5_exec_vm_tmpl.sh
calls/0config/exec_vm_tmpl/exec_vm_tmpl.py
- The
exec_vm_tmpl.py
script reads the topology.json file, and for each node part does the following tasks:- Downloads the node part.
- Runs the
setup.py
script for the node part, if it exists. Thesetup.py
script has any parameters from the topology document that is set in its environment, available from the maestro package.
- The
5_exec_vm_tmpl.sh
script then calls node part installation scripts (.py or .sh) in numerical order from /0config/nodepkgs/common/install.To rerun this script:- For a .sh script
- Set up the environment:
. /0config/nodepkgs/common/scripts/pdk-debug/setEnv.sh cd /0config/nodepkgs/common/install
- Start the .sh script directly from the command line.
- Set up the environment:
- For a .py script
- Run the script with:
cd /0config/nodepkgs/common/install runScript.sh {script-name}
- The
5_exec_vm_tmpl.sh
script then calls node part start scripts (.py or .sh) in sequential order from/0config/nodepkgs/common/start
.To rerun this script:- For a .sh script
- Set up the environment:
. /0config/nodepkgs/common/scripts/pdk-debug/setEnv.sh cd /0config/nodepkgs/common/start
- Start the .sh script directly from the command line.
- Set up the environment:
- For a .py script
- Run the script with:
cd /0config/nodepkgs/common/start runScript.sh {script-name}
- The
/0config/nodepkgs/common/start/9_agent.sh
script starts last. This script starts themaestro
agent code which downloads and installs parts, and runs the part lifecycle scripts. - For each part, the following steps occur:
- Download the part .tgz file and extract into
{tmpdir}
. - Run
{tmpdir}/install.py
, passing any associated parameters that are specified in the topology document. - Delete
{tmpdir}
if the script is successful. The directory is not deleted if the script fails or if the virtual application is deployed with a debug component with Deployment for manual debugging configured.
- Download the part .tgz file and extract into
- Each role in the
vm-template
runs concurrently. For each role:- Run
{role}/install.py
, if it exists. - For each dependency of the role, run
{role}/{dependency}/install.py
, if it exists. - Run
{role}/configure.py
, if it exists. - For each dependency of the role, run
{role}/{dependency}/configure.py
, if it exists. - Run
{role}/start.py
, if it exists.
- Run
- React to changes in dependencies with
{role}/{dependency}/changed.py
and peers with{role}/changed.py
, if they exist.