Automatic Self-Upgrade β
MeshMonitor supports automatic self-upgrade for Docker deployments, allowing you to upgrade to new versions directly from the web interface with a single click.
Overview β
When enabled, MeshMonitor displays an "Upgrade Now" button in the update notification banner whenever a new version is available. Clicking this button automatically:
- Creates a backup of your data
- Pulls the new Docker image
- Recreates the container with the new version
- Performs health checks
- Automatically rolls back if the upgrade fails
INFO
Deployment Support:
- β Docker Compose - Fully supported with watchdog sidecar
- β οΈ Kubernetes - Use standard
kubectlor Helm upgrades instead - β Manual - Not supported for manual Node.js deployments
How It Works β
The auto-upgrade feature uses a watchdog sidecar container that:
- Monitors for upgrade triggers from the main application
- Has access to the Docker socket to manage containers
- Pulls new images and recreates containers
- Maintains all your existing configuration and data
- Automatically deploys the upgrade watchdog script to the shared data volume (no manual download needed)
βββββββββββββββββββ ββββββββββββββββββββ
β MeshMonitor β Trigger β Watchdog Sidecarβ
β Container βββββββββββ (docker:cli) β
β β File β β
ββββββββββ¬βββββββββ ββββββββββ¬ββββββββββ
β β
β Shared /data volume β
βββββββββββββββββββββββββββββ
β
Monitors for:
/data/.upgrade-triggerSetup Instructions β
Docker Compose Setup β
INFO
The upgrade watchdog script is automatically deployed to /data/scripts/ by the MeshMonitor container on startup. No manual script download is required.
Enable the watchdog sidecar by using the upgrade overlay:
bashdocker compose -f docker-compose.yml -f docker-compose.upgrade.yml up -dVerify the watchdog is running:
bashdocker ps | grep upgraderYou should see a container named
meshmonitor-upgraderrunning.Access MeshMonitor as normal. When an update is available, you'll see an "Upgrade Now" button in the notification banner.
Configuration Options β
The upgrade behavior can be customized via environment variables:
# docker-compose.upgrade.yml (already configured)
services:
meshmonitor:
environment:
- AUTO_UPGRADE_ENABLED=true # Enable upgrade feature
meshmonitor-upgrader:
environment:
- CHECK_INTERVAL=5 # Check for triggers every 5 seconds
- CONTAINER_NAME=meshmonitor # Name of container to upgrade
- IMAGE_NAME=ghcr.io/yeraze/meshmonitor # Image to pullUsing the Upgrade Feature β
Step 1: Check for Updates β
MeshMonitor automatically checks for new releases every 4 hours. When an update is available, a banner appears:
π Update Available: Version 2.14.0 is now available. [View Release Notes β] [Upgrade Now]Step 2: Review Release Notes β
Click "View Release Notes β" to see what's new in the latest version on GitHub.
Step 3: Trigger Upgrade β
Click the "Upgrade Now" button to start the automatic upgrade process.
Step 4: Monitor Progress β
The banner updates to show upgrade progress:
βοΈ Upgrading to 2.14.0... Creating backup... (20%)
βοΈ Upgrading to 2.14.0... Downloading new version... (40%)
βοΈ Upgrading to 2.14.0... Restarting services... (60%)
βοΈ Upgrading to 2.14.0... Running health checks... (80%)
β
Upgrade complete! Reloading...Step 5: Automatic Reload β
Once the upgrade completes, the page automatically reloads with the new version.
WARNING
During Upgrade:
- Do not close the browser tab
- The application will be unavailable for 10-30 seconds
- All WebSocket connections will be temporarily disconnected
Upgrade Process Details β
1. Pre-flight Checks β
Before starting, the system verifies:
- β Sufficient disk space (500MB minimum)
- β Backup directory is writable
- β New Docker image exists in registry
- β No other upgrade in progress
2. Backup Creation β
A complete backup of /data is created:
/data/backups/upgrade-backup-20250107_143022.tar.gzThis includes:
- SQLite database
- Configuration files
- Apprise notification configs
3. Image Download β
The watchdog pulls the new image:
docker pull ghcr.io/yeraze/meshmonitor:2.14.0
docker tag ghcr.io/yeraze/meshmonitor:2.14.0 ghcr.io/yeraze/meshmonitor:latest4. Container Recreation β
The watchdog recreates the container using direct Docker commands (this works regardless of how the container was originally started - via docker-compose, docker run, or any overlay files):
# Capture current container configuration
docker inspect meshmonitor
# Stop and remove old container
docker stop meshmonitor
docker rm meshmonitor
# Create new container with same configuration
docker run -d --name meshmonitor ...This preserves:
- All environment variables
- Volume mounts
- Network configuration
- Port mappings
5. Health Checks β
The watchdog waits up to 2 minutes for the health endpoint to respond:
GET http://localhost:3001/api/health6. Automatic Rollback (if needed) β
If health checks fail, the watchdog:
- Stops the new container
- Restores the previous image
- Restores data from backup
- Starts the previous version
Upgrade History β
View past upgrades in the database:
SELECT * FROM upgrade_history ORDER BY startedAt DESC LIMIT 10;Each entry includes:
- Upgrade ID
- From/To versions
- Status (complete, failed, rolled_back)
- Timestamps
- Error messages (if failed)
- Backup path
Troubleshooting β
Upgrade Button Not Appearing β
Problem: Update notification shows but no "Upgrade Now" button
Solutions:
Check if watchdog is running:
bashdocker ps | grep upgraderVerify environment variable:
bashdocker exec meshmonitor env | grep AUTO_UPGRADE_ENABLEDShould output:
AUTO_UPGRADE_ENABLED=trueRestart with upgrade overlay:
bashdocker compose -f docker-compose.yml -f docker-compose.upgrade.yml up -d
Upgrade Fails Immediately β
Problem: Upgrade fails with pre-flight check errors
Solutions:
Check disk space:
bashdf -h /var/lib/dockerNeed at least 500MB free
Check backup directory permissions:
bashdocker exec meshmonitor ls -la /data/backupsManually create backup directory:
bashdocker exec meshmonitor mkdir -p /data/backups
Upgrade Stuck at "Restarting" β
Problem: Upgrade progress shows "Restarting services..." but never completes
Solutions:
Check watchdog logs:
bashdocker logs meshmonitor-upgraderCheck main container logs:
bashdocker logs meshmonitorVerify Docker socket access:
bashdocker exec meshmonitor-upgrader docker psManually restart if needed:
bashdocker compose restart meshmonitor
Upgrade Stuck in "In Progress" State β
Problem: UI shows "Upgrade already in progress" but upgrade has been stuck for a long time
Automatic Recovery: The system automatically detects and cleans up stale upgrades after 30 minutes. Any upgrade stuck in progress for more than 30 minutes will be automatically marked as failed and the system will be ready for a new upgrade attempt.
Manual Recovery:
Check if upgrade is actually running:
bashdocker logs meshmonitor-upgrader --tail 50Force cancel if needed:
bash# Remove trigger file docker exec meshmonitor rm -f /data/.upgrade-trigger # Update database to mark as failed (requires SQL access) docker exec meshmonitor sqlite3 /data/meshmonitor.db \ "UPDATE upgrade_history SET status='failed', completedAt=$(date +%s)000 \ WHERE status IN ('pending','backing_up','downloading','restarting','health_check')"Restart services:
bashdocker compose restart meshmonitor
Container Won't Start After Upgrade β
Problem: New version fails health checks
Automatic Rollback: The watchdog automatically rolls back to the previous version if health checks fail.
Manual Rollback:
Stop current version:
bashdocker compose stop meshmonitorUse previous image tag:
bashdocker tag ghcr.io/yeraze/meshmonitor:2.13.4 ghcr.io/yeraze/meshmonitor:latestRestore backup:
bashdocker run --rm -v meshmonitor-data:/data -v $(pwd)/backups:/backups \ alpine sh -c "cd /data && tar xzf /backups/upgrade-backup-*.tar.gz"Restart:
bashdocker compose up -d meshmonitor
Watchdog Not Detecting Trigger β
Problem: Clicked "Upgrade Now" but nothing happens
Solutions:
Check trigger file exists:
bashdocker exec meshmonitor ls -la /data/.upgrade-triggerCheck watchdog is monitoring:
bashdocker logs meshmonitor-upgrader | grep "Monitoring"Manually trigger (for testing):
bashdocker exec meshmonitor sh -c 'echo "{\"version\":\"latest\"}" > /data/.upgrade-trigger'
Security Considerations β
Docker Socket Access β
The watchdog sidecar requires access to the Docker socket (/var/run/docker.sock) to manage containers. This grants it full control over Docker on the host.
Security Measures:
- Isolated Container: The watchdog runs as a separate container with minimal permissions
- Read-Only Scripts: Upgrade scripts are mounted read-only
- Limited Scope: Only manages the
meshmonitorcontainer - No Network Access: The watchdog doesn't need network connectivity
Alternative (More Secure): Use a remote Docker API with TLS authentication instead of mounting the socket.
Backup Security β
Backups contain your entire database and configuration, including:
- User credentials (hashed)
- Session data
- Node information
- Messages
Recommendations:
- Store backups on encrypted volumes
- Regularly clean old backups
- Restrict file permissions:
chmod 600 /data/backups/*.tar.gz
Best Practices β
1. Test Upgrades in Staging β
Before upgrading production:
- Deploy a staging instance with same data
- Test the upgrade process
- Verify application functionality
- Check for breaking changes in release notes
2. Schedule Upgrades During Low Usage β
- Upgrade during maintenance windows
- Notify users of brief downtime
- Monitor application after upgrade
3. Keep Multiple Backups β
The system keeps only the most recent backup. For production:
# Create manual backup before upgrade
docker exec meshmonitor sh -c 'tar czf /data/backups/pre-upgrade-$(date +%Y%m%d).tar.gz -C /data .'4. Monitor Logs β
Watch logs during upgrade:
# Terminal 1: Watchdog logs
docker logs -f meshmonitor-upgrader
# Terminal 2: Application logs
docker logs -f meshmonitor5. Verify After Upgrade β
After successful upgrade:
- β Check application version in UI
- β Test core functionality
- β Verify WebSocket connections
- β Check node connectivity
- β Review error logs
Kubernetes Alternative β
For Kubernetes deployments, use standard update mechanisms instead:
Rolling Update via kubectl β
# Update image tag
kubectl set image deployment/meshmonitor meshmonitor=ghcr.io/yeraze/meshmonitor:2.14.0
# Watch rollout
kubectl rollout status deployment/meshmonitor
# Rollback if needed
kubectl rollout undo deployment/meshmonitorHelm Upgrade β
# Upgrade with new values
helm upgrade meshmonitor ./helm/meshmonitor \
--set image.tag=2.14.0 \
--reuse-values
# Rollback if needed
helm rollback meshmonitorAPI Reference β
Check Upgrade Status β
GET /api/upgrade/statusResponse:
{
"enabled": true,
"deploymentMethod": "docker",
"currentVersion": "2.13.4"
}Trigger Upgrade β
POST /api/upgrade/trigger
Content-Type: application/json
{
"targetVersion": "2.14.0",
"backup": true,
"force": false
}Response:
{
"success": true,
"upgradeId": "550e8400-e29b-41d4-a716-446655440000",
"currentVersion": "2.13.4",
"targetVersion": "2.14.0",
"message": "Upgrade initiated"
}Get Upgrade Progress β
GET /api/upgrade/status/{upgradeId}Response:
{
"upgradeId": "550e8400-e29b-41d4-a716-446655440000",
"status": "restarting",
"progress": 60,
"currentStep": "Recreating container",
"logs": [
"Upgrade initiated",
"Backup created",
"Image pulled",
"Container stopped"
],
"startedAt": "2025-01-07T14:30:22Z",
"fromVersion": "2.13.4",
"toVersion": "2.14.0"
}View Upgrade History β
GET /api/upgrade/history?limit=10Response:
{
"history": [
{
"upgradeId": "...",
"status": "complete",
"fromVersion": "2.13.3",
"toVersion": "2.13.4",
"startedAt": "2025-01-05T10:00:00Z",
"completedAt": "2025-01-05T10:02:15Z"
}
],
"count": 1
}FAQ β
Can I downgrade to an older version? β
Yes, specify the target version:
POST /api/upgrade/trigger
{
"targetVersion": "2.13.0"
}However, downgrading is not recommended if database schema has changed.
Does it work with custom Docker images? β
Yes, set the IMAGE_NAME environment variable in the watchdog:
environment:
- IMAGE_NAME=myregistry.com/my-meshmonitorCan I disable backups? β
Yes, but not recommended:
POST /api/upgrade/trigger
{
"backup": false
}What happens to my data during upgrade? β
- All data in
/datavolume is preserved - Database connections are gracefully closed
- Active WebSocket connections are disconnected
- Data is backed up before upgrade
How long does an upgrade take? β
Typical upgrade timeline:
- Backup: 5-10 seconds
- Image Pull: 10-30 seconds (depends on network)
- Container Restart: 5-10 seconds
- Health Check: 5-10 seconds
- Total: 25-60 seconds
Related Documentation β
- Production Deployment - Production setup guide
- Docker Compose Configurator - Generate Docker configs