Deploying ZoneMinder
Introduction
ZoneMinder is a full-featured, open-source video surveillance software system. It supports an unlimited number of cameras and provides features like motion detection, event recording, timeline viewing, and remote access through a web interface.
With over 20 years of development, ZoneMinder has become one of the most trusted and widely deployed open-source surveillance solutions. It integrates with virtually any IP camera and offers advanced features typically found only in expensive commercial systems.
Key highlights of ZoneMinder:
- Unlimited Cameras: Connect as many cameras as your hardware can handle
- Motion Detection: Configurable zones and sensitivity for accurate detection
- Event Recording: Record on motion, continuous, or scheduled triggers
- Web Interface: Full-featured browser-based management console
- API Access: RESTful API for integration with other systems
- Mobile Apps: Third-party apps for iOS and Android monitoring
- PTZ Support: Pan-Tilt-Zoom camera control
- Multi-Server: Distributed architecture for large installations
- Alert Notifications: Email and push notifications for events
- Timeline View: Visual navigation through recorded footage
- Zones: Define multiple detection zones per camera
- Filters: Powerful event filtering and automatic archiving
This guide walks through deploying ZoneMinder on Klutch.sh using Docker, providing you with a comprehensive video surveillance solution.
Why Deploy ZoneMinder on Klutch.sh
Deploying ZoneMinder on Klutch.sh provides several advantages for video surveillance:
Remote Access: Access your cameras and recordings from anywhere with internet connectivity.
HTTPS by Default: Secure access to your surveillance system with automatic SSL certificates.
Persistent Storage: Reliable storage for your video recordings and database.
Scalable Resources: Allocate CPU and storage based on camera count and recording quality.
Always Available: Your surveillance system remains online 24/7 without managing home servers.
GitHub Integration: Deploy configuration updates automatically.
Prerequisites
Before deploying ZoneMinder on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your configuration
- IP cameras accessible via RTSP or HTTP streams
- Basic understanding of Docker and containerization
- Knowledge of IP camera configuration and networking
Understanding ZoneMinder Architecture
ZoneMinder consists of several components:
Web Interface: Apache/PHP-based frontend for configuration and viewing.
Database (MySQL/MariaDB): Stores configuration, events, and metadata.
Capture Daemons: Background processes that capture video from cameras.
Analysis Daemons: Process video for motion detection and event triggering.
Storage: Filesystem storage for recorded video footage.
Preparing Your Repository
Create a GitHub repository for your ZoneMinder deployment.
Repository Structure
zoneminder-deploy/├── Dockerfile├── conf.d/│ └── zoneminder.conf└── .dockerignoreCreating the Dockerfile
Create a Dockerfile for ZoneMinder:
FROM ghcr.io/zoneminder-containers/zoneminder-base:latest
# Set timezoneENV TZ=${TZ:-America/New_York}
# MySQL settingsENV MYSQL_HOST=localhostENV MYSQL_DATABASE=zmENV MYSQL_USER=zmuserENV MYSQL_PASSWORD=${MYSQL_PASSWORD}
# ZoneMinder settingsENV ZM_DB_HOST=localhostENV ZM_DB_NAME=zmENV ZM_DB_USER=zmuserENV ZM_DB_PASS=${MYSQL_PASSWORD}
# Storage pathsENV ZM_PATH_DATA=/var/cache/zoneminder/eventsENV ZM_PATH_TEMP=/var/cache/zoneminder/temp
# Create necessary directoriesRUN mkdir -p /var/cache/zoneminder/events \ && mkdir -p /var/cache/zoneminder/images \ && mkdir -p /var/cache/zoneminder/temp \ && chown -R www-data:www-data /var/cache/zoneminder
# Expose web interfaceEXPOSE 80 443
# Volumes for persistenceVOLUME ["/var/cache/zoneminder/events", "/var/lib/mysql"]
# Start servicesCMD ["/init"]Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
TZ | No | America/New_York | Timezone for recordings |
MYSQL_PASSWORD | Yes | - | Database password |
ZM_DB_HOST | No | localhost | Database hostname |
ZM_DB_NAME | No | zm | Database name |
PUID | No | 1000 | User ID for file permissions |
PGID | No | 1000 | Group ID for file permissions |
Deploying ZoneMinder on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 80
Generate Database Password
Create a secure database password:
openssl rand -base64 24Save this password for configuration.
Push Your Repository to GitHub
Initialize and push your configuration to GitHub.
Create a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project named “zoneminder” or “surveillance”.
Create a New App
Within your project, create a new app and connect your GitHub repository.
Configure HTTP Traffic
Set up HTTP for the web interface:
Set Environment Variables
Configure the following:
| Variable | Value |
|---|---|
TZ | Your timezone (e.g., America/New_York) |
MYSQL_PASSWORD | Your generated database password |
PUID | 1000 |
PGID | 1000 |
Attach Persistent Volumes
Add storage for recordings and database:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/var/cache/zoneminder/events | 500+ GB | Video recordings |
/var/lib/mysql | 10 GB | Database storage |
/var/cache/zoneminder/images | 10 GB | Snapshot images |
Deploy Your Application
Click Deploy to build and start ZoneMinder.
Access ZoneMinder
Once deployment completes, access your instance at https://your-app-name.klutch.sh/zm.
Initial Configuration
First-Time Setup
- Navigate to your ZoneMinder URL
- Accept any initial configuration prompts
- Configure your timezone in Options > System
Adding Cameras
Add your first camera:
- Click “Add” to add a new monitor
- General Tab:
- Name: Descriptive camera name
- Source Type: FFmpeg (for most IP cameras)
- Function: Mocord (Motion + Record) or Record
- Source Tab:
- Source Path:
rtsp://username:password@camera-ip:554/stream - Target Colorspace: 24 bit color
- Source Path:
- Save and verify the camera feed appears
Camera Source Examples
RTSP Stream:
rtsp://admin:password@192.168.1.100:554/Streaming/Channels/101HTTP MJPEG:
http://192.168.1.100/mjpg/video.mjpgONVIF Camera: Use the ONVIF discovery feature in ZoneMinder to auto-detect settings.
Motion Detection Configuration
Creating Detection Zones
- Open a camera’s settings
- Navigate to the Zones tab
- Click in the camera preview to create zone points
- Configure sensitivity and thresholds
- Save and test motion detection
Zone Types
- Active: Normal motion detection zone
- Inclusive: Only detect if motion in this zone
- Exclusive: Ignore motion in this zone
- Preclusive: Reject event if motion in this zone
- Inactive: Zone for reference only
Sensitivity Tuning
Adjust for accurate detection:
- Min/Max Pixel Threshold: Sensitivity to pixel changes
- Min/Max Alarm Pixels: Minimum area to trigger
- Filter Width/Height: Noise filtering
Recording Modes
Function Types
- None: Camera disabled
- Monitor: View only, no recording
- Modect: Motion detection only
- Record: Continuous recording
- Mocord: Motion detection + continuous recording
- Nodect: External trigger only
Storage Management
Configure automatic storage cleanup:
- Navigate to Options > Storage
- Set event retention policies
- Configure disk space limits
- Enable automatic archiving
Notifications
Email Alerts
Configure email notifications:
- Navigate to Options > Email
- Configure SMTP settings
- Set up filters to trigger notifications
Event Filters
Create filters for automated actions:
- Navigate to Filters
- Create rules based on event properties
- Configure actions (email, archive, delete)
Troubleshooting Common Issues
Camera Not Connecting
Solutions:
- Verify camera IP and credentials
- Test RTSP URL with VLC or ffplay
- Check camera is accessible from Klutch.sh network
- Review ZoneMinder logs for connection errors
High CPU Usage
Solutions:
- Reduce camera resolution or frame rate
- Lower motion detection sensitivity
- Use hardware decoding if available
- Limit concurrent camera analysis
Events Not Recording
Solutions:
- Verify function is set to Modect or Record
- Check storage space is available
- Review zone configuration
- Check event filter settings
Additional Resources
Conclusion
Deploying ZoneMinder on Klutch.sh gives you a powerful, self-hosted video surveillance system accessible from anywhere. With support for unlimited cameras, advanced motion detection, and comprehensive recording features, ZoneMinder provides enterprise-grade surveillance capabilities while keeping your footage under your control.