neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
MIT License
167 stars 28 forks source link

Issues with Docker on Windows Server 2019 #375

Closed peterbeeston closed 4 years ago

peterbeeston commented 4 years ago

A clear and concise description of what you're stuck on.

Error raised when running docker-compose up:

PS D:\docker\NodeDeepstackaitrigger> docker-compose up
Creating nodedeepstackaitrigger_deepstack-ai_1 ... done
Creating nodedeepstackaitrigger_trigger_1      ... error

ERROR: for nodedeepstackaitrigger_trigger_1  Cannot create container for service trigger: invalid mount config for type "bind": source path must be a directory

ERROR: for trigger  Cannot create container for service trigger: invalid mount config for type "bind": source path must be a directory
ERROR: Encountered errors while bringing up the project.

docker-compose.yaml:

version: "3.8"
services:
  trigger:
    volumes:
      # Change d:/myfolder/myimages to point to the folder that will have the images
      # to analyze. Only change the local path that is before the :/aiinput portion.
      # Don't change the :/aiinput part. For example, if you are on Windows and your
      # images are stored locally in d:/blueiris/capturedImages your final line should
      # look like this:
      # d:/blueIris/capturedImages:/aiinput
      - D:/BlueIris/capturedImages:/aiinput

    environment:
      # Change this to match the timezone the images are produced in,
      # Typically this will be the timezone of the machine running
      # the Docker container. For a list of valid timezone values
      # see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
      # The value to use is in the "TZ database name" column.
      - TZ=Europe/London

    ports:
      # This port is used by the local web server when annotated images are enabled.
      # If you change the port used by the local web server in the settings.json file
      # this also has to change to match.
      - 4242:4242

    # ------------------------------------------------------------------------
    # Don't change anything below this line unless you know what you are doing
    secrets:
      - triggers
      - settings
    image: danecreekphotography/node-deepstackai-trigger:latest
    restart: always
    depends_on:
      - deepstack-ai

  deepstack-ai:
    image: deepquestai/deepstack:latest
    restart: always
    volumes:
      - localstorage:/datastore
    environment:
      - VISION-DETECTION=True

volumes:
  localstorage:

secrets:
  settings:
    # This should point to the location of the settings.json configuration file
    file: ./settings.json
  triggers:
    # This should point to the location of the triggers.json configuration file
    file: ./triggers.json

settings.json

{
  // Leave this line alone. It enables Intellisense when editing this file in Visual Studio Code.
  "$schema": "https://raw.githubusercontent.com/danecreekphotography/node-deepstackai-trigger/main/src/schemas/settings.schema.json",

  // This is the default uri for Deepstack when deploying using the docker-compose.yaml file
  // provided in this sampleConfiguration folder. If you have another deployment of Deepstack
  // running elsewhere change this setting to point to the correction location.
  "deepstackUri": "http://deepstack-ai:5000/",

  // Set this to true to enable annotated images for use in trigger handlers.
  // There is a performance penalty to using this, leave it off unless
  // you really want to see the annotated images.
  "enableAnnotations": false,

  // Set this to true to enable the internal web server for remote access
  // to processed and annotated images.
  "enableWebServer": false,

  // Enables verbose logging. Useful when setting up the system to ensure
  // everything is running correctly.
  "verbose": true,

  // Set this to true if your images are stored in a remote folder that's
  // mounted as a network share and then mapped to the Docker image.
  "awaitWriteFinish": false,

  // Provides the configuration details for your MQTT server. To enable
  // mqtt set the uri, username (if required), password (if required),
  // and set enabled to true.
  "mqtt": {
    "uri": "mqtt://xxxxxxxxxxx:1883",
    "username": "xxxxxxxxxxxxxxx",
    "password": "xxxxxxxxxxxxxxx",
    "enabled": true,
    "retain": true
  },

  // Provides the configuration details for Telegram bot messages.
  // Set the botToken and enabled to true to use Telegram.
  "telegram": {
    "botToken": "insert bot token here",
    "enabled": false
  },

  // Provides the configuration details for Pushbullet notifications.
  // Set the accessToken and enabled to true to use Pushbullet.
  "pushbullet": {
    "accessToken": "access token here",
    "enabled": false
  },

  // Provides the configuration details for Pushover notifications.
  // Set the apiKey, userKey, and enabled to true to use Pushover.
  "pushover": {
    "apiKey": "api key here",
    "userKey": "user key here",
    "enabled": false
  }
}

triggers.json

{
  "$schema": "https://raw.githubusercontent.com/danecreekphotography/node-deepstackai-trigger/main/src/schemas/triggerConfiguration.schema.json",
  "triggers": [
    {
      "name": "Dog detector",
      "watchPattern": "/BlueIris/capturedImages/Dog*.jpg",
      "enabled": false,
      "threshold": {
        "minimum": 50,
        "maximum": 100
      },
      "handlers": {
        "webRequest": {
          "triggerUris": ["http://localhost:81/admin?trigger&camera=Dog&memo={{formattedPredictions}}"]
        },
        "mqtt": {
          "messages": [{ "topic": "aimotion/triggers/dog" }]
        },
        "pushover": {
          "userKeys": ["1"]
        },
        "telegram": {
          "chatIds": [1],
          "annotateImage": true
        }
      },
      "watchObjects": ["dog"]
    },
    {
      "name": "Office detector",
      "watchPattern": "/BlueIris/capturedImages/office*.jpg",
      "enabled": true,
      "threshold": {
        "minimum": 50,
        "maximum": 100
      },
      "handlers": {
        "mqtt": {
          "messages": [{"topic": "aimotion/trigger/office"}]
        }
      },
      "watchObjects": ["person","bicycle","car","dog","motorcycle","truck"]
    }
  ]
}

Have portainer installed which shows that the "nodedeepstackaitrigger_deepstack-ai_1" container has been created and is running.

OS: Windows 2019 Server Standard. Docker EE which is part of Windows 2019. Docker version 19.03.11, build 0da829ac52 docker-compose version 1.27.3, build 4092ae5d

peterbeeston commented 4 years ago

Closed in error

neilenns commented 4 years ago

Does D:/BlueIris/capturedImages exist on your computer? The error says it doesn't.

peterbeeston commented 4 years ago

Hi, Yes that folder does exist, and I have double checked it.

I copied the path from the File Explorer address bar and pasted it into the file.

Peter.

From: danecreekphotography notifications@github.com Sent: 20 September 2020 16:18 To: danecreekphotography/node-deepstackai-trigger node-deepstackai-trigger@noreply.github.com Cc: peterbeeston peter@beeston.com; State change state_change@noreply.github.com Subject: Re: [danecreekphotography/node-deepstackai-trigger] Issues with Docker on Windows Server 2019 (#375)

Does D:/BlueIris/capturedImages exist on your computer? The error says it doesn't.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdanecreekphotography%2Fnode-deepstackai-trigger%2Fissues%2F375%23issuecomment-695798833&data=02%7C01%7C%7C2c5f244592fc42da7efd08d85d785a4c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637362118770933693&sdata=RoM3PrBiMqUclKldwM6Wu0sChQY4%2BvEMZrsqIRdTO2A%3D&reserved=0, or unsubscribehttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACPGV5UP5Q6R5LQ525NDADLSGYMKHANCNFSM4RTVSZ7Q&data=02%7C01%7C%7C2c5f244592fc42da7efd08d85d785a4c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637362118770943687&sdata=6IQm4wLvib4bWwHrvFTjMqoQhxzr5nl%2FhFCemgie1T0%3D&reserved=0.

neilenns commented 4 years ago

Are you running this in Portainer? Or just straight from a Windows command line using docker-compose?

Is Windows running natively on the machine? Or is Windows in a virtual machine?

Is the folder local to the machine or is it a mounted shared drive?

peterbeeston commented 4 years ago

Hi, The machine is running native Windows 2019 Server Standard, with the built-in Docker-EE engine. This was run in a Power Shell (Admin) session. I have installed other docker containers this way and have had no issues, as is shown in that the DeepStackAI container is running. Docker is also running Portainer and Portainer-Agent.

Thanks for the quick reply.

Peter.

From: danecreekphotography notifications@github.com Sent: 21 September 2020 13:31 To: danecreekphotography/node-deepstackai-trigger node-deepstackai-trigger@noreply.github.com Cc: peterbeeston peter@beeston.com; State change state_change@noreply.github.com Subject: Re: [danecreekphotography/node-deepstackai-trigger] Issues with Docker on Windows Server 2019 (#375)

Are you running this in Portainer? Or just straight from a Windows command line using docker-compose?

Is Windows running natively on the machine? Or is Windows in a virtual machine?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdanecreekphotography%2Fnode-deepstackai-trigger%2Fissues%2F375%23issuecomment-696083270&data=02%7C01%7C%7C3bdd06f3e76a457c755e08d85e2a4126%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637362882852488464&sdata=5rEgBlugF2RDW%2FpGoF45KhWyDLP8jieJf0IoKrN5dQA%3D&reserved=0, or unsubscribehttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACPGV5TQ5RL37FVLKSHQEG3SG5BRZANCNFSM4RTVSZ7Q&data=02%7C01%7C%7C3bdd06f3e76a457c755e08d85e2a4126%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637362882852498457&sdata=1iSeHTWwExIlysKqTRcLPle%2BbVs%2BtTKQl%2BfXrjAQeTM%3D&reserved=0.

neilenns commented 4 years ago

Is the folder local to the machine or is it a mounted shared drive?

neilenns commented 4 years ago

What happens if you do a dir D:\BlueIris\capturedImages from PowerShell?

peterbeeston commented 4 years ago

Hi, The drive is a local disk and the dir command returns: PS C:\Windows\system32> dir D:\BlueIris\capturedImages

Directory: D:\BlueIris\capturedImages

Mode LastWriteTime Length Name


-a---- 21/09/2020 14:32 0 Test.txt

This file is just there so that there is something to return.

Peter.

From: danecreekphotography notifications@github.com Sent: 21 September 2020 14:19 To: danecreekphotography/node-deepstackai-trigger node-deepstackai-trigger@noreply.github.com Cc: peterbeeston peter@beeston.com; State change state_change@noreply.github.com Subject: Re: [danecreekphotography/node-deepstackai-trigger] Issues with Docker on Windows Server 2019 (#375)

What happens if you do a dir D:\BlueIris\capturedImages from PowerShell?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdanecreekphotography%2Fnode-deepstackai-trigger%2Fissues%2F375%23issuecomment-696109173&data=02%7C01%7C%7C2397a119023f463ed45a08d85e30ec40%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637362911493005766&sdata=bAf8GpqTwBf3qUvsa9GzL4dkhoNe9xAmPlOREZrCCFs%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACPGV5XUXAF4GYIXRVBUVIDSG5HEZANCNFSM4RTVSZ7Q&data=02%7C01%7C%7C2397a119023f463ed45a08d85e30ec40%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637362911493015762&sdata=LAPhjE9sw%2BwIGvxXMsN9%2FwsP7hvh3Hm2tZi47YeCD%2BM%3D&reserved=0.

neilenns commented 4 years ago

Unfortunately I'm out of ideas :( This is purely a Docker issue and nothing to do with any of the stuff I wrote. Perhaps you can try asking on StackOverflow, although all of the threads on this error I saw there were related to things you say are not applicable in your case.

peterbeeston commented 4 years ago

Hi, I agree, I think that this is a 2019 specific issue, but was hoping that you may have heard something.

I have an inkling that it may be a PS/Docker-Compose/Windows folders issue, so I an going to try the CMD prompt instead on PS. If I find anything I will let you know.

Peter.

From: danecreekphotography notifications@github.com Sent: 21 September 2020 14:46 To: danecreekphotography/node-deepstackai-trigger node-deepstackai-trigger@noreply.github.com Cc: peterbeeston peter@beeston.com; State change state_change@noreply.github.com Subject: Re: [danecreekphotography/node-deepstackai-trigger] Issues with Docker on Windows Server 2019 (#375)

Unfortunately I'm out of ideas :( This is purely a Docker issue and nothing to do with any of the stuff I wrote. Perhaps you can try asking on StackOverflow, although all of the threads on this error I saw there were related to things you say are not applicable in your case.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdanecreekphotography%2Fnode-deepstackai-trigger%2Fissues%2F375%23issuecomment-696125061&data=02%7C01%7C%7Ca658ada9d43545db958e08d85e34b6fb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637362927779721629&sdata=WGKe7Fx9U9Zkj01%2FFUb%2BslA%2BxZIGaS20Bfca5fQ41fQ%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACPGV5Q4M6JE3CHX2S6ZILLSG5KKRANCNFSM4RTVSZ7Q&data=02%7C01%7C%7Ca658ada9d43545db958e08d85e34b6fb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637362927779731624&sdata=DfXD73BdiOqB9jW%2FNFJR%2BEW2REF1FPbL6yVu2Oji%2BmE%3D&reserved=0.

neilenns commented 4 years ago

Other things to try:

  1. A different folder name entirely
  2. Install Docker Desktop (sounds like you are using something else built in to Windows server?)