linuxserver / docker-healthchecks

GNU General Public License v3.0
177 stars 37 forks source link

[BUG] OperationalError at /accounts/login/ no such table: api_tokenbucket #103

Closed ithakaa closed 1 year ago

ithakaa commented 1 year ago

Is there an existing issue for this?

Current Behavior

The webui throws the error when trying to setup a user account after installation

OperationalError at /accounts/login/ no such table: api_tokenbucket

Expected Behavior

Account creation

Steps To Reproduce

  1. docker-compose up -d
  2. browser to webui
  3. setup account

Environment

- OS: Ubuntu 20.04
- How docker service was installed: apt

CPU architecture

x86-64

Docker creation

---
version: "2.1"
services:
  healthchecks:
    image: lscr.io/linuxserver/healthchecks:latest
    container_name: healthchecks
    environment:
      - PUID=1000
      - PGID=1000
      - SITE_ROOT=
      - SITE_NAME=
      - DEFAULT_FROM_EMAIL=
      - EMAIL_HOST=
      - EMAIL_PORT=
      - EMAIL_HOST_USER=
      - EMAIL_HOST_PASSWORD=
      - EMAIL_USE_TLS=
      - SUPERUSER_EMAIL=
      - SUPERUSER_PASSWORD=
      - REGENERATE_SETTINGS= #optional
      - ALLOWED_HOSTS= #optional
      - APPRISE_ENABLED= #optional
      - DEBUG= #optional
      - INTEGRATIONS_ALLOW_PRIVATE_IPS= #optional
      - PING_EMAIL_DOMAIN= #optional
      - SECRET_KEY= #optional
      - SITE_LOGO_URL= #optional
    volumes:
      - /path/to/data:/config
    ports:
      - 8000:8000
      - 2525:2525 #optional
    restart: unless-stopped

Container logs

ERRORS:
?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found . See the release notes for details.
[uwsgi-daemons] throttling "/usr/bin/python3 ./manage.py sendalerts" for 63 seconds
[uwsgi-daemons] throttling "/usr/bin/python3 ./manage.py smtpd --port 2525" for 63 seconds
[uwsgi-daemons] throttling "/usr/bin/python3 ./manage.py sendreports --loop" for 63 seconds
[pid: 150|app: 0|req: 7/7] 192.168.0.18 () {36 vars in 720 bytes} [Fri Feb 17 02:23:45 2023] GET / => generated 0 bytes in 0 msecs (HTTP/1.1 302) 9 headers in 289 bytes (1 switches on core 0)
[pid: 150|app: 0|req: 8/8] 192.168.0.18 () {36 vars in 750 bytes} [Fri Feb 17 02:23:45 2023] GET /accounts/login/ => generated 11104 bytes in 3 msecs (HTTP/1.1 200) 9 headers in 398 bytes (1 switches on core 0)
Internal Server Error: /accounts/login/
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 357, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: api_tokenbucket

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/usr/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/app/healthchecks/./hc/accounts/views.py", line 159, in login
    if magic_form.is_valid():
  File "/usr/lib/python3.10/site-packages/django/forms/forms.py", line 205, in is_valid
    return self.is_bound and not self.errors
  File "/usr/lib/python3.10/site-packages/django/forms/forms.py", line 200, in errors
    self.full_clean()
  File "/usr/lib/python3.10/site-packages/django/forms/forms.py", line 437, in full_clean
    self._clean_fields()
  File "/usr/lib/python3.10/site-packages/django/forms/forms.py", line 452, in _clean_fields
    value = getattr(self, "clean_%s" % name)()
  File "/app/healthchecks/./hc/accounts/forms.py", line 63, in clean_identity
    if not TokenBucket.authorize_login_email(v):
  File "/app/healthchecks/./hc/api/models.py", line 1172, in authorize_login_email
    return TokenBucket.authorize(value, 20, 3600)
  File "/app/healthchecks/./hc/api/models.py", line 1126, in authorize
    obj, created = TokenBucket.objects.get_or_create(value=value)
  File "/usr/lib/python3.10/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/django/db/models/query.py", line 929, in get_or_create
    return self.get(**kwargs), False
  File "/usr/lib/python3.10/site-packages/django/db/models/query.py", line 646, in get
    num = len(clone)
  File "/usr/lib/python3.10/site-packages/django/db/models/query.py", line 376, in __len__
    self._fetch_all()
  File "/usr/lib/python3.10/site-packages/django/db/models/query.py", line 1867, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/lib/python3.10/site-packages/django/db/models/query.py", line 87, in __iter__
    results = compiler.execute_sql(
  File "/usr/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1398, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python3.10/site-packages/django/db/backends/utils.py", line 103, in execute
    return super().execute(sql, params)
  File "/usr/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 357, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: api_tokenbucket
[pid: 150|app: 0|req: 9/9] 192.168.0.18 () {46 vars in 949 bytes} [Fri Feb 17 02:23:49 2023] POST /accounts/login/ => generated 168774 bytes in 87 msecs (HTTP/1.1 500) 8 headers in 282 bytes (3 switches on core 0)
[uwsgi-daemons] respawning "/usr/bin/python3 ./manage.py sendalerts" (uid: 1000 gid: 1000)
[uwsgi-daemons] respawning "/usr/bin/python3 ./manage.py smtpd --port 2525" (uid: 1000 gid: 1000)
[uwsgi-daemons] respawning "/usr/bin/python3 ./manage.py sendreports --loop" (uid: 1000 gid: 1000)
SystemCheckError: System check identified some issues:

ERRORS:
?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found . See the release notes for details.
SystemCheckError: System check identified some issues:

ERRORS:
?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found . See the release notes for details.
SystemCheckError: System check identified some issues:

ERRORS:
?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found . See the release notes for details.
[uwsgi-daemons] respawning "/usr/bin/python3 ./manage.py sendalerts" (uid: 1000 gid: 1000)
[uwsgi-daemons] respawning "/usr/bin/python3 ./manage.py smtpd --port 2525" (uid: 1000 gid: 1000)
[uwsgi-daemons] respawning "/usr/bin/python3 ./manage.py sendreports --loop" (uid: 1000 gid: 1000)
SystemCheckError: System check identified some issues:

ERRORS:
?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found . See the release notes for details.
SystemCheckError: System check identified some issues:

ERRORS:
?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found . See the release notes for details.
SystemCheckError: System check identified some issues:

ERRORS:
?: (4_0.E001) As of Django 4.0, the values in the CSRF_TRUSTED_ORIGINS setting must start with a scheme (usually http:// or https://) but found . See the release notes for details.
[uwsgi-daemons] throttling "/usr/bin/python3 ./manage.py sendalerts" for 65 seconds
[uwsgi-daemons] throttling "/usr/bin/python3 ./manage.py smtpd --port 2525" for 65 seconds
[uwsgi-daemons] throttling "/usr/bin/python3 ./manage.py sendreports --loop" for 65 seconds
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

cuu508 commented 1 year ago

If the SITE_ROOT environment variable is empty then management commands (including manage.py migrate) crash with the error message about the CSRF_TRUSTED_ORIGINS setting.

It would be nice if

monsieurpouet commented 1 year ago

Hi ! I've a same problem like here :/ I had set a SITE_ROOT environment variable like this: https://mysite.checks.fr:8001

Even so, my log had the same error

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

This issue is locked due to inactivity