Skip to content

My personal ZoneMidner on a Raspberry Pi 4

Notifications You must be signed in to change notification settings

stenki-eu/zm-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

ZONEMINDER

This is a simple debian image with the ZoneMinder installed following the official instructions https://wiki.zoneminder.com/Debian_10_Buster_with_Zoneminder_1.34.x_from_ZM_Repo.

Because of the ssmtp deprecation the mail server installed is msmtp and a default configuration file prepared for GMail will be created in /config/msmtprc.

Furthermore the image is prepared for working with SWAG(let's encrypt) image or there is an environment for the self-signed certificate option.

I forked this repository from nardo86. His image worked almost perfectly for me, only the OS timezone was not set correctly and that led to many and constant errors and of course wrong time. With a little googling and two lines I was able to fix the problem.

Image available at https://github.com/stenki-eu/zm-docker

Feel free to consider donating if my work helped you! https://paypal.me/ErosNardi

Tested on my RancherOS (without SWAG)

USAGE

Just run the image publishing the port and setting the ENV variables, the shm dedicated and mounting the folder you wish to map.

docker run -d \
  --name=ZoneMinder \
  -p 443:443/tcp \
  -e TZ=Europe/Berlin \
  -e SELFSIGNED=0 \
  -e FQDN=your.fqdn \
  --shm-size=512M \
  -v /mystorage/ZoneMinder/config:/config \
  -v /mystorage/ZoneMinder/zmcache:/var/cache/zoneminder \
  -v /mystorage/Swag/etc/letsencrypt/live:/sslcert/live \
  -v /mystorage/Swag/etc/letsencrypt/archive:/sslcert/archive \
  --restart unless-stopped \
  stenki/zoneminder

docker-compose.yml (I use the latest version. But for the compose file I think version 3.5 should be enough.)

version: "3.9"

services:
 zoneminder:
    image: stenki/zoneminder
    container_name: zoneminder
    shm_size: 128M        #I don't need more. Recommendation 512M
    ports:
      - 8443:443
    environment:
      TZ: Europe/Berlin
      SELFSIGNED: 0
      FQDN: <sub>.<domain>.<tld>
    volumes:
      - ~/<zoneminder_folder>/config:/config
      - ~/<zoneminder_folder>/zmcache:/var/cache/zoneminder
      - ~/<zoneminder_folder>/keys/letsencrypt/live:/sslcert/live
      - ~/<zoneminder_folder>/keys/letsencrypt/archive:/sslcert/archive
    restart: unless-stopped

shm_size I use only 128M. The recommendation is 512M (I think for each camera). FQDN I have my own domain at home. With the hostname results a complete FQDN. e.g. maps.google.com

SSL directory structure

/keys
  /letsencrypt
    /live
      /<FQDN>
        /cert.pem
        /privkey.pem

For the certificate I used opnSense. Afterwards I downloaded *.cert and *.key file and renamed them respectively.

To access the Zoneminder gui, browse to: https://your.fqdn:443/zm

TIPS - RESTORE CONFIGURATION

If you need to transfer your data from another instance this method worked for me https://forums.zoneminder.com/viewtopic.php?t=17071:

Backup the old DB

root@oldSystem# mysqldump -p zm > /config/zm-dbbackup.sql

Restore into the new DB

root@newSystem# mysql -p zm < /config/zm-dbbackup.sql

Sync folders

root@newSystem# rsync -r -t -p -o -g -v --progress --delete user@oldSystem:/var/cache/zoneminder/* /var/cache/zoneminder/

Init / cleanup

root@newSystem# zmaudit.pl

TIPS - STUCK WITH Waiting mysql

If the mysql service fails to start for some problem the script will stay in an infinite loop waiting mysql xxxx..

You can then log in to the machine and investigate for example starting the db with the command

/usr/bin/mysqld_safe --skip-syslog

this will generate a detailed logfile of the startup possibly with some hints you can search to restore the db.

EXTRA OPTIONS

Environment variable used for the configuration

Variable Description Default
SELFSIGNED switch between using a self-signed certificate and the one in sslcert/live folder 0
FQDN the FQDN Apache2 will be listening to, sslcert/live subfolder if SELFSIGNED is 0 localhost

About

My personal ZoneMidner on a Raspberry Pi 4

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 80.3%
  • Dockerfile 19.7%