Definition and Scope¶
Scripts can be used to automate various configuration items on the operating system that Scalr is provisioning. Scalr supports generic scripting, it is not a proprietary language.
Scripts can be created and stored within Scalr or they can be pulled from a Git Repo at the time of execution.
The Git Repository feature supports any repository that uses the Git Protocol, such as git, github, bitbucket etc
Scripts can be created, updated, edited, or deleted at the Scalr, Account, or Environment scopes. To create a script you can click on the Scalr icon on the top left of any of the scopes, in this example it is at the Environment scope:
Creating Scripts in Scalr¶
Once you are in the scripts screen, click on “New Scalr Script”:
|Name||String||Name of the script|
|Description||String||Description of the script|
|Deprecated||Binary||Scripts can be deprecated to prevent further use|
|Shared||Binary||Determines if a script can be used at a lower level. This is only seen at the Account and Scalr scopes.|
|Execution Mode||Binary||Blocking: Scalarizr will wait for your Script to finish executing before firing and processing further events Non-Blocking: Scalarizr will not wait for your Script to finish executing before firing and processing further events|
|Timeout||Integer||Length in seconds before the script should timeout|
|Script Content||String||Script contents|
There are a couple ways to execute scripts in Scalr:
- In Orchestration Rules: At all three main scopes and in Roles and Farm Roles a user can create orchestration rules and assign a lifecycle event to trigger the script.
- Manually Triggered: Users can select a Farm or Farm Role and manually trigger a script on the running servers within the Farm or Farm Role. A single server within a Farm can also be selected to trigger a script on. This is a good way to test scripts before placing them within Farm Role orchestration.
Using Scripts In Orchestration¶
For details on using scripts in Orchestration Rules please follow the link to the relevant section.
Manually On Farms, Farm Roles, or Servers¶
As mentioned above, scripts created within Scalr can also be manually executed on running servers. There are two ways to do this:
The advanced configuration section is available through all script execution methods, it allows you to control various aspects of how the Action is executed.
|Execution Mode||Blocking: Scalarizr will wait for your Script to finish executing before firing and processing further events|
|Non-Blocking: Scalarizr will not wait for your Script to finish executing before firing and processing further events|
|Timeout||Length in seconds before the script should timeout. This should be increased for complex actions, especially those that download from the internet.|
|Order||Sequence in which rules must be executed. This defaults to the order in which the rules are created.|
|Run As||For Scripts and Chef only defines the user to execute the script as on the server.|
Promoting Scripts to Higher Scopes¶
Scripts can be promoted to higher scopes to make them more widely available.