Worker

An Worker is a Linux machine identified by its IP address and labels, defined in workers.json.


Maand uses SSH for communication, requiring user permissions and specific configurations.

Prerequisites

  1. User Permissions The SSH user (e.g., worker) must have:

    • Non-interactive command execution privileges.
    • Sudo/root access for administrative tasks.
  2. Key File Place the private SSH key (e.g., worker.key) in the secrets folder.


Configuration Steps

  1. Place Key File Move the worker.key file to the secrets directory:

    platform-services/secrets/worker.key
    

    Example Folder Structure

    .
    ├── data
    │   └── maand.db
    ├── logs
    │   └── maand.log
    ├── maand.conf
    ├── secrets
    │   ├── ca.crt
    │   └── ca.key
    │   └── worker.key  <==============================
    └── workspace
        ├── workers.json
        └── maand.jobs.conf
    
  2. Update maand.conf Configure SSH details in maand.conf:

    [default]
    ca_ttl = 3650           # Certificate Authority validity
    use_sudo = 1            # Enable sudo for privileged tasks
    ssh_user = worker       # SSH user
    ssh_key = secrets/worker.key  # Path to private SSH key
    
  3. Install Tools on Workers Ensure each agent has the following installed:

    • rsync, make, docker, docker-compose, python3.

Defining Workers

  1. Create the workers.json file in workspace/:
    [
      { "host": "10.27.221.181" },
      { "host": "10.27.221.144" },
      { "host": "10.27.221.170" }
    ]
    

Verify Setup

  1. Build Workspace Compile the changes: use build command always whenever changes made to workspace folder.

    $ maand build
    
  2. Verify Connectivity Test communication with workers:

    $ maand run_command 'uptime'
    [10.27.221.181] 14:39:54 up 1:06, load average: 0.11, 0.07, 0.01
    [10.27.221.170] 14:39:54 up 1:06, load average: 0.03, 0.08, 0.08
    [10.27.221.144] 14:39:54 up 1:06, load average: 0.12, 0.05, 0.01
    

Your setup is complete, and Maand is ready to orchestrate jobs across your workers.