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
Section titled Requirements- An edge node with Edge Orchestrator Agent installed and authorized.
- The Dpkg package manager installed on this node.
go to how to authorize an edge node
Via Azion Console
Section titled Via Azion ConsoleCreating an edge service
Section titled Creating an edge service- Go to Azion Console > Edge Libraries > Edge Services.
- Click on the Add Service button.
- Name this service
Azion CLI Installation
. - Click the Save button.
- On the list of services, set the status as active.
Creating a resource
Section titled Creating a resource- On the upper-left corner of the page, open the Products menu, represented by three horizontal lines, and then select Edge Libraries > Edge Services.
- Select the edge service you’ve just created, called
Azion CLI Installation
. - Go to the Resources tab.
- Click on Add Resource.
- Enter
/scripts/install-cli/
in the filepath field. - Choose the type Shell Script.
- Choose the trigger Install.
- Add the following content to the content block:
- 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
Section titled Binding an edge service to an edge node- On the upper-left corner of the page, open the Products menu, represented by three horizontal lines, and then select Edge Nodes.
- Select the edge node you want to bind to a service.
- Go to the Services tab.
- Choose the service.
- Click the Save button.
Via API
Section titled Via APICreating an edge service
Section titled Creating an edge service- Run the following
POST
request in your terminal, replacing[TOKEN VALUE]
with your personal token and informing the name of the service being created:
- Keep the ID of the edge service you’ve just created. You can access it in the response body, for example:
- Run the following
PATCH
request in your terminal to set the service as active, replacing[TOKEN VALUE]
with your personal token:
Creating a resource
Section titled Creating a resource- Run the following
POST
request in your terminal:
Replace [TOKEN VALUE]
with your personal token, :id
with the ID of the edge service and inform the following parameters in the request body:
Property | Description | Required |
---|---|---|
content_type | Content type of the resource being created | Yes |
name | Name of the resource being created | Yes |
content | Content that defines actions performed when the resource state changes in the edge node | Yes |
Binding an edge service to an edge node
Section titled Binding an edge service to an edge node- Run the following
GET
request in your terminal, replacing[TOKEN VALUE]
with your personal token and retrieve the edge node ID you wish to bind to an edge service:
- Run the following
POST
request in your terminal:
Replace [TOKEN VALUE]
with your personal token, :id
with the ID of the edge node and inform the ID of the service in the request body:
Property | Description | Required |
---|---|---|
service_id | ID of the edge service being bound to the edge node | Yes |
variables | Variables to be replaced during the processing on the edge node | No (requires checking) |
Accessing Azion CLI
Section titled Accessing Azion CLIAfter this process, in your edge node, access the folder:
Run:
The output will be similar to:
Contributors