Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ciso-assistant-next helm chart does not set HUEY_FILE_PATH causing backend pod crashes #1500

Open
hmoens opened this issue Feb 14, 2025 · 0 comments

Comments

@hmoens
Copy link

hmoens commented Feb 14, 2025

Describe the bug
Deploying the helm chart with recent versions of ciso-assistant, I get the following error:

Traceback (most recent call last):
  File "/code/manage.py", line 23, in <module>
    main()
  File "/code/manage.py", line 19, in main
    execute_from_command_line(sys.argv)
  File "/code/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/code/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/code/.venv/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/code/.venv/lib/python3.12/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/django/apps/config.py", line 193, in create
    import_module(entry)
  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 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/code/.venv/lib/python3.12/site-packages/huey/contrib/djhuey/__init__.py", line 101, in <module>
    HUEY = backend_cls(name, **huey_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/huey/api.py", line 119, in __init__
    self.storage = self.create_storage()
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/huey/api.py", line 144, in create_storage
    return self.get_storage(**self.storage_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/huey/api.py", line 156, in get_storage
    return Storage(self.name, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/huey/storage.py", line 713, in __init__
    super(SqliteStorage, self).__init__(name)
  File "/code/.venv/lib/python3.12/site-packages/huey/storage.py", line 628, in __init__
    self.initialize_schema()
  File "/code/.venv/lib/python3.12/site-packages/huey/storage.py", line 664, in initialize_schema
    with self.db(commit=True, close=True) as curs:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/huey/storage.py", line 647, in db
    conn = self.conn
           ^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/huey/storage.py", line 639, in conn
    self._state.set_connection(self._create_connection())
                               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/code/.venv/lib/python3.12/site-packages/huey/storage.py", line 716, in _create_connection
    conn = sqlite3.connect(self.filename, timeout=self._timeout,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file

This error seems to be happening as a result of HUEY_FILE_PATH not being set by the chart. This results in the backend using the default of /code/db/huey.db. As this path does not exist an error is raised.

To make this work, HUEY_FILE_PATH should be set to /ciso/db/huey.db, assuming local storage is present.

Workaround:
By ssh-ing into the backend pod and manually running mkdir /code/db I can get the backend to start. This is bad in two ways however:

  • this does not persist after pod restarts, so this has to be run whenever the pod moves
  • this does not actually persist huey.db, meaning the contents of it are lost on every pod restart.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy the ciso-assistant-next helm chart
  2. Observe failures in the backend, and server errors in the frontend as the backend fails to initialize.

Expected behavior
The application to deploy without issue.

Environment (please complete the following information):

  • Kubernetes
  • Tested with v2.1.5, but this appears to be an issue for every v2.1.x version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant