OpenALPR Webhook Processor for IP Cameras

Appears to be a user/permissions issue with my moved database, error:
'
Code:
General error: 8 attempt to write a readonly database
 
If anyone knows how to check progress on the database conversion from version 5.0.0 onwards, please let me know, using Docker for Windows. CPU use on the container is higher than normal and currently cannot access or see logs after upgrading....
 
How's the CPU look? I had 1 core pegged at about 100% for a while, then it moved to a more mixed workload with all cores bouncing around, then went idle and it was done, then my logs came back
 
How's the CPU look? I had 1 core pegged at about 100% for a while, then it moved to a more mixed workload with all cores bouncing around, then went idle and it was done, then my logs came back
Main CPU is loading up between 30-40%, up and down, container CPU usage has been variable, seems to sit at 30-40% for a while, then dropped back to 6%, backup up again later to 35%, now 5 hours in on 25GB size DB, processor.db-shm and -wal files keep appearing then dropping out again. I have to assume something is happening, main DB file size has stayed the same throughout. Machine is a i5-8400 with 32GB RAM and Samsung 980 Pro 1TB, I jokingly refer to it as a new machine because it got built when that processor was released, then I could not face commissioning it, also regret not going for an i7 but there is always next time! The existing machine is i5-4690 so the step up is certainly noticeable, new one barely breaks a sweat with Rekor running, that alone would tax the older one quite a bit depending on feed quality.

1718462237699.png

Currently moving around between cores, between 10-30% I guess, interested to see what temps this setup runs once I get Blue Iris and co running along with daily software.

**Update on DB upgrade, after 8 hours the log has started and shows this, CPU back down to 0.15%, looks like not much is happening:

Code:
2024-06-15 17:19:17 [17:19:17 INF] Starting Hangfire Server using job storage: 'In-Memory Storage'
2024-06-15 17:19:17 [17:19:17 INF] Using the following options for Hangfire Server:
2024-06-15 17:19:17     Worker count: 20
2024-06-15 17:19:17     Listening queues: 'default'
2024-06-15 17:19:17     Shutdown timeout: 00:00:15
2024-06-15 17:19:17     Schedule polling interval: 00:00:01
2024-06-15 17:19:17 [17:19:17 INF] Server 686e7ee0c79f:1:c7d54d89 successfully announced in 2.4371 ms
2024-06-15 17:19:17 [17:19:17 INF] Server 686e7ee0c79f:1:c7d54d89 is starting the registered dispatchers: ServerWatchdog, ServerJobCancellationWatcher, Worker, DelayedJobScheduler, RecurringJobScheduler...
2024-06-15 17:19:18 [17:19:18 INF] Server 686e7ee0c79f:1:c7d54d89 all the dispatchers started

Also the DB file is now double the size at 52gb!!
 
Last edited:
OK, upgraded right up to version 5.2.0 without issues, apart from doubling the database file size? is that expected behaviour?

If I try to spin up version 5.3.0 I still get the General error: 8 attempt to write to readonly database.

Almost certain this is a permissions issue, I have given permissions and ownership for the folders and files in alprwebhook to the Windows 11 account in use, still no dice :facepalm: - If I start version 5.3.0 with a blank database, it is fine, reads new plates no problem, so some issue with using the existing database with version 5.3.0. Now I know the notes for this version state:
  • The application inside docker no longer runs as root. You will need to change the owner of the database files or you will get errors about the database being read only.
So I am obviously not quite there with the permissions being set in the right place!
 
Last edited:
OK, if anyone out there knows what command to add which will give specific Windows user ownership or permissions for the alprwebhook folder and all that sail in her, please enlighten me. Current Docker Run command line is below:

Code:
docker run --net=bridge -e TZ=Etc/GMT-1 -d -p 3859:8080 -v "c:/alprwebhook/app/config/":"/app/config/" mlapaglia/openalprwebhookprocessor:v5.3.0

I am suspecting a variation on CHMOD, final piece of the puzzle, I will write this up for other Windows users running Docker Desktop.
 
@CamCrazy did you say you have an issue with plates being counted twice? Because now with my fully working setup, I have the same issue!


View attachment 196456

View attachment 196457
I am running on version 5.2.0 at the moment due to permissions issues! but, I am getting a similar error as above, new vehicle only seen once, total seen count is 2, did you make any progress? I also still see 'disconnected' in settings but plates are getting logged.

Just to note I ran a VACUUM command on my database, took about 20-30 minutes and got it down from 52GB to 25GB again.
 
Last edited:
Okay well at least we're in the same boat! I don't think I have a permissions issue going to 5.3.0, but it could be. I'll work on it some more today

Same issues as you, double count and shows disconnected. I just hope this doesn't forever alter the database, I make use of the count quite a lot
 
  • Wow
Reactions: CamCrazy
Okay well at least we're in the same boat! I don't think I have a permissions issue going to 5.3.0, but it could be. I'll work on it some more today

Same issues as you, double count and shows disconnected. I just hope this doesn't forever alter the database, I make use of the count quite a lot
Won't be permissions, that causes fail login, you won't even get running with that.

I will test 5.3.0 with the new 'empty' database later and tomorrow, see if that shows same error. Honestly I am seriously thinking just start fresh, the case for keeping historical entries, especially with doubt on accuracy is getting weaker for me.

Just back on fresh database now using 5.3.0, will wait to see results on duplicate issue, won't take long! first car through will be the benchmark :lol:

Can confirm duplicate total count issue persists for me on 5.3.0, first seen, last seen today at identical time, total seen shows as 2
 
Last edited:
To confirm, you're seeing duplicate plates on 5.3.0 with a net new database?
 
I wonder if I restore to a backup from before I upgraded, I'd hate this to forever alter the database count
 
I wonder if I restore to a backup from before I upgraded, I'd hate this to forever alter the database count
That could be a good plan, not entirely sure whether just the latest release seems to be effected by this, or if it is a docker issue? hard to say, I did not test with 5.2.0 or prior.
 
I'm on 5.2.0 and it has the issue
 
trying to install openalpr-webhook with the below commands on ubuntu 22.04.2 TLS


Code:
apt install build-essential python3 python3-dev python3.10-venv pip3 redis-server && systemctl enable redis-server && systemctl start redis-server
git clone https://github.com/mibs510/OpenALPR-Webhook
cd OpenALPR-Webhook
python3 -m venv ./venv
source ./venv/bin/activate
# Due to a dependency issue with flask-dance, flask-dance needs to be installed separately from all other packages
pip3 install flask-dance
pip3 install -r requirements.txt
./app.py --host=0.0.0.0 --port=8080

getting error:
Code:
Collecting PyYAML==6.0 (from -r requirements.txt (line 69))
  Using cached PyYAML-6.0.tar.gz (124 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
 
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [67 lines of output]
      /tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!
     
              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:
     
              License :: OSI Approved :: MIT License
     
              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************
     
      !!
        self._finalize_license_expression()
      running egg_info
      writing lib/PyYAML.egg-info/PKG-INFO
      writing dependency_links to lib/PyYAML.egg-info/dependency_links.txt
      writing top-level names to lib/PyYAML.egg-info/top_level.txt
      Traceback (most recent call last):
        File "/home/openalpr/OpenALPR-Webhook/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/openalpr/OpenALPR-Webhook/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/openalpr/OpenALPR-Webhook/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 320, in run_setup
          exec(code, locals())
        File "<string>", line 288, in <module>
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 186, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1002, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 1104, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 312, in run
          self.find_sources()
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 320, in find_sources
          mm.run()
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 543, in run
          self.add_defaults()
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 581, in add_defaults
          sdist.add_defaults(self)
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/command/sdist.py", line 109, in add_defaults
          super().add_defaults()
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 245, in add_defaults
          self._add_defaults_ext()
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 330, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<string>", line 204, in get_source_files
        File "/tmp/pip-build-env-sd2uxigy/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 131, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip
Collecting PyYAML==6.0 (from -r requirements.txt (line 69))


Please advise how to install please

i was able to fix this error by doing pip3 install PyYAML==6.0.1
 
Last edited:
After a successful install the last line:
./app.py --host=0.0.0.0 --port=8080

is giving the below error:
Code:
root@calvin-DNB20-series:/home/openalpr/OpenALPR-Webhook# ./app.py --host=0.0.0.0 --port=8080
./app.py: line 23: import: command not found
./app.py: line 25: from: command not found
./app.py: line 26: from: command not found
./app.py: line 27: from: command not found
./app.py: line 29: from: command not found
./app.py: line 30: from: command not found
./app.py: line 33: syntax error near unexpected token `('
./app.py: line 33: `DEBUG = os.getenv('DEBUG', 'False') == 'True''

how can i fix this error?
 
This is the requirment.txt that at least doesnt give errors

Code:
aiohttp==3.8.4
aiohttp-retry==2.8.3
aiosignal==1.3.1
alembic==1.10.4
aniso8601==9.0.1
argcomplete==3.0.8
arrow==1.2.3
astral==2.2
async-timeout==4.0.2
asyncio==3.4.3
attrs==23.1.0
blinker==1.9
certifi==2022.12.7
cfgv==3.3.1
charset-normalizer==3.1.0
click==8.1.3
colorama==0.4.4
Cython==0.29.34
decli==0.6.1
distlib==0.3.6
dnspython==2.3.0
email-validator==2.0.0.post2
filelock==3.12.0
Flask==3.1.0
flask-ipban==1.1.5
Flask-Login==0.6.2
Flask-Mail==0.9.1
Flask-Migrate==2.6.0
Flask-Minify==0.41
flask-paginate==2022.1.8
flask-restx==0.5.1
Flask-Script==2.0.6
Flask-SQLAlchemy==2.5.1
Flask-WTF==1.0.0
frozenlist==1.3.3
greenlet==2.0.2
gunicorn==20.1.0
htmlmin==0.1.12
identify==2.5.24
idna==3.4
importlib-metadata==6.6.0
ipc-sun-sync==0.2.3
itsdangerous==2.2.0
Jinja2==3.1.2
jsmin==3.0.1
jsonschema==4.17.3
lesscpy==0.15.1
Mako==1.2.4
MarkupSafe==2.1.1
marshmallow==3.14.1
marshmallow-sqlalchemy==0.22.3
multidict==6.0.4
nodeenv==1.8.0
oauthlib==3.2.2
packaging==23.1
phonenumbers==8.13.11
platformdirs==3.5.1
ply==3.11
progressbar2==4.2.0
prompt-toolkit==3.0.38
psutil==5.9.5
pycountry==22.3.5
PyJWT==2.6.0
pyrsistent==0.19.3
python-dateutil==2.8.2
python-utils==3.7.0
pytimeparse==1.1.8
pytz==2022.1
PyYAML==6.0.1
questionary==1.10.0
random-password-generator==2.2.0
rcssmin==1.1.1
redis==4.4.4
Redis-Sentinel-Url==1.0.1
requests==2.28.2
requests-oauthlib==1.3.1
rq==1.12.0
setproctitle==1.3.2
six==1.16.0
SQLAlchemy==1.4.29
sqlalchemy-json==0.5.0
termcolor==2.3.0
tomlkit==0.11.8
twilio==8.0.0
typing_extensions==4.5.0
urllib3==1.26.15
URLObject==2.4.3
virtualenv==20.23.0
wcwidth==0.2.6
Werkzeug==3.1
WTForms==3.0.0
xxhash==3.2.0
yarl==1.17.0
zipp==3.15.0

i'm now getting other errors:
Code:
Building wheels for collected packages: aiohttp, Flask-Mail, Flask-Script, frozenlist, greenlet, htmlmin, jsmin, MarkupSafe, multidict, pycountry
  Building wheel for aiohttp (pyproject.toml) ... error
  error: subprocess-exited-with-error
 
  × Building wheel for aiohttp (pyproject.toml) did not run successfully.
  │ exit code: 1

Code:
 Building wheel for frozenlist (pyproject.toml) ... error
  error: subprocess-exited-with-error
 
  × Building wheel for frozenlist (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [151 lines of output]
      /tmp/pip-build-env-3buxn6hj/overlay/lib/python3.12/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

Code:
 Building wheel for greenlet (pyproject.toml) ... error
  error: subprocess-exited-with-error
 
  × Building wheel for greenlet (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [152 lines of output]

Code:
 note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for greenlet

Successfully built Flask-Mail Flask-Script htmlmin jsmin MarkupSafe multidict pycountry
Failed to build aiohttp frozenlist greenlet
ERROR: Could not build wheels for aiohttp, frozenlist, greenlet, which is required to install pyproject.toml-based projects


Please advise