agent
agent copied to clipboard
Unable to update polygon-selection with mounted config.json
Configuration Overview
Docker Versions
$ docker --version
Docker version 20.10.21, build baeda1f
$ docker compose version
Docker Compose version v2.12.2
Preparation Steps
mkdir /srv/kerberos-agent /srv/kerberos-agent/garage-south/ /srv/kerberos-agent/garage-south/config
wget https://raw.githubusercontent.com/kerberos-io/agent/master/machinery/data/config/config.json -O /srv/kerberos-agent/garage-south/config
sudo chown 1000:1000 /srv/kerberos-agent -R
sudo chmod 777 /srv/kerberos-agent -R
mkdir /media/nvr/kerberos/garage-south /media/nvr/kerberos/garage-south/recordings /media/nvr/kerberos/garage-south/snapshots
sudo chown 1000:1000 /media/nvr/kerberos -R
sudo chmod 777 /media/nvr/kerberos -R
docker-compose.yml
version: "3.9"
networks:
kerberos-agent-net:
driver: bridge
name: kerberos-agent-net
services:
ka-garage-south:
image: "kerberos/agent:latest"
container_name: ka-garage-south
hostname: ${HOSTNAME}-ka-garage-south
networks:
- kerberos-agent-net
ports:
- "80:80"
environment:
- AGENT_USERNAME=${AGENT_USERNAME}
- AGENT_PASSWORD=${AGENT_PASSWORD}
volumes:
- ${APPDATA}/garage-south/config:/home/agent/data/config:rw
- ${RECORDINGS}/garage-south/recordings:/home/agent/data/recordings:rw
- ${RECORDINGS}/garage-south/snapshots:/home/agent/data/snapshots:rw
restart: unless-stopped
.env
# Directory locations
APPDATA=/srv/kerberos-agent
RECORDINGS=/media/nvr/kerberos
# Container specifics
AGENT_USERNAME=[username]
AGENT_PASSWORD=[password]
HOSTNAME=[hostname]
config.json
{
"type": "",
"key": "",
"name": "garage-south",
"time": "true",
"offline": "false",
"auto_clean": "true",
"max_directory_size": 102400,
"timezone": "America/Edmonton",
"capture": {
"name": "",
"ipcamera": {
"rtsp": "rtsp://[details]",
"sub_rtsp": "rtsp://[details]",
"fps": ""
},
"usbcamera": {
"device": ""
},
"raspicamera": {
"device": ""
},
"continuous": "true",
"postrecording": 40,
"prerecording": 20,
"maxlengthrecording": 600,
"transcodingwebrtc": "",
"transcodingresolution": 0,
"forwardwebrtc": "",
"fragmented": "false",
"fragmentedduration": 8,
"pixelChangeThreshold": 150
},
"timetable": [
{
"start1": 3600,
"end1": 43199,
"start2": 43200,
"end2": 86400
},
{
"start1": 3600,
"end1": 43199,
"start2": 43200,
"end2": 86400
},
{
"start1": 3600,
"end1": 43199,
"start2": 43200,
"end2": 86400
},
{
"start1": 3600,
"end1": 43199,
"start2": 43200,
"end2": 86400
},
{
"start1": 3600,
"end1": 43199,
"start2": 43200,
"end2": 86400
},
{
"start1": 3600,
"end1": 43199,
"start2": 43200,
"end2": 86400
},
{
"start1": 3600,
"end1": 43199,
"start2": 43200,
"end2": 86400
}
],
"region": {
"name": "",
"rectangle": {
"x1": 0,
"y1": 0,
"x2": 800,
"y2": 640
},
"polygon": []
},
"cloud": "",
"s3": {},
"kstorage": {},
"mqtturi": "tcp://195.168.1.95:1883",
"mqtt_username": "",
"mqtt_password": "",
"stunuri": "",
"turnuri": "",
"turn_username": "",
"turn_password": "",
"heartbeaturi": "",
"hub_uri": "",
"hub_key": "",
"hub_private_key": "",
"hub_site": "",
"condition_uri": ""
}
Start and Verify Container
$ docker compose --file /srv/kerberos-agent/docker-compose.yml up --detach
[+] Running 2/2
⠿ Network kerberos-agent-net Created 0.1s
⠿ Container ka-garage-south Started 1.0s
$ docker exec ka-garage-south env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=[hostname]-ka-garage-south
AGENT_USERNAME=[username]
AGENT_PASSWORD=[password]
ZONEINFO=/zoneinfo.zip
HOME=/home/agent
$ docker container inspect ka-garage-south -f '{{range .Mounts}}{{.Type}}:{{.Source}}:{{.Destination}}{{println}}{{ end }}'
bind:/media/nvr/kerberos/garage-south/snapshots:/home/agent/data/snapshots
bind:/srv/kerberos-agent/garage-south/config:/home/agent/data/config
bind:/media/nvr/kerberos/garage-south/recordings:/home/agent/data/recordings
$ docker compose --file /srv/kerberos-agent/docker-compose.yml logs
ka-garage-south | {"level":"info","msg":"Successfully Opened config.json from opensource","time":"2022-12-21T17:35:05+01:00"}
ka-garage-south | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
ka-garage-south |
ka-garage-south | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
ka-garage-south | - using env: export GIN_MODE=release
ka-garage-south | - using code: gin.SetMode(gin.ReleaseMode)
ka-garage-south |
ka-garage-south | [GIN-debug] GET /debug/pprof/ --> github.com/gin-gonic/gin.WrapF.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/cmdline --> github.com/gin-gonic/gin.WrapF.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/profile --> github.com/gin-gonic/gin.WrapF.func1 (3 handlers)
ka-garage-south | [GIN-debug] POST /debug/pprof/symbol --> github.com/gin-gonic/gin.WrapF.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/symbol --> github.com/gin-gonic/gin.WrapF.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/trace --> github.com/gin-gonic/gin.WrapF.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/allocs --> github.com/gin-gonic/gin.WrapH.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/block --> github.com/gin-gonic/gin.WrapH.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/goroutine --> github.com/gin-gonic/gin.WrapH.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/heap --> github.com/gin-gonic/gin.WrapH.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/mutex --> github.com/gin-gonic/gin.WrapH.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /debug/pprof/threadcreate --> github.com/gin-gonic/gin.WrapH.func1 (3 handlers)
ka-garage-south | [GIN-debug] GET /swagger/*any --> github.com/swaggo/gin-swagger.CustomWrapHandler.func1 (4 handlers)
ka-garage-south | [GIN-debug] GET /config --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func1 (4 handlers)
ka-garage-south | [GIN-debug] POST /config --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func2 (4 handlers)
ka-garage-south | [GIN-debug] POST /api/login --> github.com/appleboy/gin-jwt/v2.(*GinJWTMiddleware).LoginHandler-fm (4 handlers)
ka-garage-south | [GIN-debug] GET /api/dashboard --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func3 (4 handlers)
ka-garage-south | [GIN-debug] POST /api/latest-events --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func4 (4 handlers)
ka-garage-south | [GIN-debug] GET /api/days --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func5 (4 handlers)
ka-garage-south | [GIN-debug] GET /api/stream --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func6 (4 handlers)
ka-garage-south | [GIN-debug] GET /api/config --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func7 (4 handlers)
ka-garage-south | [GIN-debug] POST /api/config --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func8 (4 handlers)
ka-garage-south | [GIN-debug] GET /api/restart --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func9 (4 handlers)
ka-garage-south | [GIN-debug] GET /api/stop --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func10 (4 handlers)
ka-garage-south | [GIN-debug] POST /api/camera/verify/:streamType --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func11 (4 handlers)
ka-garage-south | [GIN-debug] POST /api/hub/verify --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func12 (4 handlers)
ka-garage-south | [GIN-debug] POST /api/persistence/verify --> github.com/kerberos-io/agent/machinery/src/routers/http.AddRoutes.func13 (4 handlers)
ka-garage-south | {"level":"info","msg":"RunAgent: opening RTSP stream","time":"2022-12-21T09:35:05-07:00"}
ka-garage-south | [GIN-debug] GET /file/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (9 handlers)
ka-garage-south | [GIN-debug] HEAD /file/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (9 handlers)
ka-garage-south | [GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
ka-garage-south | Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
ka-garage-south | [GIN-debug] Listening and serving HTTP on :80
ka-garage-south | {"level":"info","msg":"ControlAgent: Number of packets read 0","time":"2022-12-21T09:35:05-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: opened RTSP stream","time":"2022-12-21T09:35:06-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: opened RTSP sub stream","time":"2022-12-21T09:35:06-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: SetMaxGopCount was set with: 20","time":"2022-12-21T09:35:06-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: Creating sub stream queue with SetMaxGopCount set to 20","time":"2022-12-21T09:35:06-07:00"}
ka-garage-south | {"level":"info","msg":"ConfigureMQTT: Set broker uri tcp://195.168.1.95:1883","time":"2022-12-21T09:35:06-07:00"}
ka-garage-south | {"level":"info","msg":"ProcessMotion: Continuous recording, so no motion detection.","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"info","msg":"HandleLiveStreamHD: Waiting for peer connections.","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"error","msg":"HandleHeartBeat: (400) Something went wrong while sending to Kerberos Hub.","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"info","msg":"WriteToTrack: listing codecs.","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"info","msg":"WriteToTrack: codec - H264 found.","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"info","msg":"H264","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"info","msg":"WriteToTrack: not using a transcoder.","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"info","msg":"HandleRecordStream: Start continuous recording ","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"info","msg":"ControlAgent: Number of packets read 0","time":"2022-12-21T09:35:10-07:00"}
ka-garage-south | {"level":"info","msg":"ControlAgent: Number of packets read 0","time":"2022-12-21T09:35:15-07:00"}
ka-garage-south | {"level":"info","msg":"Main: Restarting machinery.","time":"2022-12-21T09:35:15-07:00"}
ka-garage-south | {"level":"error","msg":"HandleStream: read tcp 192.168.32.2:43006-\u003e192.168.1.83:554: use of closed network connection","time":"2022-12-21T09:35:16-07:00"}
ka-garage-south | {"level":"error","msg":"HandleSubStream: read tcp 192.168.32.2:43018-\u003e192.168.1.83:554: use of closed network connection","time":"2022-12-21T09:35:16-07:00"}
ka-garage-south | {"level":"info","msg":"WriteToTrack: stop writing to track.","time":"2022-12-21T09:35:16-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: waiting 3 seconds to make sure everything is properly closed.","time":"2022-12-21T09:35:16-07:00"}
ka-garage-south | {"level":"info","msg":"Successfully Opened config.json from opensource","time":"2022-12-21T09:35:19-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: opening RTSP stream","time":"2022-12-21T09:35:19-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: opened RTSP stream","time":"2022-12-21T09:35:20-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: opened RTSP sub stream","time":"2022-12-21T09:35:20-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: SetMaxGopCount was set with: 20","time":"2022-12-21T09:35:20-07:00"}
ka-garage-south | {"level":"info","msg":"RunAgent: Creating sub stream queue with SetMaxGopCount set to 20","time":"2022-12-21T09:35:20-07:00"}
ka-garage-south | {"level":"info","msg":"ConfigureMQTT: Set broker uri tcp://195.168.1.95:1883","time":"2022-12-21T09:35:20-07:00"}
ka-garage-south | {"level":"info","msg":"ControlAgent: Number of packets read 0","time":"2022-12-21T09:35:22-07:00"}
ka-garage-south | {"level":"info","msg":"ProcessMotion: Continuous recording, so no motion detection.","time":"2022-12-21T09:35:23-07:00"}
ka-garage-south | {"level":"info","msg":"HandleLiveStreamHD: Waiting for peer connections.","time":"2022-12-21T09:35:23-07:00"}
ka-garage-south | {"level":"info","msg":"HandleRecordStream: Start continuous recording ","time":"2022-12-21T09:35:23-07:00"}
ka-garage-south | {"level":"error","msg":"HandleHeartBeat: (400) Something went wrong while sending to Kerberos Hub.","time":"2022-12-21T09:35:23-07:00"}
ka-garage-south | {"level":"info","msg":"WriteToTrack: listing codecs.","time":"2022-12-21T09:35:23-07:00"}
ka-garage-south | {"level":"info","msg":"WriteToTrack: codec - H264 found.","time":"2022-12-21T09:35:23-07:00"}
ka-garage-south | {"level":"info","msg":"H264","time":"2022-12-21T09:35:23-07:00"}
ka-garage-south | {"level":"info","msg":"WriteToTrack: not using a transcoder.","time":"2022-12-21T09:35:23-07:00"}
ka-garage-south | {"level":"info","msg":"ControlAgent: Number of packets read 0","time":"2022-12-21T09:35:27-07:00"}
Testing Process
- Access agent at http://[hostname]:80/
- Log in with [username] and [password]
- Validate camera feed is live
- Check initial settings in configuration file (note: listing only those expected to change)
"name": "garage-south",
[...]
"timezone": "America/Edmonton",
[...]
"continuous": "false",
[...]
"region": {
"name": "",
"rectangle": {
"x1": 0,
"y1": 0,
"x2": 800,
"y2": 640
},
"polygon": []
},
- Edit settings as follows: 5.1. Click Settings | Overview 5.2. Camera Name from "garage-south" to "garage-south-two" 5.3. Timezone from "" to "(UTC-07:00) Mountain Time (US & Canada)" 5.4. Click Save 5.5. Confirm message "Your configuration have been updated successfully." appears
- Check configuration file:
"name": "garage-south-2",
[...]
"timezone": "America/Boise",
- Edit settings as follows: 7.1. Click Settings | Recording 7.2. Continuous recording from "disabled" to "enabled" 7.3. Click Save 7.4. Confirm message "Your configuration have been updated successfully." appears
- Check configuration file:
"continuous": "true",
- Edit settings as follows: 9.1. Click Settings | Conditions 9.2. In Region of Interest define a "polygon-selection" region 9.3. Click Save 9.4. Confirm message "Your configuration have been updated successfully." appears
- Check configuration file:
"region": {
"name": "",
"rectangle": {
"x1": 0,
"y1": 0,
"x2": 800,
"y2": 640
},
"polygon": []
},
- Edit settings as follows: 11.1. Click Settings | Conditions 11.2. In Region of Interest define a "rectangle box" region 11.3. Click Save 11.4. Confirm message "Your configuration have been updated successfully." appears
- Check configuration file:
"region": {
"name": "",
"rectangle": {
"x1": 0,
"y1": 0,
"x2": 800,
"y2": 640
},
"polygon": [
{
"id": "1671641763618",
"coordinates": [
{
"x": 530.5807711693549,
"y": 392.1292212701613
},
{
"x": 1909.6776713709678,
"y": 392.1292212701613
},
{
"x": 1909.6776713709678,
"y": 1073.4195438508063
},
{
"x": 530.5807711693549,
"y": 1073.4195438508063
}
]
}
]
},
Browser Details
- Google Chrome 108.0.5359.125 (64-bit)
- Mozilla Firefox 108.0.1 (64-bit)
Results Summary
Test 5: ✔️ Settings Test 7: ✔️ Recording Test 9: ❌ Polygon Test 11: ✔️ Rectangle
Conclusion
I tried this a few times on Firefox and Chrome, but nothing saves.
Thanks again for the detailed logs! I also noticed your camera is restarting. Is this happening continuously?
ka-garage-south | {"level":"info","msg":"HandleRecordStream: Start continuous recording ","time":"2022-12-21T09:35:09-07:00"}
ka-garage-south | {"level":"info","msg":"ControlAgent: Number of packets read 0","time":"2022-12-21T09:35:10-07:00"}
ka-garage-south | {"level":"info","msg":"ControlAgent: Number of packets read 0","time":"2022-12-21T09:35:15-07:00"}
ka-garage-south | {"level":"info","msg":"Main: Restarting machinery.","time":"2022-12-21T09:35:15-07:00"}
ka-garage-south | {"level":"error","msg":"HandleStream: read tcp 192.168.32.2:43006-\u003e192.168.1.83:554: use of closed network connection","time":"2022-12-21T09:35:16-07:00"}
ka-garage-south | {"level":"error","msg":"HandleSubStream: read tcp 192.168.32.2:43018-\u003e192.168.1.83:554: use of closed network connection","time":"2022-12-21T09:35:16-07:00"}
ka-garage-south | {"level":"info","msg":"WriteToTrack: stop writing to track.","time":"2022-12-21T09:35:16-07:00"}
Not sure if still relevant @instantdreams, but it looks like it might be linked to user permissions: https://github.com/kerberos-io/agent/issues/94#issuecomment-1504325778.