Linux Agent Installation Guide
This document shows how to install and manage the Linux agent for Unmeshed Job Scheduling Platform. The agent is a Java-based application which runs natively on Linux 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 Linux 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
- Linux distribution (Ubuntu, CentOS, RHEL, Amazon Linux, etc.)
- Minimum 2GB RAM (4GB recommended)
- At least 4GB free disk space (for logs and temporary files)
- Network access to the Unmeshed platform
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
- processes.yaml - Configuration file for the agent worker processes
- worker-logback.xml - Logging configuration for the worker processes
- monitor.jar - Monitoring and process management application
- start_monitor.sh - Shell script to start the monitoring service
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)
- monitor.jar - Monitoring application (optional, may be updated)
Download Links
Contact your Unmeshed support team to request download links for the following agent packages:
unmeshed-prerequisites.zip
- Prerequisites packageunmeshed-agent.zip
- Agent binary package
Installation
The installation process involves two main steps: installing prerequisites and then the agent binary. We'll use /unmeshed/agent/
as the installation directory.
Step 1: Install Prerequisites
-
Create the installation directory:
sudo mkdir -p /unmeshed/agent
sudo chown $USER:$USER /unmeshed/agent
cd /unmeshed/agent -
Download and extract the prerequisites package:
# Download the prerequisites zip file
wget <prerequisites-download-url>
# Extract the contents
unzip unmeshed-prerequisites.zip
# Verify the extraction
ls -laYou should see the following files and directories:
drwxr-xr-x jdk/
-rw-r--r-- processes.yaml
-rw-r--r-- worker-logback.xml
-rw-r--r-- monitor.jar
-rw-r--r-- start_monitor.sh -
Set proper permissions:
chmod +x start_monitor.sh
Step 2: Install Agent Binary
-
Download and extract the agent binary package:
# Download the agent binary zip file
wget <agent-download-url>
# Extract the contents (this will create/update workers.jar and optionally monitor.jar)
unzip unmeshed-agent.zip
# Verify the extraction
ls -la *.jarYou should see at least:
-rw-r--r-- workers.jar
-rw-r--r-- monitor.jar (optional, may be updated)
Configuration
Step 1: Configure the Agent Worker
Edit the processes.yaml
file to configure your agent:
vi processes.yaml
The file should contain the following configuration:
- command: "java -Xms1024m -Xmx1024m -Dlogback.configurationFile=./worker-logback.xml -jar workers.jar"
commandSearch: "jar workers.jar"
commandFile: "monitorworkers"
env:
UNMESHED_AUTH_ID: "<< auth id >>"
UNMESHED_AUTH_TOKEN: "<< token >>"
UNMESHED_ENGINE_URL: "<< server url >>"
UNMESHED_BASH_CUSTOM_WORKERS: ""
UNMESHED_BASH_MAX_CONCURRENT_WORKERS: 1000
UNMESHED_ENGINE_EMAIL_ENABLED: "false"
UNMESHED_EMAIL_SMTP_HOST: ""
UNMESHED_EMAIL_SMTP_PORT: ""
UNMESHED_EMAIL_SMTP_USER: ""
UNMESHED_EMAIL_SMTP_PASSWORD: ""
UNMESHED_WORK_RESPONSE_BATCH_SIZE: 120
Configuration Parameters
Field | Description |
---|---|
UNMESHED_AUTH_ID | This is a generated field from the Unmeshed Platform when you create a client application |
UNMESHED_AUTH_TOKEN | This is a generated field from the Unmeshed Platform when you create a client application |
UNMESHED_ENGINE_URL | HTTPS URL for the Unmeshed server the agent should connect to |
UNMESHED_BASH_CUSTOM_WORKERS | Advanced Configuration: Comma-separated list of custom worker specifications in the format namespace:name:maxConcurrentWorkers:false Example: default:custom-bash:50,prod:high-priority:100 Format: Each specification contains 3 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 handleDefault Behavior: If left empty, the agent registers a default bash worker under the "default" namespace with the name "bash" |
UNMESHED_BASH_MAX_CONCURRENT_WORKERS | Maximum number of concurrent bash commands that can be executed simultaneously |
UNMESHED_ENGINE_EMAIL_ENABLED | Enable/disable email sender worker |
UNMESHED_EMAIL_SMTP_HOST | SMTP server hostname for sending email |
UNMESHED_EMAIL_SMTP_PORT | SMTP server port (usually 25, 465, or 587) |
UNMESHED_EMAIL_SMTP_USER | SMTP server username for authentication |
UNMESHED_EMAIL_SMTP_PASSWORD | SMTP server password for authentication |
UNMESHED_WORK_RESPONSE_BATCH_SIZE | Number of work responses to batch together before sending to the server |
UNMESHED_BASH_CUSTOM_WORKERS Configuration
The UNMESHED_BASH_CUSTOM_WORKERS
parameter allows you to create multiple custom bash workers with different configurations. This is useful when you need different concurrency limits or want to separate workloads by namespace.
For Linux 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 Linux agents (required parameter)
Examples
Single Custom Worker:
UNMESHED_BASH_CUSTOM_WORKERS: "prod:high-priority-bash:100:false"
This configuration will query for jobs in the prod
namespace with the name high-priority-bash
and can run up to 100 concurrent tasks.
Multiple Custom Workers:
UNMESHED_BASH_CUSTOM_WORKERS: "default:standard-bash:50:false,prod:high-priority-bash:100:false,dev:testing-bash:25:false"
This configuration creates three workers:
default:standard-bash:50:false
- Namespacedefault
, jobs namedstandard-bash
, concurrency of 50prod:high-priority-bash:100:false
- Namespaceprod
, jobs namedhigh-priority-bash
, concurrency of 100dev:testing-bash:25:false
- Namespacedev
, jobs namedtesting-bash
, concurrency of 25
No Custom Workers (Default):
UNMESHED_BASH_CUSTOM_WORKERS: ""
# This registers a default bash worker under "default" namespace with name "bash"
Naming Recommendations
Use descriptive names that represent your host machine's purpose:
- Environment-based:
prod-web-server-bash
,staging-db-bash
,dev-testing-bash
- Function-based:
batch-processing-bash
,real-time-bash
,backup-server-bash
- Location-based:
us-east-1-bash
,eu-west-1-bash
,on-premise-bash
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 UNMESHED_BASH_CUSTOM_WORKERS: "default:backup-server-bash:10:false"
, only jobs defined with the name backup-server-bash
in the default
namespace will be executed on that machine.
Use Cases
- Environment Separation: Use different namespaces for dev, staging, and production
- Priority Management: Create high-priority workers with higher concurrency limits
- Resource Isolation: Separate different types of workloads (e.g., batch processing vs. real-time tasks)
- Testing: Dedicated workers for testing with lower concurrency limits
Step 2: Configure the Monitor Script
Edit the start_monitor.sh
file to set the correct working directory:
vi start_monitor.sh
Ensure the CURRENT_DIR
variable is set correctly:
export CURRENT_DIR=/unmeshed/agent
Important: Do not modify any other parts of this script unless you have specific requirements.
System Service Setup
Step 1: Create the Systemd Service
Create a systemd service file to manage the Unmeshed agent:
sudo vi /etc/systemd/system/unmeshed.service
Add the following content:
[Unit]
Description=Unmeshed Monitor
After=network.target
[Service]
Type=simple
WorkingDirectory=/unmeshed/agent/
ExecStart=/bin/bash -c '/unmeshed/agent/start_monitor.sh'
Restart=always
RestartSec=2
User=ec2-user
StartLimitBurst=0
[Install]
WantedBy=multi-user.target
Important Notes:
- User Field: Update
User=ec2-user
to the actual user that should run the process - Working Directory: Ensure the path matches your installation directory
- Permissions: The specified user must have read/write access to the
/unmeshed/agent/
directory
Step 2: Enable and Start the Service
# Reload systemd to recognize the new service
sudo systemctl daemon-reload
# Enable the service to start on boot
sudo systemctl enable unmeshed.service
# Start the service
sudo systemctl start unmeshed.service
Step 3: Verify Service Status
# Check service status
sudo systemctl status unmeshed.service
# View service logs
sudo journalctl -u unmeshed.service -f
# Check if the agent is running
ps aux | grep java
Verification
Check Agent Logs
The agent creates logs in the working directory. Look for the following log entry to confirm successful startup:
tail -f /unmeshed/agent/worker.log
You should see a log entry similar to:
[date - time] [pool-3-thread-1] INFO io.unmeshed.client.UnmeshedClient - Currently running
Check Service Status
# Service status
sudo systemctl status unmeshed.service
# Service logs
sudo journalctl -u unmeshed.service --no-pager -l
Operating the Unmeshed Agent
Service Management Commands
# Start the service
sudo systemctl start unmeshed.service
# Stop the service
sudo systemctl stop unmeshed.service
# Restart the service
sudo systemctl restart unmeshed.service
# Check service status
sudo systemctl status unmeshed.service
# View real-time logs
sudo journalctl -u unmeshed.service -f
Manual Process Management
If you need to run the agent manually (for debugging purposes):
cd /unmeshed/agent
./start_monitor.sh
Upgrading the Unmeshed Agent
Follow these steps to upgrade:
-
Stop the service:
sudo systemctl stop unmeshed.service
-
Download and extract the new agent binary:
cd /unmeshed/agent
wget <new-agent-download-url>
unzip unmeshed-agent.zip -
Start the service:
sudo systemctl start unmeshed.service
-
Verify the upgrade:
sudo systemctl status unmeshed.service
tail -f /unmeshed/agent/worker.log
Configuration Updates
The processes.yaml
configuration file is not included in agent upgrades. If you need to update your configuration or add new parameters, please contact the Unmeshed support team for guidance on any required changes.
Troubleshooting
Common Issues
-
Service fails to start:
- Check file permissions:
ls -la /unmeshed/agent/
- Verify Java installation:
java -version
- Check service logs:
sudo journalctl -u unmeshed.service -n 50
- Check file permissions:
-
Agent cannot connect to Unmeshed platform:
- Verify network connectivity:
ping <your-unmeshed-server>
- Check authentication credentials in
processes.yaml
- Verify firewall settings
- Verify network connectivity:
-
Permission denied errors:
- Ensure the service user owns the
/unmeshed/agent/
directory - Check file permissions:
chmod +x /unmeshed/agent/start_monitor.sh
- Ensure the service user owns the
-
Java memory issues:
- Adjust JVM memory settings in
processes.yaml
:-Xms1024m
(minimum heap size)-Xmx1024m
(maximum heap size)
- Adjust JVM memory settings in
Log Analysis
The agent creates several log files:
- worker.log - Main worker process logs
- monitor.log - Monitor process logs
- systemd logs - Service management logs
# View worker logs
tail -f /unmeshed/agent/worker.log
# View systemd service logs
sudo journalctl -u unmeshed.service -f
# Search for specific errors
grep -i error /unmeshed/agent/worker.log
Security Considerations
- File Permissions: Ensure only authorized users can access the agent configuration files
- Network Security: Use HTTPS connections to the Unmeshed platform
- Authentication: Keep your auth ID and token secure and rotate them regularly
- Service User: Run the service with minimal required privileges
- Firewall: Configure firewall rules to allow only necessary outbound connections
Performance Tuning
Memory Configuration
Adjust JVM memory settings based on your system resources:
command: "java -Xms2048m -Xmx4096m -Dlogback.configurationFile=./worker-logback.xml -jar workers.jar"
Concurrency Settings
Adjust based on your system's CPU cores and workload:
UNMESHED_BASH_MAX_CONCURRENT_WORKERS: 2000
Batch Processing
Optimize network communication:
UNMESHED_WORK_RESPONSE_BATCH_SIZE: 200
FAQs & Notes
- Service Auto-restart: The systemd service is configured to automatically restart if the process crashes
- Log Rotation: Consider implementing log rotation for long-running deployments
- Monitoring: Set up monitoring for the service status and resource usage
- Backup: Regularly backup your
processes.yaml
configuration file - Updates: Keep your Linux system updated for security patches
- Resource Monitoring: Monitor CPU, memory, and disk usage during operation