Unmeshed Logo

Command Runners (Agents)

Windows Agent Installation Guide

This document shows how to install and manage the Windows agent for Unmeshed Job Scheduling Platform. The agent is a Java-based application which runs natively on Windows machines and executes the scheduled jobs as configured on the Unmeshed Platform. The integration between agent and Unmeshed platform is protected by an access key and secret and happens over an HTTPS connection.

Prerequisites

Java Runtime Environment (JRE)

The Windows agent requires Java 22 or higher. The agent package includes a bundled JRE in the jdk folder, which is the recommended approach for consistent operation.

System Requirements

  • Windows 10/11 or Windows Server 2016/2019/2022 or newer versions
  • Minimum 2GB RAM (4GB recommended)
  • At least 4GB free disk space (for logs and temporary files)
  • Network access to the Unmeshed platform
  • Administrator privileges for service installation

Installation Files

Prerequisites Package: unmeshed-prerequisites.zip

This zip file contains the foundational components required for the agent to operate:

  • jdk/ - Java Development Kit folder containing the bundled JRE
  • worker-logback.xml - Logging configuration for the worker processes
  • start_agent.bat - Batch script to start the agent

Agent Binary Package: unmeshed-agent.zip

This zip file contains the main agent execution files:

  • workers.jar - Main worker execution engine (will be created/updated)
Request Access

Contact your Unmeshed support team to request download links for the following agent packages:

  • unmeshed-prerequisites.zip – Prerequisites package
  • unmeshed-agent.zip – Agent binary package

Installation

The installation process involves two main steps: installing prerequisites and then the agent binary. We'll use C:\unmeshed\agent\ as the installation directory.

Step 1: Install Prerequisites

  1. Create the installation directory:

    cmd
  2. Download and extract the prerequisites package:

    cmd

    You should see the following files and directories:

Install Agent Binary

  1. Download and extract the agent binary package:

    cmd

    You should see:

Configuration

Configure the Agent

In Windows, you configure the agent by editing the start_agent.bat file. This file contains all the necessary environment variables and Java settings.

Edit the start_agent.bat file:

cmd

The file should contain the following content with your specific values:

batch

Configuration Parameters

FieldDescription
JAVA_HOMEPoints to the bundled JDK in C:\unmeshed\agent\jdk
PATHUpdated to include the bundled JDK bin directory
JAVA_OPTSJVM memory settings (-Xms1024m for minimum, -Xmx1500m for maximum heap)
UNMESHED_AUTH_IDYour authentication ID from the Unmeshed Platform
UNMESHED_AUTH_TOKENYour authentication token from the Unmeshed Platform
UNMESHED_ENGINE_URLHTTPS URL for your Unmeshed server
UNMESHED_CMD_CUSTOM_WORKERSAdvanced Configuration: Comma-separated list of custom worker specifications in the format namespace:name:maxConcurrentWorkers:false

Example: default:custom-cmd:50,prod:high-priority:100

Format: Each specification contains 4 parts separated by colons:
- namespace: The namespace for this worker (e.g., "default", "prod")
- name: The worker name identifier
- maxConcurrentWorkers: Maximum number of concurrent jobs this worker can handle
- ioThread: Must be set to false for Windows agents (required parameter)

Default Behavior: If left empty, the agent registers a default cmd worker under the "default" namespace with the name "cmd"
UNMESHED_CMD_MAX_CONCURRENT_WORKERSMaximum number of concurrent cmd commands that can be executed simultaneously
UNMESHED_ENABLE_FILE_WATCHEREnable/disable file watching capabilities
UNMESHED_FILE_WATCHER_MAX_CONCURRENT_WORKERSMaximum concurrent file watcher workers

UNMESHED_CMD_CUSTOM_WORKERS Configuration

The UNMESHED_CMD_CUSTOM_WORKERS parameter allows you to create multiple custom cmd workers with different configurations. This is useful when you need different concurrency limits or want to separate workloads by namespace.

:::note For Windows agents, the ioThread parameter must always be set to false. :::

Format

Each worker specification follows the format: namespace:name:maxConcurrentWorkers:false

  • namespace: The namespace for this worker (e.g., "default", "prod", "dev")
  • name: The worker name identifier that will be used in job definitions
  • maxConcurrentWorkers: Maximum number of concurrent jobs this worker can handle
  • ioThread: Must be set to false for Windows agents (required parameter)

Examples

Single Custom Worker:

batch

This configuration will query for jobs in the prod namespace with the name high-priority-cmd and can run up to 100 concurrent tasks.

Multiple Custom Workers:

batch

This configuration creates three workers:

  • default:standard-cmd:50:false - Namespace default, jobs named standard-cmd, concurrency of 50
  • prod:high-priority-cmd:100:false - Namespace prod, jobs named high-priority-cmd, concurrency of 100
  • dev:testing-cmd:25:false - Namespace dev, jobs named testing-cmd, concurrency of 25

No Custom Workers (Default):

batch

Naming Recommendations

Use descriptive names that represent your host machine's purpose:

  • Environment-based: prod-web-server-cmd, staging-db-cmd, dev-testing-cmd
  • Function-based: batch-processing-cmd, real-time-cmd, backup-server-cmd
  • Location-based: us-east-1-cmd, eu-west-1-cmd, on-premise-cmd

Why unique names matter: Using unique, descriptive names ensures that specific jobs will always run on the intended machine. For example, if you have a backup server with set UNMESHED_CMD_CUSTOM_WORKERS=default:backup-server-cmd:10:false, only jobs defined with the name backup-server-cmd in the default namespace will be executed on that machine.

Windows Service Setup

Windows Task Scheduler is the native Windows solution and is recommended for most users. It's easier to set up and manage than third-party tools.

  1. Open Task Scheduler:

    • Press Win + R, type taskschd.msc, and press Enter
    • Or search for "Task Scheduler" in the Start menu
  2. Create Basic Task:

    • Right-click on "Task Scheduler Library" → "Create Basic Task"
    • Name: "Unmeshed Agent"
    • Description: "Starts the Unmeshed agent on system startup"
    • Click "Next"
  3. Set Trigger:

    • Select "When the computer starts up"
    • Click "Next"
  4. Set Action:

    • Select "Start a program"
    • Click "Next"
  5. Configure Program:

    • Program/script: C:\unmeshed\agent\start_agent.bat
    • Start in: C:\unmeshed\agent
    • Click "Next"
  6. Finish Setup:

    • Review your settings
    • Check "Open the Properties dialog for this task when I click Finish"
    • Click "Finish"
  7. Configure Advanced Properties:

    • In the Properties dialog, go to the "General" tab
    • Check "Run with highest privileges"
    • Go to the "Settings" tab
    • Check "Allow task to be run on demand"
    • Check "Run task as soon as possible after a scheduled start is missed"
    • Click "OK"

Verify Task Scheduler Setup

cmd

Verification

Check Agent Logs

The agent creates logs in the working directory. Look for the following log entry to confirm successful startup:

cmd

You should see a log entry similar to:

Check Process Status

cmd

Operating the Unmeshed Agent

Service Management Commands

cmd

Manual Process Management

If you need to run the agent manually (for debugging purposes):

cmd

Upgrading the Unmeshed Agent

Follow these steps to upgrade:

  1. Stop the agent:

    cmd
  2. Download and extract the new agent binary:

    cmd
  3. Start the agent:

    cmd
  4. Verify the upgrade:

    cmd

Troubleshooting

Common Issues

  1. Service fails to start:

    • Check file permissions: dir C:\unmeshed\agent
    • Verify Java installation: java -version
    • Check Windows Event Viewer for errors
  2. Agent cannot connect to Unmeshed platform:

    • Verify network connectivity: ping <your-unmeshed-server>
    • Check authentication credentials in start_agent.bat
    • Verify firewall settings
  3. Permission denied errors:

    • Ensure the service user has access to C:\unmeshed\agent
    • Check file permissions: C:\unmeshed\agent
  4. Java memory issues:

    • Adjust JVM memory settings in start_agent.bat:
      • -Xms1024m (minimum heap size)
      • -Xmx1500m (maximum heap size)

Log Analysis

The agent creates several log files:

  • workers.log - Main worker process logs
  • Windows Event Viewer - Service management logs
cmd

Security Considerations

  1. File Permissions: Ensure only authorized users can access the agent configuration files
  2. Network Security: Use HTTPS connections to the Unmeshed platform
  3. Authentication: Keep your auth ID and token secure and rotate them regularly
  4. Service User: Run the service with minimal required privileges
  5. Firewall: Configure firewall rules to allow only necessary outbound connections

Performance Tuning

Memory Configuration

Adjust JVM memory settings based on your system resources:

batch

Concurrency Settings

Adjust based on your system's CPU cores and workload:

yaml

Batch Processing

Optimize network communication:

yaml

FAQs & Notes

  1. Service Auto-restart: Configure the Windows service to automatically restart if the process crashes
  2. Log Rotation: Consider implementing log rotation for long-running deployments
  3. Monitoring: Set up monitoring for the service status and resource usage
  4. Backup: Regularly backup your start_agent.bat configuration file
  5. Updates: Keep your Windows system updated for security patches
  6. Resource Monitoring: Monitor CPU, memory, and disk usage during operation

Alternative: Using NSSM (Advanced Users)

For users who prefer a service style manager, you can use NSSM (Non-Sucking Service Manager).

NSSM Installation

  1. Download NSSM from https://nssm.cc/download

  2. Install the service:

    cmd
  3. Additional NSSM Settings (Optional but Recommended):

    cmd

Verify NSSM Service

cmd

NSSM Service Management

cmd