scottlamb / moonfire-nvr

Moonfire NVR, a security camera network video recorder
Other
1.18k stars 138 forks source link

Support docker-compose deployment #265

Closed pbrenna closed 8 months ago

pbrenna commented 1 year ago

Deploying with docker-compose can be quite useful.

It might be beneficial to include this alternate method in the install instructions.

docker-compose.yml :

version: '3.5'
services:
  moonfire:
    image: "moonfire-nvr:latest"
    volumes:
     - ./moonfire-nvr:/var/lib/moonfire-nvr
     - ./moonfire-nvr.toml:/etc/moonfire-nvr.toml:ro
    # Add additional mount lines here for each sample file directory
    # outside of /var/lib/moonfire-nvr, e.g.:
    # - /media/nvr/sample:/media/nvr/sample
    user: "${UID}:${GID}"
    ports:
      - "127.0.0.1:8080:8080"
    environment:
      TZ: ":${TZ}"
      RUST_BACKTRACE: 1
    logging:
      driver: journald
      options:
        tag: moonfire-nvr
    entrypoint: ["moonfire-nvr", "run"]

.env :

GID=1007
UID=1007
TZ=Europe/Amsterdam

/usr/local/bin/nvr:

#!/bin/bash
set -e
cd /path/to/docker-compose/dir
docker-compose run --rm -ti --entrypoint=/bin/bash moonfire "-c" 'moonfire-nvr "$@"' --  "$@"

Drawbacks: GID and UID can't be filled in programmatically (but could be written in the env file at the time of user creation).

HouCoder commented 11 months ago

👍 , the current official Docker setup doc is a bit complicated to get it started, this docker-compose approach is much easier and straightforward.

scottlamb commented 7 months ago

The nvr script is thoroughly dead: