Full ALPR Database System for Blue Iris!

I have a small bat file I run through windows scheduler. only three lines:

net stop "CodeProject.AI Server"
timeout /t 120 /nobreak
net start "CodeProject.AI Server"
I'll give it a try. Thanks
 
Im running ALPR on a Linux Mint VM in Unraid and managed to tank my VM as well as my VM backup. I lost all my plates data. Oh well.

Ive got VM snapshot now which should make it easier to restore things.

Was wondering if there is an easy way to backup the ALPR database to another location and have option to restore.
 
Try running the following commands in the db container (per janhaus):

Code:
psql -d postgres -U postgres -f /docker-entrypoint-initdb.d/schema.sql

Code:
psql -d postgres -U postgres -f /docker-entrypoint-initdb.d/migrations.sql

If you get an error because there was no schema or migration file in the container, but you can see the file listed in the files tab for the container, see if there is a note with the word "mount." If so it means the container is accessing the file externally. If you copy the latest version of the file into your container and run the command again, it should work.

I get the no migration file error. It does say mount. How can I copy the latest version into the container? Using command prompt I always get "Error response from daemon: unlinkat /migrations.sql: device or resource busy". Even if the containers are stopped
 
Also, is anyone able to access the server remotely?

I can get the login page, but when putting in my password it just refreshes the page.

Blue iris and codeproject have no problems with accessing via local IP
 
What is mean is that locally, when I try and log in using the local ip address, I get the login page, prompting for a password, but it won't log me in.
It sounds like a firewall issue. You need to create an inbound and outbound rule allowing the port you setup for the app (typically 3000).

Here's an example of mine. I'm using port 3001.

Screen Shot 2025-06-10 at 10.15.57 PM.png
 
It sounds like a firewall issue. You need to create an inbound and outbound rule allowing the port you setup for the app (typically 3000).

Here's an example of mine. I'm using port 3001.
I tried and still no go

Logging into the ALPR database only works on the local machine it is running on.

Here is my error log, **** replacing session IDs

6/11/2025, 8:55:50 AM [WARN] No whitelisted IPs configured
6/11/2025, 8:55:50 AM [INFO] No session or IP not whitelisted, redirecting to /login.
6/11/2025, 8:55:50 AM [INFO] GET /login
6/11/2025, 8:55:51 AM [INFO] Middleware checking path: /login, Session ID from cookie: null
6/11/2025, 8:55:59 AM [INFO] GET /
6/11/2025, 8:55:59 AM [INFO] Middleware checking path: /, Session ID from cookie: null
6/11/2025, 8:55:59 AM [INFO] No session ID found in cookie. Checking IP whitelist or redirecting to login.
6/11/2025, 8:55:59 AM [INFO] POST /api/verify-whitelist
6/11/2025, 8:55:59 AM [INFO] Checking IP: 172.18.0.1
6/11/2025, 8:56:03 AM [INFO] Attempting login...
6/11/2025, 8:56:03 AM [INFO] Session limit reached. Removing oldest session: ****************
6/11/2025, 8:56:03 AM [INFO] Created session ID: ****************
6/11/2025, 8:56:04 AM [ERROR] Login error: Error: NEXT_REDIRECT
 
Not sure what is going on but if you go into the HomeAssistant tab and add the IP address of your docker container (172.18.0.1) to the whitelist it should work.

Screen Shot 2025-06-11 at 3.38.35 PM.png
 
Im running ALPR on a Linux Mint VM in Unraid and managed to tank my VM as well as my VM backup. I lost all my plates data. Oh well.

Ive got VM snapshot now which should make it easier to restore things.

Was wondering if there is an easy way to backup the ALPR database to another location and have option to restore.

Yes, there is a way to backup and restore the database, but it's very manual.

To backup a database:

pg_dump -U postgres -d postgres > dump-filename.sql

To restore it, the DB should be empty, so drop it:

dropdb -U postgres postgres

and then create an empty database:

createdb -U postgres postgres

then copy the backup over via docker cp

now use that file to re-create the database:

psql -U postgres -d postgres -f dump-filename.sql

Check if the entries in the db is correct from the app

Would you like to see an easy button for this? If so, up vote this: Backup and restore · algertc ALPR-Database · Discussion #42
 
  • Like
Reactions: prsmith777
Yes, there is a way to backup and restore the database, but it's very manual.

To backup a database:

pg_dump -U postgres -d postgres > dump-filename.sql

To restore it, the DB should be empty, so drop it:

dropdb -U postgres postgres

and then create an empty database:

createdb -U postgres postgres

then copy the backup over via docker cp

now use that file to re-create the database:

psql -U postgres -d postgres -f dump-filename.sql

Check if the entries in the db is correct from the app

Would you like to see an easy button for this? If so, up vote this: Backup and restore · algertc ALPR-Database · Discussion #42
Exactly what I was looking for. Upvoted.

Maybe add request here for more visibility.
 
Last edited:
Login error today.

Screenshot from 2025-06-13 10-04-09.png


No changes were made (I did not change my password), I logged in last night and everything seemed to be working okay, but this morning, I wasn't able to login. The logs in the docker window show:

✓ Starting...
app-1 | ✓ Ready in 592ms
app-1 | POST /login
app-1 | Logging in user
app-1 | Error initializing auth: SyntaxError: Unexpected non-whitespace character after JSON at position 482
app-1 | at JSON.parse (<anonymous>)
app-1 | at d (/app/.next/server/chunks/2271.js:1:23995)
app-1 | at async p (/app/.next/server/chunks/2271.js:1:24500)
app-1 | at async K (/app/.next/server/chunks/2271.js:1:11672)
app-1 | at async (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:127:1299)
app-1 | at async rc (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:126:11937)
app-1 | at async an (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:132:1048)
app-1 | at async doRender (/app/node_modules/next/dist/server/base-server.js:1568:34)
app-1 | at async responseGenerator (/app/node_modules/next/dist/server/base-server.js:1814:28)
app-1 | at async NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/next/dist/server/base-server.js:1824:28)


Anyone else have this issue, or know how to fix it?

Already tried stopping the container and restarting it. Same issue.
Rebooted the Linux host, started container. Same issue.
docker compose pull, started container. Same issue.

Thanks
 
Last edited:
I saw something similar a few days ago. Completely shutting down docker and then restarting fixed it for me.

Okay, thanks. I've restarted the server, cleared browser cache/saved password, used a different browser, etc, but still no go. I have another instance of this running at another location and it is running fine, so this is kinda of weird.
 
Okay, login problem solved, but I am not sure why, maybe someone with a bit more knowledge can explain.

CPAI was in a wedged state. CPAI was running, but the ALPR module was dead, once I started it, I was able to login again, no more error. This is very odd because I have used the database before w/o CPAI running and didn't have any issues, so I am not sure why CPAI ALPR module not running would cause this. The object detection module was still working on CPAI, it was just the ALPR module that died.

Update 1:

So... it's still weird. I usually keep 2 windows of ALPR Database open, one with the live feed, and the other with the table view. I am able to log into 1 window, but the 2nd would still not work, BUT I can just change the url from /login to /live_view and it would let me in.

Something is still broke.

Update 2:

My system is working again. I was also unable to get into the settings menu to check the api key, to do that, I removed /auth/auth.json and restarted. This allowed me to get into the settings menu again, and once there, I noticed the API key changed. Once I updated the api key, everything is working again.

Hope this helps someone out in the future.
 
Last edited: