database not reciving alerts
First of all, wanted to say thank you for this project, I wouldn't be surprised if BI would add something like this or even this as part of the ALPR feature set.
I'm getting ALPR alerts w/ the plate number on BI but after setting up thealert with web request I'm not getting anything populated.
I did change the port from 3000 to 4000 and made sure to make that change on the alert and tried several alerts with plate & memo and got no luck
Attached is my docker compose, I do host a handful of other items, but I don't think that impacted anything.
version: "3.9"
networks: rustdesk-net: external: false nc-net: external: false
services: qbittorrent: image: linuxserver/qbittorrent:latest container_name: qbittorrent environment: - PUID=1000 - PGID=1000 - TZ=Etc/UTC - WEBUI_PORT=8090 volumes: # - /media/downloads:z - /media/2tb/qbt/config:/config:z - /media:/media:z ports: - 8090:8090 - 6881:6881 - 6881:6881/udp restart: unless-stopped plex: image: linuxserver/plex:latest container_name: plex restart: unless-stopped environment: - TZ=America/Chicago - PUID=1000 - PGID=1000 - VERSION=docker volumes: - /media:/media:z - /media/Media/DockerLinks/PlexLinks/config:/config:z network_mode: host
tautulli: image: ghcr.io/tautulli/tautulli container_name: tautulli restart: unless-stopped volumes: - /media/Media/tautulli/config:/config:z environment: - TZ=America/Chicago - PUID=1000 - PGID=1000 ports: - 8181:8181 homepage: image: ghcr.io/gethomepage/homepage:latest container_name: homepage ports: - 3030:3000 volumes: - /media:/media:z - /media/Media/hompage:/app/config # Make sure your local config directory exists - /var/run/docker.sock:/var/run/docker.sock # (optional) For docker integration restart: unless-stopped
homeassistant: container_name: homeassistant image: "ghcr.io/home-assistant/home-assistant:stable" volumes: - /media/Media/homeassistnat/DockerLinks:/config - /etc/localtime:/etc/localtime:ro restart: unless-stopped privileged: true ports: - 8123:8123
heimdall: image: lscr.io/linuxserver/heimdall:latest container_name: heimdall environment: - PUID=1000 - PGID=1000 - TZ=America/Chicago volumes: - /media/Media/DockerLinks/HeimdallLinks/config:/config ports: - 80:80 - 443:443 restart: unless-stopped
palworld-dedicated-server: #build: . container_name: palworld-dedicated-server image: jammsen/palworld-dedicated-server:latest restart: unless-stopped ports: - target: 8211 # Gamerserver port inside of the container published: 8211 # Gamerserver port on your host protocol: udp mode: host - target: 25575 # RCON port inside of the container published: 25575 # RCON port on your host protocol: tcp mode: host env_file: - ./default.env volumes: - ./game:/palworld
audiobookshelf: image: ghcr.io/advplyr/audiobookshelf:latest ports: - 13378:80 volumes: - /media/3rd2tb/audiobookshelf/audiobooks:/audiobooks:z - /media/3rd2tb/audiobookshelf/podcasts:/podcasts:z - /media/Media/DockerLinks/audiobookshelf/config:/config:z - /media/3rd2tb/audiobookshelf/metadata:/metadata:z environment: - TZ=America/Chicago restart: unless-stopped
nessus: image: tenable/nessus:10.6.1-ubuntu restart: always container_name: nessus environment: USERNAME: alex PASSWORD: fakepassowrd ACTIVATION_CODE: xxxxxxxxxxxxxxxxxxxxxxxxxxxx ports: - 8834:8834
valheim: image: mbround18/valheim:latest ports: - 2456:2456/udp - 2457:2457/udp - 2458:2458/udp environment: PORT: 2456 NAME: "Blazin" WORLD: "Dedicated" PASSWORD: "fakepassword" TZ: "America/Chicago" PUBLIC: 1 volumes: - /media:/media:z - /media/media/DockerLinks/Valheim/saves:/home/steam/.config/unity3d/IronGate/Valheim:z - /media/media/DockerLinks/Valheim/server:/home/steam/valheim:z
CodeProjectAI: image: codeproject/ai-server container_name: codeproject-ai-server-cpu hostname: codeproject-ai-server restart: unless-stopped ports: - "32168:32168" environment: - TZ=America/Toronto alpr: image: algertc/alpr-dashboard:latest restart: unless-stopped ports: - "4000:3000" # Change the first port to the port you want to expose environment: - NODE_ENV=production - ADMIN_PASSWORD=fakepassowrd # Change this to a secure password - DB_PASSWORD=fakepassowrd # Change this to match your postgres password depends_on: - db volumes: - app-auth:/app/auth - app-config:/app/config
db: image: postgres:13 environment: - POSTGRES_DB=postgres - POSTGRES_USER=postgres - POSTGRES_PASSWORD=fakepassowrd # Change this to a secure password volumes: - db-data:/var/lib/postgresql/data:z - ./schema.sql:/docker-entrypoint-initdb.d/schema.sql:z - ./migrations.sql:/migrations.sql:z
# Make sure you download the migrations.sql file if you are updating your existing database.
# Place it in the same directory as your docker-compose.yml and schema.sql files. If you changed the user or database name, you will need to plug those values into the command below.
command: >
bash -c "
docker-entrypoint.sh postgres &
until pg_isready; do sleep 1; done;
psql -U postgres -d postgres -f /migrations.sql;
wait
"
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
volumes: db-data: app-auth: driver: local driver_opts: type: none o: bind device: ./auth app-config: driver: local driver_opts: type: none o: bind device: ./config
Have you looked at the container logs at all? To troubleshoot we would want to know what it says in there, what it says in the BI logs, and if there are any errors.
If you see "no stream" in BI, try reducing the size and quality of your JPEGS in BI. That fixed it for me.
I am having the same issue. Docker log shows password authentication error for user postgres. I have tried fixing it via reinstalling via the updated script, editing the docker compose, & via the web console - (ports are also open) nothing is fixing it. Any suggestions?
025-02-23 08:36:57 app-1 | camera: 'gate1',
2025-02-23 08:36:57 app-1 | timestamp: '2025-02-23T16:36:34.259Z'
2025-02-23 08:36:57 app-1 | }
2025-02-23 08:36:57 db-1 | 2025-02-23 16:36:57.222 GMT [202] FATAL: password authentication failed for user "postgres"
2025-02-23 08:36:57 db-1 | 2025-02-23 16:36:57.222 GMT [202] DETAIL: Password does not match for user "postgres".
2025-02-23 08:36:57 db-1 | Connection matched pg_hba.conf line 99: "host all all all md5"
2025-02-23 08:36:57 app-1 | Error processing request: error: password authentication failed for user "postgres"
2025-02-23 08:36:57 app-1 | at
Changing the password in the compose file won't do anything after it has been created. Those values are only used for first time setup. If you need to change the database password, it has to be done manually with an SQL client. Use the password you first used when setting it up and it should work.
https://stackoverflow.com/questions/12720967/how-can-i-change-a-postgresql-user-password
I am deleting the docker container each time and then running a new install using the windows script you provided. I also tried changing the password and saving in the console.
I do see No stream in BI and nothing is getting recorded. How do I change size and quality of what is being posted?
container log...```
2025-02-26 11:33:15 app-1 | camera: 'alpr',
2025-02-26 11:33:15 app-1 | ALERT_PATH: 'alpr.20250226_110001.1967522.3-1.jpg',
2025-02-26 11:33:15 app-1 | ALERT_CLIP: '@19332782441441',
2025-02-26 11:33:15 app-1 | timestamp: '2025-02-26T19:32:57.496Z'
2025-02-26 11:33:15 app-1 | }
2025-02-26 11:33:15 app-1 | Database connection established
2025-02-26 11:33:15 app-1 | [FileStorage] Successfully saved image
2025-02-26 11:33:15 app-1 | Error processing request: error: there is no unique or exclusion constraint matching the ON CONFLICT specification
2025-02-26 11:33:15 app-1 | at <unknown> (/app/node_modules/pg/lib/client.js:535:17)
2025-02-26 11:33:15 app-1 | at async p (/app/.next/server/app/api/plate-reads/route.js:1:4464)
2025-02-26 11:33:15 app-1 | at async te.do (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:18:17826)
2025-02-26 11:33:15 app-1 | at async te.handle (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:18:22492)
2025-02-26 11:33:15 app-1 | at async doRender (/app/node_modules/next/dist/server/base-server.js:1455:42)
2025-02-26 11:33:15 app-1 | at async responseGenerator (/app/node_modules/next/dist/server/base-server.js:1814:28)
2025-02-26 11:33:15 app-1 | at async NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/next/dist/server/base-server.js:1824:28)
2025-02-26 11:33:15 app-1 | at async NextNodeServer.renderPageComponent (/app/node_modules/next/dist/server/base-server.js:2240:24)
2025-02-26 11:33:15 app-1 | at async NextNodeServer.renderToResponseImpl (/app/node_modules/next/dist/server/base-server.js:2278:32) {
2025-02-26 11:33:15 app-1 | length: 148,
2025-02-26 11:33:15 app-1 | severity: 'ERROR',
2025-02-26 11:33:15 app-1 | code: '42P10',
2025-02-26 11:33:15 app-1 | detail: undefined,
2025-02-26 11:33:15 app-1 | hint: undefined,
2025-02-26 11:33:15 app-1 | position: undefined,
2025-02-26 11:33:15 app-1 | internalPosition: undefined,
2025-02-26 11:33:15 app-1 | internalQuery: undefined,
2025-02-26 11:33:15 app-1 | where: undefined,
2025-02-26 11:33:15 app-1 | schema: undefined,
2025-02-26 11:33:15 app-1 | table: undefined,
2025-02-26 11:33:15 app-1 | column: undefined,
2025-02-26 11:33:15 app-1 | dataType: undefined,
2025-02-26 11:33:15 app-1 | constraint: undefined,
2025-02-26 11:33:15 app-1 | file: 'plancat.c',
2025-02-26 11:33:15 app-1 | line: '870',
2025-02-26 11:33:15 app-1 | routine: 'infer_arbiter_indexes'
2025-02-26 11:33:15 app-1 | }
Same error here. Also when reinstalling (purging old files) using the latest version.
Request:
curl --location '192.168.2.63:3000/api/plate-reads' \
--header 'x-api-key: 03f3bff78699cc0d7d3dbb4ba04b3a515bd4f8a1a012ddfb4835f672077baf8f' \
--header 'Content-Type: application/json' \
--data-raw '{
"plate_number": "XXXXX",
"Image": "/9j/4AAQSkZJRg...",
"camera": "test-cam",
"ALERT_PATH": "test-cam.20250324_094607.70593.7-1.jpg",
"ALERT_CLIP": "@19334992007779",
"timestamp": "2025-03-24T10:42:59.184Z"
}'
Response:
{
"error": "Internal server error",
"details": "there is no unique or exclusion constraint matching the ON CONFLICT specification"
}
I too am getting the same error and nothing is populating into the DB although images are being saved in the correct folders.
Postgres log: 2025-04-01 11:09:28.061 EDT [554] ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification 2025-04-01 11:09:28.061 EDT [554] STATEMENT: WITH new_plate AS ( INSERT INTO plates (plate_number) VALUES ($1) ON CONFLICT (plate_number) DO NOTHING ), new_read AS ( INSERT INTO plate_reads ( plate_number, image_data, image_path, thumbnail_path, timestamp, camera_name, bi_path, confidence, crop_coordinates, ocr_annotation, plate_annotation ) SELECT $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11 WHERE NOT EXISTS ( SELECT 1 FROM plate_reads WHERE plate_number = $1 AND timestamp = $5 ) RETURNING id ) SELECT id FROM new_read
ALPR Log:
camera: 'LPR',
ALERT_PATH: 'LPR.20250401_110000.558618.3-1.jpg',
ALERT_CLIP: '@89704449818323',
timestamp: '2025-04-01T15:09:24.623Z'
}
Database connection established
[FileStorage] Successfully saved image
Error processing request: error: there is no unique or exclusion constraint matching the ON CONFLICT specification
at
I had the same issue with new docker install, but managed to solve it by adding unique index to plate_number column in plates table and also adding a sequence to id column in plate_reads table. I hope this helps
I am also getting the same error
[ERROR] Error processing request: error: there is no unique or exclusion constraint matching the ON CONFLICT specification
I tried the fix from jonnoman
[(https://github.com/algertc/ALPR-Database/discussions/55)]
But the error is still there and no plates on dashboard