How to run scripts on edge nodes

To be able to orchestrate services on your device, you must configure all the resources needed to install, uninstall, and reload your services.

This guide presents how to install Azion CLI on your edge nodes through a resource of the type Shell Script configured on a specific edge service.


Requirements

  • An edge node with Edge Orchestrator Agent installed and authorized.
  • The Dpkg package manager installed on this node.
Go to how to install edge orchestrator agent Go to how to authorize an edge node

Creating an edge service

  1. Access Azion Console.
  2. On the upper-left corner of the page, open the Products menu, represented by three horizontal lines, and then select Edge Services.
  3. Click on the + Service button.
  4. Name this service Azion CLI Installation.
  5. Enter the variables and values for the resource, if necessary.
  6. Set the status as Active.
  7. Click the Save button.

Creating a resource

  1. Inside the service you’ve just created, called Azion CLI Installation, go to the Resources tab.
  2. Click on + Resource.
  3. Enter /scripts/install-cli in the Path field.
  4. Choose the type Shell Script.
  5. Choose the trigger Install.
  6. Add the following content to the Content block:
#!/bin/bash # Define the URL of the binary to download
BINARY_URL="https://github.com/aziontech/azion/releases/download/1.10.2/azion_1.10.2_linux_arm64.deb" # Download the binary
wget $BINARY_URL -O /tmp/azion.deb # Install the binary
# This assumes that you have dpkg installed on your system
sudo dpkg -i /tmp/azion.deb # Clean up the downloaded binary
rm /tmp/azion.deb echo "Installation completed successfully"
  1. Click the Save button.

This script will install the Azion binary in the following path: /usr/local/bin


Binding an edge service to an edge node

  1. On the upper-left corner of the page, open the Products menu, represented by three horizontal lines, and then select Edge Nodes.
  2. Select the edge node to which you want to bind a service.
  3. Go to the Services tab and click the + Service button.
  4. Choose the service Azion CLI Installation you’ve created.
  5. Click the Save button.

Accessing Azion CLI

After this process, in your edge node, access the folder:

Terminal window
cd /usr/local/bin

Run:

Terminal window
./azion -h

The output will be similar to:

Terminal window
Azion CLI 1.10.2
DESCRIPTION
The Azion Command Line Interface is a unified tool to manage your Azion projects and resources
SYNOPSIS
azion <command> <subcommand> [flags]
EXAMPLES
$ azion
$ azion -t azionb43a9554776zeg05b11cb1declkbabcc9la
$ azion --debug
$ azion -h
...

Contributors