Deploy Swiftlet
Overview
The Deploy Swiftlet manages the deployment of SwiftMQ bundles (modules) into the router. It monitors specified directories for deployment changes and automatically installs, updates, or removes bundles as files are added, changed, or deleted. This Swiftlet enables dynamic extension and management of router functionality without requiring a restart.
Features
Automated Bundle Deployment
The Deploy Swiftlet monitors one or more deployment directories (called deploy spaces) for changes. Each deploy space is configured with a file system path and a check interval. When a new bundle file is added to a deploy space directory, the Swiftlet detects the addition and installs the bundle automatically. If a bundle file is modified, the Swiftlet updates the deployment by removing the old bundle and installing the new version. If a bundle file is removed, the Swiftlet undeploys the bundle. This process is handled by periodically scanning the directory at the configured interval, ensuring that deployments are kept in sync with the contents of the deployment directory.
Deploy Space Configuration
Each deploy space represents a monitored directory for bundle deployment. The path to the directory is specified in the configuration and is mandatory. The check interval determines how frequently the directory is scanned for changes. Deploy spaces can be added or removed dynamically, and each operates independently.
Deployment Event Handling
The Swiftlet responds to three types of bundle events: addition, removal, and change. For each event, it logs the action and updates the internal usage tracking. In the case of errors during deployment, the Swiftlet logs the error, removes the problematic bundle, and requires the user to correct the issue before redeploying.
Usage Tracking
The Swiftlet maintains a usage list that records active deployments, including the deployment time and directory for each bundle. This information is available for management and monitoring purposes.
Configuration Example:
<swiftlet name="sys$deploy">
<deploy-spaces>
<deploy-space name="main" path="/opt/swiftmq/deploy" check-interval="30000"/>
</deploy-spaces>
</swiftlet>
Configuration Guide
Deploying Bundles from a Custom Directory
Use this scenario when you want to manage SwiftMQ bundle deployments from a specific directory on your file system. This allows you to control which bundles are active by simply adding, updating, or removing files in that directory.
- Create a directory on the file system to hold your deployment bundles (e.g., /opt/swiftmq/customdeploy).
- Configure a deploy space in the Deploy Swiftlet to monitor this directory, specifying the desired check interval.
- Copy bundle files into the directory to deploy them. Remove or update files to undeploy or redeploy bundles.
<swiftlet name="sys$deploy">
<deploy-spaces>
<deploy-space name="custom" path="/opt/swiftmq/customdeploy" check-interval="10000"/>
</deploy-spaces>
</swiftlet>
Configuration Reference
The top-level entity in routerconfig.xml is <swiftlet name="sys$deploy">.
<deploy-spaces> in <swiftlet name="sys$deploy">
Deploy Spaces
Each <deploy-space> entry is identified by its name attribute (the Deploy Space).
| Parameter | Type | Default | Mandatory | Reboot Required | Description |
|---|---|---|---|---|---|
path |
String | — | Yes | No | Path Name |
check-interval |
Long | 60000 |
Yes | No | Check Interval for Deployment Changes |
<swiftlet name="sys$deploy">
<deploy-spaces>
<deploy-space name="..." path="..." check-interval="..."/>
</deploy-spaces>
</swiftlet>