From 3121b57181586219507da22d99acbbf865ddfdca Mon Sep 17 00:00:00 2001 From: eyjhb Date: Fri, 6 Dec 2024 18:43:05 +0100 Subject: [PATCH] wger: ACTUALLY enable Redis --- machines/gerd/services/wger/default.nix | 16 +++++++++------- machines/gerd/services/wger/wgerpkg/default.nix | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/machines/gerd/services/wger/default.nix b/machines/gerd/services/wger/default.nix index a7824a3..6a0e72f 100644 --- a/machines/gerd/services/wger/default.nix +++ b/machines/gerd/services/wger/default.nix @@ -13,8 +13,8 @@ let ALLOW_REGISTRATION = true; ALLOW_GUEST_USERS = true; ALLOW_UPLOAD_VIDEOS = false; - MIN_ACCOUNT_AGE_TO_TRUST = 21; - EXERCISE_CACHE_TTL = 3600; + MIN_ACCOUNT_AGE_TO_TRUST = 1; + EXERCISE_CACHE_TTL = 3600; # 1 hour }; django_settings = rec { @@ -54,10 +54,12 @@ let EMAIL_PAGE_DOMAIN = SITE_URL; # Cache - Redis - DJANGO_CACHE_BACKEND = "django_redis.cache.RedisCache"; - DJANGO_CACHE_LOCATION = "${config.services.redis.servers.wger.unixSocket}"; - DJANGO_CACHE_TIMEOUT = 1296000; # in seconds - 60*60*24*15, 15 Days - DJANGO_CACHE_CLIENT_CLASS = "django_redis.client.DefaultClient"; + CACHES.default = { + BACKEND = "django_redis.cache.RedisCache"; + LOCATION = "unix://${config.services.redis.servers.wger.unixSocket}"; + TIMEOUT = 15 * 24 * 60 * 60; # 15 days + OPTIONS.CLIENT_CLASS = "django_redis.client.DefaultClient"; + }; # setup allowed hosts CSRF_TRUSTED_ORIGINS = [ "https://${svc_domain}" ]; @@ -172,7 +174,7 @@ in { services.redis.servers.wger = { enable = true; user = wger_user; - appendOnly = true; + # appendOnly = true; }; # setup users diff --git a/machines/gerd/services/wger/wgerpkg/default.nix b/machines/gerd/services/wger/wgerpkg/default.nix index 1f80708..d774d1e 100644 --- a/machines/gerd/services/wger/wgerpkg/default.nix +++ b/machines/gerd/services/wger/wgerpkg/default.nix @@ -72,6 +72,8 @@ in python3.pkgs.buildPythonPackage rec { tzdata # extra?? + redis + django-redis drf-spectacular-sidecar (python3.pkgs.callPackage ./django-bootstrap-breadcrumbs.nix {}) psycopg2