Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.swp
.vscode/*
data/

# OS generated files #
######################
Expand Down
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*

ARG TZ
ENV TZ=${TZ:-America/New_York}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can actually remove the TZ environment variable since it's only used for the build. I might do this in another MR.

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata

RUN pip install requests loguru pillow
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this because it's usual to have the setup steps before the CMD.


COPY ./app /app
COPY run.py /run.py
CMD ["python", "/run.py"]
RUN pip install requests loguru pillow
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,17 @@ Features:
* DS918+ (12GB RAM) - Deepstack set to "medium" - ~4 seconds for image recognition
* DS713+ (4GB RAM) - Deepstack set to "low" - ~9 seconds for image recognition


## Running using docker-compose

If you want to run the containers in a docker host separate from your Synology
device, you can use the `docker-compose.yml` file.

1. Clone this repository on your docker host
1. Create the required directories (`mkdir -p ./data/captures ./data/deepstack`)
1. Create `settings.json` and `cameras.json` (see `*.example` files)
1. Optionally edit `docker-compose.yml` to configure your time zone and network ports.
1. Start the services (`docker-compose up -d`)
1. Optionally tail the log files (`docker-compose logs -tf sssai`)

On the first time you run the service
14 changes: 14 additions & 0 deletions cameras.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"1":
{
"name":"Back Yard",
"threshold": 50,
"triggerUrl": "URL from Action Rule to trigger the camera goes here"
},
"2":
{
"name": "Front Door",
"threshold": 50,
"triggerUrl": "URL from Action Rule to trigger the camera goes here"
}
}
3 changes: 3 additions & 0 deletions deepstack.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODE=High
#MODE=Low
VISION-DETECTION=True
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3.3"

services:
sssai:
depends_on:
- deepstack
build:
context: .
args:
TZ: Australia/Sydney
image: sssai:latest
container_name: ssaai
volumes:
# mkdir -p ./data/captures
- ./data/captures:/captureDir
- ./cameras.json:/config/cameras.json:ro
- ./settings.json:/config/settings.json:ro
ports:
- "4242:80"

deepstack:
image: deepquestai/deepstack
container_name: ssaai_deepstack
env_file:
- 'deepstack.env'
volumes:
# mkdir -p ./data/deepstack
- ./data/deepstack:/datastore
# Exposing this port on the host is not necessary but can be useful for testing
# ports:
# - "5083:5000"
12 changes: 12 additions & 0 deletions settings.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"sssUrl":"http://SYNOLOGY_ADDRESS:5000",
"deepstackUrl": "http://deepstack:5000",
"username": "username",
"password": "passowrd",
"detect_labels": ["person", "car"],
"min_sizex": 100,
"min_sizey": 100,
"triggerInterval": 60,
"captureDir": "/captureDir",
"homebridgeWebhookUrl": null
}