Compare commits

...

2 Commits

Author SHA1 Message Date
44f4ba3385 wip
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
2025-05-26 15:27:02 +02:00
9cf2f89bf6 root: switch to channels-postgres
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
2025-04-10 15:35:09 +02:00
4 changed files with 19 additions and 20 deletions

View File

@ -5,7 +5,6 @@ from typing import Any
from billiard.exceptions import SoftTimeLimitExceeded, WorkerLostError from billiard.exceptions import SoftTimeLimitExceeded, WorkerLostError
from celery.exceptions import CeleryError from celery.exceptions import CeleryError
from channels_redis.core import ChannelFull
from django.conf import settings from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation, ValidationError from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation, ValidationError
from django.db import DatabaseError, InternalError, OperationalError, ProgrammingError from django.db import DatabaseError, InternalError, OperationalError, ProgrammingError
@ -127,7 +126,6 @@ def before_send(event: dict, hint: dict) -> dict | None:
RedisError, RedisError,
ResponseError, ResponseError,
# websocket errors # websocket errors
ChannelFull,
WebSocketException, WebSocketException,
LocalProtocolError, LocalProtocolError,
# rest_framework error # rest_framework error

View File

@ -65,6 +65,7 @@ SHARED_APPS = [
"pgactivity", "pgactivity",
"pglock", "pglock",
"channels", "channels",
"channels_postgres",
] ]
TENANT_APPS = [ TENANT_APPS = [
"django.contrib.auth", "django.contrib.auth",
@ -278,16 +279,6 @@ TEMPLATES = [
ASGI_APPLICATION = "authentik.root.asgi.application" ASGI_APPLICATION = "authentik.root.asgi.application"
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.pubsub.RedisPubSubChannelLayer",
"CONFIG": {
"hosts": [CONFIG.get("channel.url") or redis_url(CONFIG.get("redis.db"))],
"prefix": "authentik_channels_",
},
},
}
# Database # Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
@ -300,6 +291,16 @@ DATABASE_ROUTERS = (
"django_tenants.routers.TenantSyncRouter", "django_tenants.routers.TenantSyncRouter",
) )
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_postgres.core.PostgresChannelLayer",
"CONFIG": {
**DATABASES["default"],
"TIME_ZONE": None,
},
},
}
# Email # Email
# These values should never actually be used, emails are only sent from email stages, which # These values should never actually be used, emails are only sent from email stages, which
# loads the config directly from CONFIG # loads the config directly from CONFIG

View File

@ -8,7 +8,7 @@ dependencies = [
"argon2-cffi==23.1.0", "argon2-cffi==23.1.0",
"celery==5.5.2", "celery==5.5.2",
"channels==4.2.2", "channels==4.2.2",
"channels-redis==4.2.1", "channels-postgres==1.1.2",
"cryptography==45.0.3", "cryptography==45.0.3",
"dacite==1.9.2", "dacite==1.9.2",
"deepmerge==2.0", "deepmerge==2.0",

14
uv.lock generated
View File

@ -170,7 +170,7 @@ dependencies = [
{ name = "argon2-cffi" }, { name = "argon2-cffi" },
{ name = "celery" }, { name = "celery" },
{ name = "channels" }, { name = "channels" },
{ name = "channels-redis" }, { name = "channels-postgres" },
{ name = "cryptography" }, { name = "cryptography" },
{ name = "dacite" }, { name = "dacite" },
{ name = "deepmerge" }, { name = "deepmerge" },
@ -268,7 +268,7 @@ requires-dist = [
{ name = "argon2-cffi", specifier = "==23.1.0" }, { name = "argon2-cffi", specifier = "==23.1.0" },
{ name = "celery", specifier = "==5.5.2" }, { name = "celery", specifier = "==5.5.2" },
{ name = "channels", specifier = "==4.2.2" }, { name = "channels", specifier = "==4.2.2" },
{ name = "channels-redis", specifier = "==4.2.1" }, { name = "channels-postgres", specifier = "==1.1.2" },
{ name = "cryptography", specifier = "==45.0.3" }, { name = "cryptography", specifier = "==45.0.3" },
{ name = "dacite", specifier = "==1.9.2" }, { name = "dacite", specifier = "==1.9.2" },
{ name = "deepmerge", specifier = "==2.0" }, { name = "deepmerge", specifier = "==2.0" },
@ -712,18 +712,18 @@ daphne = [
] ]
[[package]] [[package]]
name = "channels-redis" name = "channels-postgres"
version = "4.2.1" version = "1.1.2"
source = { registry = "https://pypi.org/simple" } source = { registry = "https://pypi.org/simple" }
dependencies = [ dependencies = [
{ name = "asgiref" }, { name = "asgiref" },
{ name = "channels" }, { name = "channels" },
{ name = "msgpack" }, { name = "msgpack" },
{ name = "redis" }, { name = "psycopg", extra = ["pool"] },
] ]
sdist = { url = "https://files.pythonhosted.org/packages/c7/6d/c379c9feea4522cbdb4eba9b3d23a6270ba8cbd94e847b21834d898109d6/channels_redis-4.2.1.tar.gz", hash = "sha256:8375e81493e684792efe6e6eca60ef3d7782ef76c6664057d2e5c31e80d636dd", size = 31152, upload-time = "2024-11-15T12:58:49.836Z" } sdist = { url = "https://files.pythonhosted.org/packages/f5/21/c74be89ec2f93fa832f9c5b47f08c73e5e07279aab176a1f7ef4a240722d/channels_postgres-1.1.2.tar.gz", hash = "sha256:bfdf580ba65aab0d5e944d38ddd807d3521939153b786b53d6f932b6f3defd8e", size = 19696, upload-time = "2025-04-20T16:09:01.83Z" }
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/a6/aa/981d08ae9627c3b9d8dd150f0fe644122a351abc1f47bcf53d2bfff80d91/channels_redis-4.2.1-py3-none-any.whl", hash = "sha256:2ca33105b3a04b5a327a9c47dd762b546f30b76a0cd3f3f593a23d91d346b6f4", size = 20487, upload-time = "2024-11-15T12:58:47.847Z" }, { url = "https://files.pythonhosted.org/packages/fd/0b/1ec2c7357ebff7ff457f39d51ccb74be56ac796595dfc228658ba23974a1/channels_postgres-1.1.2-py3-none-any.whl", hash = "sha256:301e1980f23e325e289ac93265baf54ceae289c19f1893d1b55e40fe73149f67", size = 16176, upload-time = "2025-04-20T16:09:00.383Z" },
] ]
[[package]] [[package]]