From d4ed0eff6a46d0b1596cf4c68ba7f6abf807bd50 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sun, 7 Apr 2019 20:40:05 +0200 Subject: [PATCH] Add kanboard tool Fixes https://git.immae.eu/mantisbt/view.php?id=127 --- .../modules/websites/tools/tools/default.nix | 11 ++- .../websites/tools/tools/kanboard.json | 15 ++++ .../modules/websites/tools/tools/kanboard.nix | 86 +++++++++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 nixops/modules/websites/tools/tools/kanboard.json create mode 100644 nixops/modules/websites/tools/tools/kanboard.nix diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix index 3b49077..076d465 100644 --- a/nixops/modules/websites/tools/tools/default.nix +++ b/nixops/modules/websites/tools/tools/default.nix @@ -9,6 +9,10 @@ let env = myconfig.env.tools.ttrss; }; roundcubemail = pkgs.callPackage ./roundcubemail.nix { env = myconfig.env.tools.roundcubemail; }; + kanboard = pkgs.callPackage ./kanboard.nix { + inherit (mylibs) fetchedGithub; + env = myconfig.env.tools.kanboard; + }; wallabag = pkgs.callPackage ./wallabag.nix { env = myconfig.env.tools.wallabag; }; yourls = pkgs.callPackage ./yourls.nix { inherit (mylibs) fetchedGithub; @@ -48,7 +52,8 @@ in { ++ rompr.apache.modules ++ shaarli.apache.modules ++ dokuwiki.apache.modules - ++ ldap.apache.modules; + ++ ldap.apache.modules + ++ kanboard.apache.modules; services.ympd = ympd.config // { enable = true; }; @@ -77,6 +82,7 @@ in { shaarli.apache.vhostConf dokuwiki.apache.vhostConf ldap.apache.vhostConf + kanboard.apache.vhostConf ]; }; @@ -116,6 +122,7 @@ in { shaarli = shaarli.phpFpm.pool; dokuwiki = dokuwiki.phpFpm.pool; ldap = ldap.phpFpm.pool; + kanboard = kanboard.phpFpm.pool; tools = '' listen = /var/run/phpfpm/tools.sock user = wwwrun @@ -142,6 +149,7 @@ in { rompr = rompr.activationScript; shaarli = shaarli.activationScript; dokuwiki = dokuwiki.activationScript; + kanboard = kanboard.activationScript; }; system.extraSystemBuilderCmds = '' @@ -154,6 +162,7 @@ in { ln -s ${ttrss.webRoot} $out/webapps/${ttrss.apache.webappName} ln -s ${wallabag.webRoot} $out/webapps/${wallabag.apache.webappName} ln -s ${yourls.webRoot} $out/webapps/${yourls.apache.webappName} + ln -s ${kanboard.webRoot} $out/webapps/${kanboard.apache.webappName} ''; nixpkgs.overlays = [ (self: super: rec { diff --git a/nixops/modules/websites/tools/tools/kanboard.json b/nixops/modules/websites/tools/tools/kanboard.json new file mode 100644 index 0000000..5b1d115 --- /dev/null +++ b/nixops/modules/websites/tools/tools/kanboard.json @@ -0,0 +1,15 @@ +{ + "tag": "v1.2.9", + "meta": { + "name": "kanboard", + "url": "https://github.com/kanboard/kanboard/", + "branch": "refs/tags/v1.2.9" + }, + "github": { + "owner": "kanboard", + "repo": "kanboard", + "rev": "c4152316b14936556edf3bcc4d11f16ba31b8ae7", + "sha256": "18bn9zhyfc5x28hwcxss7chdq7c8rshc8jxgai65i5l68iwhvjg7", + "fetchSubmodules": true + } +} diff --git a/nixops/modules/websites/tools/tools/kanboard.nix b/nixops/modules/websites/tools/tools/kanboard.nix new file mode 100644 index 0000000..399d3e1 --- /dev/null +++ b/nixops/modules/websites/tools/tools/kanboard.nix @@ -0,0 +1,86 @@ +{ lib, env, fetchedGithub, writeText, stdenv, fetchurl }: +rec { + varDir = "/var/lib/kanboard"; + activationScript = { + deps = [ "wrappers" ]; + text = '' + install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/data + install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions + install -TDm644 ${webRoot}/dataold/.htaccess ${varDir}/data/.htaccess + install -TDm644 ${webRoot}/dataold/web.config ${varDir}/data/web.config + ''; + }; + config = writeText "config.php" '' + + ''; + webRoot = stdenv.mkDerivation (fetchedGithub ./kanboard.json // rec { + dontBuild = true; + installPhase = '' + cp -a . $out + ln -s ${config} $out/config.php + mv $out/data $out/dataold + ln -s ${varDir}/data $out/data + ''; + }); + apache = rec { + user = "wwwrun"; + group = "wwwrun"; + modules = [ "proxy_fcgi" ]; + webappName = "tools_kanboard"; + root = "/run/current-system/webapps/${webappName}"; + vhostConf = '' + Alias /kanboard "${root}" + + DirectoryIndex index.php + AllowOverride All + Options FollowSymlinks + Require all granted + + + SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" + + + + Require all denied + + ''; + }; + phpFpm = rec { + basedir = builtins.concatStringsSep ":" [ webRoot varDir config ]; + socket = "/var/run/phpfpm/kanboard.sock"; + pool = '' + listen = ${socket} + user = ${apache.user} + group = ${apache.group} + listen.owner = ${apache.user} + listen.group = ${apache.group} + pm = ondemand + pm.max_children = 60 + pm.process_idle_timeout = 60 + + ; Needed to avoid clashes in browser cookies (same domain) + php_value[session.name] = KanboardPHPSESSID + php_admin_value[open_basedir] = "${basedir}:/tmp" + php_admin_value[session.save_path] = "${varDir}/phpSessions" + ''; + }; +} -- 2.41.0