From efa53dc33556dc83ff0d1a436e527cc5cb367759 Mon Sep 17 00:00:00 2001 From: coolneng Date: Sun, 17 Nov 2019 18:58:31 +0100 Subject: [PATCH] Set up Wallabag --- modules/webstack.nix | 48 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/modules/webstack.nix b/modules/webstack.nix index f2d9b5f..d39d68b 100644 --- a/modules/webstack.nix +++ b/modules/webstack.nix @@ -7,7 +7,8 @@ php postgresql_11 libressl - wallabag + gnumake + php73Packages.composer ]; services.nginx = { @@ -65,6 +66,23 @@ locations."/gitea/" = { proxyPass = "http://localhost:3000/"; }; + locations."/wallabag/" = { + root = "/var/lib/wallabag/web"; + tryFiles = "try_files $uri /app.php$is_args$args"; + extraConfig = '' + location ~ ^/app\.php(/|$) { + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + internal; + } + + location ~ \.php$ { + return 404; + } + ''; + }; }; }; }; @@ -83,16 +101,20 @@ params = { nginx.bits = 2048; }; }; - # Enable PostgreSQL with daily backup + # PostgreSQL databases configuration services.postgresql = { enable = true; package = pkgs.postgresql_11; - ensureDatabases = [ "gitea" ]; + ensureDatabases = [ "gitea" "wallabag" ]; ensureUsers = [ { name = "gitea"; ensurePermissions = {"DATABASE gitea" = "ALL PRIVILEGES";}; } + { + name = "wallabag"; + ensurePermissions = {"DATABASE wallabag" = "ALL PRIVILEGES";}; + } ]; authentication = lib.mkForce '' # Generated file; do not edit! @@ -106,6 +128,7 @@ ''; }; + # PostgreSQL daily backups services.postgresqlBackup = { enable = true; backupAll = true; @@ -113,4 +136,23 @@ startAt = "*-*-* 05:15:00"; }; + # PHP-fpm configuration + services.phpfpm = { + pools = { + mypool = { + user = "php"; + group = "php"; + phpPackage = pkgs.php; + settings = { + "pm" = "static"; + "pm.max_children" = 4; + "pm.start_servers" = 2; + "pm.min_spare_servers" = 2; + "pm.max_spare_servers" = 4; + "pm.max_requests" = 500; + }; + }; + }; + }; + }