Skip to content

EdgeNet-project/node

Repository files navigation

EdgeNet Node Setup

Go Report Card GitHub Workflow Status GitHub Workflow Status GitHub release (latest SemVer)

📌 For instructions on how to use and how to contribute a node to EdgeNet, please see the EdgeNet website.

Architecture

This repository contains the code necessary to automatically deploy an EdgeNet node. It consists of three parts:

  1. The bootstrap script which installs Ansible and runs the node playbook with ansible-pull.
  2. The Ansible roles, which setups SSH access, containerd, Kubernetes and the EdgeNet service.
  3. The EdgeNet service, which is run on every boot, via systemd, to configure the node hostname and network. It will also join the node to the cluster, if not already joined.

In most cases users will run the bootstrap script and wait until the node is ready. However, it is also possible to run the node playbook directly on the target machines with ansible-playbook.

Bootstrap script

The bootstrap.sh script installs Ansible and Git, and runs the node playbook. It can be configured with the following environment variables:

Name Default Description
EDGENET_ASK_CONFIRMATION 1 Whether to ask to continue or not.
EDGENET_PLAYBOOK edgenet-node.yml Name of the playbook to run.
EDGENET_REF main Git reference to use.
EDGENET_REPOSITORY https://github.com/EdgeNet-project/node.git URL of the Git repository containing the playbook to run.

Ansible roles

Create an EdgeNet user with SSH access and passwordless sudo.

Variable Default Description
edgenet_ssh_user edgenet EdgeNet SSH user
edgenet_ssh_port_alt 25010 Alternative SSH port if port 22 is unavailable
edgenet_ssh_public_key [...] edgenet.planet-lab.eu (2021) Public SSH key of the EdgeNet user

Setup Docker and Kubernetes.

Variable Default Description
edgenet_service_state restarted State of the EdgeNet systemd service
edgenet_node_version - The release of the EdgeNet service to install
containerd_version - The containerd version to install
kubernetes_version - The kubernetes version to install

EdgeNet service

The EdgeNet service is written in Go, in the main.go file and the pkg/ directory.

Development

Run the local bootstrap script with the local Ansible playbook

git clone git@github.com:EdgeNet-project/node.git && cd node
env EDGENET_REF="$(git rev-parse HEAD)" EDGENET_REPOSITORY="file://$(pwd)" ./bootstrap.sh

Run the Ansible playbook locally

git clone git@github.com:EdgeNet-project/node.git && cd node
ansible-playbook --connection=local --inventory localhost, edgenet-node.yml

Use the Ansible playbook from a specific branch

export EDGENET_REF=my-branch
bash -ci "$(wget -O - https://raw.githubusercontent.com/EdgeNet-project/node/${EDGENET_REF}/bootstrap.sh)"

Update the node binary

  1. Create a GitHub release and wait for the completion of the associated workflow
  2. Update edgenet_node_version in vars/edgenet-production.yml

Alternatively, for debugging, you can compile the node binary locally and directly upload it to /opt/edgenet/node on the remote node.

Cluster-wide play

To run a playbook across all the nodes of the cluster:

kubectl get nodes -l node-role.kubernetes.io/control-plane!= -o json | jq -r '.items[].status.addresses[0].address' > nodes.ini
ansible-playbook -i nodes.ini ...

Contributing

The EdgeNet software is free and open source, licensed under the Apache 2.0 license; we invite you to contribute. For more information, see EdgeNet-project/edgenet.