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

latest docker fails to load UI #99

Closed
neolynx opened this issue Aug 16, 2024 · 4 comments · Fixed by #101
Closed

latest docker fails to load UI #99

neolynx opened this issue Aug 16, 2024 · 4 comments · Fixed by #101

Comments

@neolynx
Copy link

neolynx commented Aug 16, 2024

Hello,

I pull latest docker:

adfreiburg/qlever-ui   latest          d2be01b5d838   12 hours ago     142MB

and the Qlever UI is only showing this error:

Environment:


Request Method: GET
Request URL: http://localhost:7002/

Django Version: 5.0.3
Python Version: 3.12.4
Installed Applications:
['whitenoise.runserver_nostatic',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'backend',
 'import_export']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File "/env/lib/python3.12/site-packages/django/contrib/sessions/backends/base.py", line 187, in _get_session
    return self._session_cache
           ^^^^^^^^^^^^^^^^^^^

During handling of the above exception ('SessionStore' object has no attribute '_session_cache'), another exception occurred:
  File "/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 275, in ensure_connection
    self.connect()
    ^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect
    self.connection = self.get_new_connection(conn_params)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 181, in get_new_connection
    conn = Database.connect(**conn_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The above exception (unable to open database file) was the direct cause of the following exception:
  File "/env/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/views.py", line 64, in index
    if request.session.get('backend', False):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/contrib/sessions/backends/base.py", line 68, in get
    return self._session.get(key, default)
           ^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/contrib/sessions/backends/base.py", line 192, in _get_session
    self._session_cache = self.load()
                          ^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/contrib/sessions/backends/db.py", line 42, in load
    s = self._get_session_from_db()
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/contrib/sessions/backends/db.py", line 32, in _get_session_from_db
    return self.model.objects.get(
           
  File "/env/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/models/query.py", line 645, in get
    num = len(clone)
          ^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/models/query.py", line 382, in __len__
    self._fetch_all()
    ^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/models/query.py", line 1928, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/models/query.py", line 91, in __iter__
    results = compiler.execute_sql(
              
  File "/env/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1560, in execute_sql
    cursor = self.connection.cursor()
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 316, in cursor
    return self._cursor()
           ^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 292, in _cursor
    self.ensure_connection()
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 274, in ensure_connection
    with self.wrap_database_errors:
    ^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 275, in ensure_connection
    self.connect()
    ^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect
    self.connection = self.get_new_connection(conn_params)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/env/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 181, in get_new_connection
    conn = Database.connect(**conn_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception Type: OperationalError at /
Exception Value: unable to open database file

Maybe something in the docker environment changed ?

I am starting the container from a docker-compose.yml:

  ui:
    image: adfreiburg/qlever-ui
    stop_grace_period: 0s
    platform: linux/amd64
    ports:
      - "7002:7002"
    depends_on:
      - server
    entrypoint: ["/custom/entrypoint.sh"]
    environment:
      QLEVER_SERVER_ENDPOINT: "http://127.0.0.1:7001"
      QLEVER_UI_PORT: 7002
    volumes:
      - ./qlever/ui/:/custom/

with this entrypoint,

#!/bin/sh

# Some configuration
QLEVER_UI_PORT="${QLEVER_UI_PORT:-7002}"
QLEVER_UI_WORKERS="${QLEVER_UI_WORKERS:-3}"
QLEVER_UI_LIMIT_REQUEST_LINE="${QLEVER_UI_LIMIT_REQUEST_LINE:-10000}"

# Make the script fail on errors
set -eux

# Configure the dataset
python manage.py configure default "${QLEVER_SERVER_ENDPOINT}"

# Start the UI
gunicorn \
  --bind ":${QLEVER_UI_PORT}" \
  --workers "${QLEVER_UI_WORKERS}" \
  --limit-request-line "${QLEVER_UI_LIMIT_REQUEST_LINE}" \
  qlever.wsgi:application

(inspired from https://github.com/zazukoians/qlever-tests)

am I doing something wrong with the latest version ?

@Qup42
Copy link
Member

Qup42 commented Aug 17, 2024

The error is with qlever-ui. It seems that the db directory is no longer included in the Container image which causes the error. It seems to have been ignored for the image build with 16b1e91. @hannahbast what was the reason for ignoring it?

@hannahbast
Copy link
Member

@neolynx @Qup42 Thanks a lot for pointing this out, will look at it right away

hannahbast added a commit that referenced this issue Aug 17, 2024
We ignore this for our local image because there we mount the `db` directory as a volume. But for the Docker build and push action on GitHub, it should of course not be ignored. This should fix #99
@hannahbast
Copy link
Member

hannahbast commented Aug 17, 2024

@neolynx I have just created and merged #101, which built and pushed a new Docker image. Can you please try again and let me know whether the problem is now resolved (for you)?

@hannahbast hannahbast reopened this Aug 17, 2024
@neolynx
Copy link
Author

neolynx commented Aug 17, 2024

Thanks Hannah, works again :-)

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

Successfully merging a pull request may close this issue.

3 participants