Advanced configuration topics

Provisioning scripts

After Steep’s cloud manager has created a VM, it uploads the provisioning scripts defined in the corresponding setup to the VM and executes them. The scripts can be used to deploy software to the VM and to make sure all required services (including Steep) are running.

Each provisioning script is a simple executable script file with a valid UNIX shebang at the beginning.

Script files will be processed by a template engine before they are uploaded. The following sections describe supported template instructions.

Global variables

Here is a list of the global variables defined in provisioning scripts:

VariableDescription
agentIdThe ID of the agent that is about to be deployed on the provisioned VM
ipAddressThe IP address of the provisioned VM
setupA Setup object that describes the configuration of the provisioned VM
attachedVolumesA list of volumes attached to the VM. Each item in the list has two properties: volumeId refers to the volume’s ID as assigned by the cloud provider; descriptor is a copy of the volume object as specified in the VM’s setup.
Example provisioning script
#!/usr/bin/env bash
 
echo {{ ipAddress }}

Environment variables

Access any environment variable defined on the system where Steep is running (not the VM to be provisioned) as follows:

{{ env["name_of_the_environment_variable"] }}
Example provisioning script
#!/usr/bin/env bash
 
echo "{{ env["TOKEN"] }}" > /etc/token.conf

Configuration values

Use values from Steep’s main configuration file (steep.yaml) as follows:

{{ config["name_of_the_configuration_item"] }}
Example provisioning script
#!/usr/bin/env bash
 
docker run -u root -d -p 5701:5701 -p 41187:41187 \
  --restart=on-failure --name steep \
  -e "STEEP_OUTPATH={{ config["steep.outPath"] }}" \
  -e "STEEP_TMPPATH={{ config["steep.tmpPath"] }}" \
  steep:latest

Read local files

Insert the contents of a local file into the provisioning script.

{{ readFile("path_to_the_file_to_insert") }}
Example provisioning script
#!/usr/bin/env bash
 
echo "{{ readFile("hello_world.txt") }}"

Upload local files to remote

Upload one or more local files to the remote VM.

{{ upload("source", "destination") }}

source may contain a glob pattern (e.g. *.sh or **/*.yaml) if you want to upload multiple files or if you want to recursively transfer a whole directory tree. In this case, destination should be a directory and it should exist.

Example provisioning script
#!/usr/bin/env bash
 
mkdir -p /etc/steep
{{ upload("conf/**/*.yaml", "/etc/steep") }}