From e07bdf207016434dc8876b213b4618e79f66dedc Mon Sep 17 00:00:00 2001 From: Christoph Schmatzler Date: Wed, 24 Dec 2025 14:28:19 +0000 Subject: [PATCH] gitea: add Redis cache for improved performance - Add dedicated Redis instance on port 6380 (64MB, LRU eviction) - Configure general cache with 16h TTL - Configure last_commit cache with 1 year TTL for repos with 100+ commits - Move session storage to Redis for persistence across restarts --- profiles/gitea.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/profiles/gitea.nix b/profiles/gitea.nix index da192c2..3eeb1a3 100644 --- a/profiles/gitea.nix +++ b/profiles/gitea.nix @@ -1,6 +1,16 @@ {lib, ...}: { networking.firewall.allowedTCPPorts = [80 443]; + services.redis.servers.gitea = { + enable = true; + port = 6380; + bind = "127.0.0.1"; + settings = { + maxmemory = "64mb"; + maxmemory-policy = "allkeys-lru"; + }; + }; + services.gitea = { enable = true; database = { @@ -13,15 +23,26 @@ DOMAIN = "git.schmatzler.com"; HTTP_ADDR = "127.0.0.1"; HTTP_PORT = 3000; + LANDING_PAGE = "explore"; }; service.DISABLE_REGISTRATION = true; security.INSTALL_LOCK = true; + cache = { + ADAPTER = "redis"; + HOST = "redis://127.0.0.1:6380/0?pool_size=100&idle_timeout=180s"; + ITEM_TTL = "16h"; + }; + "cache.last_commit" = { + ITEM_TTL = "8760h"; + COMMITS_COUNT = 100; + }; session = { + PROVIDER = "redis"; + PROVIDER_CONFIG = "redis://127.0.0.1:6380/1?pool_size=100&idle_timeout=180s"; COOKIE_SECURE = true; SAME_SITE = "strict"; }; api.ENABLE_SWAGGER = false; - server.LANDING_PAGE = "explore"; }; };