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 > Edge Services.
  2. Click on the + Service button.
  3. Name this service Azion CLI Installation.
  4. Enter the variables and values for the resource, if necessary.
  5. Set the status as Active.
  6. Click the Save button.

Creating a resource

  1. On the upper-left corner of the page, open the Products menu, represented by three horizontal lines, and then select Edge Services.
  2. Select the edge service you’ve just created, called Azion CLI Installation.
  3. Go to the Resources tab.
  4. Click on + Resource.
  5. Enter /scripts/install-cli/ in the Path field.
  6. Choose the type Shell Script.
  7. Choose the trigger Install.
  8. 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 you want to bind to a service.
  3. Go to the Services tab.
  4. Choose the service.
  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