Version 5 (modified by pruth, 7 years ago)

--

Using Flukes

Overview

Post Boot Scripts

Flukes allows a post boot script to be associated with each node or node group. Post boot scripts are the preferred way to create customized instances from a shared image. Specifically, a post boot script can contain an arbitrary script that is a executed immediately after the instance has booted.

Simple example:

   echo "Hello from post boot script script"
   apt-get install my-favorite-app
   echo node1 > /etc/hostname

For added functionality, ORCA uses velocity templates to create the scripts. See the user's guide for details about Velocity.

ORCA templates follow the Velocity syntax which can be used to replace several key pieces of data that are assigned by ORCA. Specifically, there is are one or more arrays that contains the IP addresses assigned to each instance. For each group there is an array of IP addresses referenced using the name provided to Flukes for the group. In addition, there is a variable called $MY_ADDR_INDEX that is the index of the IP address of the current instance within its group's array of IP addresses. All arrays of IP addresses are accessible from any post boot script in the current request.

The following is an example post boot script that adds an entry to the /etc/hosts file for each of the instances in the request and sets the hostname of each instance to an appropriate value. In this particular example, the first instance is assumed to be a master node named "master" while the remaining nodes are named worker1, worker2, ... The string "Group1" was used as the group name.

   # Test script 
   echo "Hello from post boot script"
   echo $Group1.get(0) master  >> /etc/hosts 
#set ( $size = $Group1.size() - 1 )
#foreach ( $i in [1..$size] )
   echo $Group1.get($i) worker$i >> /etc/hosts
#end
#if ( $MY_ADDR_INDEX == 0)
   echo master > /etc/hostname
#else
   echo condor-worker$MY_ADDR_INDEX > /etc/hostname
#end

Attachments