From 73bf52dbaf04e09e6082cf0b2f002fd852f38048 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Sat, 2 May 2026 16:44:20 +0200 Subject: [PATCH] sgx/firefly: bump fastcgi_read_timeout + PHP max_execution_time on both vhosts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bulk imports of 100+ transactions per chunk hit the default 60s fastcgi timeout on the main Firefly III vhost too — not just the importer endpoint. The importer's per-transaction API call to Firefly's /api/v1/transactions can take 20+s on a fresh DB without ANALYZE, which compounds with the 30s PHP max_execution_time cap. - nginx fastcgi_read_timeout=600s on both `firefly` and `firefly-import` vhosts - php_admin_value[max_execution_time]=600 + memory_limit=512M on both PHP-FPM pools - VANITY_URL on the importer now points to the main Firefly III URL (was wrongly pointing at the importer's own domain, breaking clickable transaction-show links in importer log messages) Co-Authored-By: Claude Opus 4.7 (1M context) --- systems/x86_64-linux/sgx/firefly.nix | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/systems/x86_64-linux/sgx/firefly.nix b/systems/x86_64-linux/sgx/firefly.nix index cef398a..94ad43b 100644 --- a/systems/x86_64-linux/sgx/firefly.nix +++ b/systems/x86_64-linux/sgx/firefly.nix @@ -172,7 +172,7 @@ in virtualHost = importDomain; settings = { FIREFLY_III_URL = "https://${domain}"; - VANITY_URL = "https://${importDomain}"; + VANITY_URL = "https://${domain}"; TZ = "Europe/Berlin"; CAN_POST_FILES = "true"; CAN_POST_AUTOIMPORT = "true"; @@ -183,10 +183,16 @@ in }; nginx.virtualHosts = { - ${domain} = vhostBase; - # Importer's autoupload endpoint blocks until the entire batch - # finishes — POSTing 100+ transactions takes minutes. Default 60s - # fastcgi timeout makes nginx 504 even though PHP-FPM keeps going. + # Both Firefly III and the importer can take minutes per request + # during bulk imports — importer's autoupload endpoint blocks until + # the whole batch finishes; main Firefly's API serves long + # individual transaction-create calls. Default 60s fastcgi timeout + # produces 504s while PHP-FPM keeps processing. + ${domain} = vhostBase // { + extraConfig = '' + fastcgi_read_timeout 600s; + ''; + }; ${importDomain} = vhostBase // { extraConfig = '' fastcgi_read_timeout 600s; @@ -195,11 +201,16 @@ in }; # PHP's stock max_execution_time = 30s aborts large bulk imports - # mid-stream. Match the nginx fastcgi_read_timeout above. + # mid-stream. Match the nginx fastcgi_read_timeout above on both + # the importer pool and the main Firefly pool. phpfpm.pools.firefly-iii-data-importer.settings = { "php_admin_value[max_execution_time]" = "600"; "php_admin_value[memory_limit]" = "512M"; }; + phpfpm.pools.firefly-iii.settings = { + "php_admin_value[max_execution_time]" = "600"; + "php_admin_value[memory_limit]" = "512M"; + }; }; }