Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support docker-compose deployment #265

Closed
pbrenna opened this issue Mar 29, 2023 · 2 comments
Closed

Support docker-compose deployment #265

pbrenna opened this issue Mar 29, 2023 · 2 comments

Comments

@pbrenna
Copy link

pbrenna commented Mar 29, 2023

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
Copy link

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

@scottlamb
Copy link
Owner

The nvr script is thoroughly dead:

  • as of v0.7.8, the install instructions now recommend installing a single binary directly on the host.
  • ...and as of v0.7.10, I've been talked into building Docker images too, for those Docker-inclined. See Where's the Dockerfile? #294. My instructions for that use a docker compose config based on the one suggested here; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants