jakowenko / double-take

Unified UI and API for processing and training images for facial recognition.
https://hub.docker.com/r/jakowenko/double-take
MIT License
1.19k stars 93 forks source link

Configuration via YAML instead of ENV variables #39

Closed jakowenko closed 3 years ago

jakowenko commented 3 years ago

I've been working on updating the API to accept configuration variables via a YAML file rather than passing them directly to the container as environment variables. Wanted to get some feedback, but here is what a more complex config would look like.

server:
  port: 3000

mqtt:
  host: localhost
  password: test
  topics:
    matches: double-take/matches
    frigate: frigate/events

detectors:
  compreface:
    url: http://localhost:8000
    key: xxx-xxx-xxx-xxx-xxx
  deepstack:
    url: http://localhost:8001

frigate:
  url: http://localhost:4000
  image:
    height: 500
  attempts:
    latest: 15
    snapshot: 0
  cameras:
    - office
  zones:
    - name: zone-name
      camera: office

confidence:
  match: 50
  unknown: 30

save:
  matches: true
  unknown: true

purge:
  matches: 48
  unknown: 12
MrNorm commented 3 years ago

Recently switched from main to beta and had no problems migrating to this. Certainly gives more flexibility over environment variables and reads a lot better too 👍

ozett commented 3 years ago

What is the correct syntax in docker-compose.yml to use the double-take-config.yml? Ist there a documentation? is it done like in frigate?

 double-take:
    container_name: double-take
    image: jakowenko/double-take
    restart: unless-stopped
    volumes:
      #- ${PWD}/.storage:/.storage
      - /usr/src/media:/.storage

      # config?
      - /usr/src/doubltake.yml:/config/config.yml:ro
    ports:
      - 3000:3000

---edit: OR do i upload the config into the running container here -> ? image

jakowenko commented 3 years ago

What is the correct syntax in docker-compose.yml to use the double-take-config.yml? Ist there a documentation? is it done like in frigate?

 double-take:
    container_name: double-take
    image: jakowenko/double-take
    restart: unless-stopped
    volumes:
      #- ${PWD}/.storage:/.storage
      - /usr/src/media:/.storage

      # config?
      - /usr/src/doubltake.yml:/config/config.yml:ro
    ports:
      - 3000:3000

This should be all you need. I'll make sure to update the docs if it's not clear or incorrect. The below snippet is what I use on my home machine.

services:
  double-take:
    container_name: double-take
    image: jakowenko/double-take:beta
    restart: unless-stopped
    volumes:
       - ${PWD}/double-take/.storage:/.storage
    ports:
      - 3000:3000

The file should then be under ./storage/config/config.yml on your host machine.

ozett commented 3 years ago

The file should then be under ./storage/config/config.yml on your host machine.

but only after first start and filling in the config with the gui. maybe that should be stated in the docu? i first assumed i had to have the config already for the first start. but thats not needed beforhand, as i found out later

pierluigizagaria commented 1 year ago

is it possible to use envs in the configuration yaml?