Setup Agents

The actual 'edge' of our Edge Compute Network ('ECN') is composed of Agents. The other component (the Controllers) can be deployed anywhere, including cloud infrastructure, but Agents can only live on standalone hosts.

Deploy Agents on Remote Hosts

Create a template of agent.yaml like so:

echo "---
apiVersion: iofog.org/v2
kind: Agent
metadata:
  name: zebra-1
spec:
  host: 38.101.23.10
  ssh:
    user: foo
    keyFile: ~/.ssh/id_rsa" > /tmp/agent.yaml

Make sure to edit the host, ssh.user, and ssh.keyFile fields to correspond with the remote host we are deploying to.

Once we have edited the fields to our liking, go ahead and run:

iofogctl deploy -f /tmp/agent.yaml

Verify the Deployment

We can use the following commands to verify the Agent is up and running:

iofogctl get agents
iofogctl describe agent zebra-1

Customize Agent Installation

iofogctl can install ioFog Agent on a number of Linux distributions out of the box. However, the list of supported distributions is finite; in order to allow the community to add support for any host environment, iofogctl provides the ability to run user-defined installation scripts for Agent and its dependancies.

iofogctl requires 3 scripts for this purpose: one for installing pre-requisites, one for installing ioFog Agent, and one for uninstalling ioFog Agent. Users can bundle any number of scripts but must provide scripts as entrypoints to the pre-requisite, installation, and unininstallation procedures if they wish to override them. Users can override any subset of the 3 procedures - they need not override all 3.

Here is an example of what a custom set of scripts might look like:

$ ls assets/agent
check_prereqs.sh
init.sh
install_deps.sh
install_docker.sh
install_iofog.sh
install_java.sh
uninstall_iofog.sh

And here is an example of what the corresponding Agent YAML spec would look like.

apiVersion: iofog.org/v2
kind: Agent
metadata:
  name: meerkat-1
spec:
  host: 34.82.205.186
  ssh:
    user: bob
    keyFile: ~/.ssh/id_rsa
  scripts:
    dir: assets/agent
    deps:
      entrypoint: install_deps.sh
    install:
      entrypoint: install_iofog.sh
      args:
        - 2.0.3
    uninstall:
      entrypoint: uninstall_iofog.sh

Upon Agent deployment, iofogctl will copy these scripts to /etc/iofog/agent/. It will then first invoke install_deps.sh as the entrypoint to the pre-requisites procedure. install_deps.sh will call install_java.sh and install_docker.sh directly. Finally, iofogctl will invoke install_iofog.sh as the Agent installation procedure.

Check out the YAML specification to get started!