The Nex Agent is responsible for managing only one workload. Through the agent's API, the node can request that a workload be deployed, undeployed, or (for functions) triggered.
Internal to the agent is the logic that determines how the workload is managed. We have a provider system in the Go code that makes it easy for us to expand and enhance the types of workloads we support.
Workloads are currently handled as follows:
All function-type workloads must rely on host services in order to interact with managed resources like key-value buckets, publication/request, object stores, and more.
The agent process is the nex-agent binary produced by this Go code. This binary is not executed directly by the Node process, nor is it ever launched by developers or users.
The agent resides within the root file system. When you launch a Firecracker virtual machine, it isn't quite like issuing a Docker run command. Launching a Firecracker VM is like booting an operating system. In order to tell a Linux operating system what processes to start when launched (e.g. when the Firecracker VM boots), we need an init system.
Init systems can be confusing and intimidating. When you distill it down to the core, the init process in Linux is just the first process started during boot. Depending on which application you use for init, you configure your startup services and other boot-time launch activity differently.
For reasons that we won't get into here, it's not a good idea to make a process like nex-agent be the init process. Rather, we want the init process to spawn and manage the nex-agent.
To do this, we're using OpenRC. The default OpenRC configuration used for the agent is as follows:
This script defines the basic properties of our OpenRC service. The service, "Nex Agent", runs as the user nex within the group nex and the executable file is /usr/local/bin/agent. It's also important to note that this service cannot be started until after the net.eth0 device has been initialized.
For more information on how the agent is physically placed into the root file system, continue on to the next section where we cover the root file system.