Linux

Customization Script Modules and Execution Overview

Some Linux OS adaptation scripts are provided by Velostrata as default, as part of the Velostrata RPM installation. Rules for the Velostrata scripts are located here:

/opt/velostrata/actions/<PHASE>.rules

Additionally, a system admin can define custom scripts. The rules for these scripts would be located here:

/etc/velostrata/actions/<PHASE>.rules

Note: We will focus in this section on custom scripts, but the mechanism for Velostrata scripts is the same. Do not change the Velostrata scriptslocated in  the /opt/… folder.

<PHASE> can be one of the following values and reflects the project phase of the VM:

-       origin – the scripts will run when the VM is on-prem

-       velos – the scripts will run when the VM is running in “cache on demand” mode

-       detach – the scripts will run after the detach operation

 Notes:

  • The scripts are executed by the velostrata.init service, which is triggered on every boot. If you wish to avoid running the scripts multiple times, the script should manage this option.
  • Linux is case-sensitive. Make sure to use lower-case for PHASE definitions

Rules Definitions

The actions that are run by the service are defined using a set of rules. The framework goes over the rules in a defined order and executes the rule based on the parameters provided.

Rule parameters:

  • NAME: Unique rule name.
  • PLATFORM: Cloud or platform to run rule on (aws, azure, any).
  • TEST: Simple setting to test for a file's existence. If a path specified, the rule is only executed if the file/directory path exists. This could be leveraged to check if the script was already ran (i.e. by writing a file to signal that).
  • ACTION: Bash script to run or an inline command.
  • REQUIRESoptional field for required services for rule to run (currently, only "rc.local" is supported).

Example Rules:

# adjust network settings

NAME="fix-network-config", PLATFORM="any", TEST="", ACTION="/usr/sbin/velostrata-fix-network-config"

 

#finetune machine to work optimally in Azure

NAME=" Azure_tweaks", PLATFORM="azure", TEST="", ACTION="/usr/sbin/velostrata-azure-tweaks"