mateusz-jastrzebski / gNUT

NUT Graphical interface. Manage your UPS devices within one centralized server! Written in Django.
GNU General Public License v3.0
1 stars 0 forks source link

The app crashes when the docker container starts too quick relatively to the NUT containers #1

Closed mateusz-jastrzebski closed 2 months ago

mateusz-jastrzebski commented 3 months ago
Operations to perform:
  Apply all migrations: auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying sessions.0001_initial... OK
[2024-06-18 12:53:07 +0200] [1] [INFO] Starting gunicorn 22.0.0
[2024-06-18 12:53:07 +0200] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2024-06-18 12:53:07 +0200] [1] [INFO] Using worker: sync
[2024-06-18 12:53:07 +0200] [9] [INFO] Booting worker with pid: 9
[2024-06-18 12:53:07 +0200] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.12/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.12/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
                ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/util.py", line 371, in import_app
    mod = importlib.import_module(module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/app/webNUT/wsgi.py", line 16, in <module>
    application = get_wsgi_application()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/usr/local/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.12/site-packages/django/apps/registry.py", line 124, in populate
    app_config.ready()
  File "/app/ups/apps.py", line 16, in ready
    self.ups_list = self.webnut.get_ups_list()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/ups/nut2utils.py", line 31, in get_ups_list
    'battery': ups_vars['battery.charge'],
               ~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'battery.charge'
[2024-06-18 12:53:07 +0200] [9] [INFO] Worker exiting (pid: 9)
[2024-06-18 12:53:07 +0200] [1] [ERROR] Worker (pid:9) exited with code 3
[2024-06-18 12:53:07 +0200] [1] [ERROR] Shutting down: Master
[2024-06-18 12:53:07 +0200] [1] [ERROR] Reason: Worker failed to boot.
mateusz-jastrzebski commented 3 months ago

For now do:

docker restart gnut
mateusz-jastrzebski commented 2 months ago

Fixed by Commit Will be released in the upcoming Version 0.33