Skip to content

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
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile for ZoneMinder:

FROM ghcr.io/zoneminder-containers/zoneminder-base:latest
# Set timezone
ENV TZ=${TZ:-America/New_York}
# MySQL settings
ENV MYSQL_HOST=localhost
ENV MYSQL_DATABASE=zm
ENV MYSQL_USER=zmuser
ENV MYSQL_PASSWORD=${MYSQL_PASSWORD}
# ZoneMinder settings
ENV ZM_DB_HOST=localhost
ENV ZM_DB_NAME=zm
ENV ZM_DB_USER=zmuser
ENV ZM_DB_PASS=${MYSQL_PASSWORD}
# Storage paths
ENV ZM_PATH_DATA=/var/cache/zoneminder/events
ENV ZM_PATH_TEMP=/var/cache/zoneminder/temp
# Create necessary directories
RUN 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 interface
EXPOSE 80 443
# Volumes for persistence
VOLUME ["/var/cache/zoneminder/events", "/var/lib/mysql"]
# Start services
CMD ["/init"]

Environment Variables Reference

VariableRequiredDefaultDescription
TZNoAmerica/New_YorkTimezone for recordings
MYSQL_PASSWORDYes-Database password
ZM_DB_HOSTNolocalhostDatabase hostname
ZM_DB_NAMENozmDatabase name
PUIDNo1000User ID for file permissions
PGIDNo1000Group ID for file permissions

Deploying ZoneMinder on Klutch.sh

    Generate Database Password

    Create a secure database password:

    Terminal window
    openssl rand -base64 24

    Save 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:

    • Select HTTP as the traffic type
    • Set the internal port to 80

    Set Environment Variables

    Configure the following:

    VariableValue
    TZYour timezone (e.g., America/New_York)
    MYSQL_PASSWORDYour generated database password
    PUID1000
    PGID1000

    Attach Persistent Volumes

    Add storage for recordings and database:

    Mount PathRecommended SizePurpose
    /var/cache/zoneminder/events500+ GBVideo recordings
    /var/lib/mysql10 GBDatabase storage
    /var/cache/zoneminder/images10 GBSnapshot 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

  1. Navigate to your ZoneMinder URL
  2. Accept any initial configuration prompts
  3. Configure your timezone in Options > System

Adding Cameras

Add your first camera:

  1. Click “Add” to add a new monitor
  2. General Tab:
    • Name: Descriptive camera name
    • Source Type: FFmpeg (for most IP cameras)
    • Function: Mocord (Motion + Record) or Record
  3. Source Tab:
    • Source Path: rtsp://username:password@camera-ip:554/stream
    • Target Colorspace: 24 bit color
  4. Save and verify the camera feed appears

Camera Source Examples

RTSP Stream:

rtsp://admin:password@192.168.1.100:554/Streaming/Channels/101

HTTP MJPEG:

http://192.168.1.100/mjpg/video.mjpg

ONVIF Camera: Use the ONVIF discovery feature in ZoneMinder to auto-detect settings.

Motion Detection Configuration

Creating Detection Zones

  1. Open a camera’s settings
  2. Navigate to the Zones tab
  3. Click in the camera preview to create zone points
  4. Configure sensitivity and thresholds
  5. 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:

  1. Navigate to Options > Storage
  2. Set event retention policies
  3. Configure disk space limits
  4. Enable automatic archiving

Notifications

Email Alerts

Configure email notifications:

  1. Navigate to Options > Email
  2. Configure SMTP settings
  3. Set up filters to trigger notifications

Event Filters

Create filters for automated actions:

  1. Navigate to Filters
  2. Create rules based on event properties
  3. 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.