From bfe3c9c9df0c5112bc8806483292b55ed0f7e02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 25 Jan 2019 14:21:34 +0100 Subject: Add rompr Fixes https://git.immae.eu/mantisbt/view.php?id=70 --- .../modules/websites/tools/ether/etherpad_lite.nix | 4 +- virtual/modules/websites/tools/tools/default.nix | 16 +++- virtual/modules/websites/tools/tools/rompr.json | 15 ++++ virtual/modules/websites/tools/tools/rompr.nix | 86 ++++++++++++++++++++++ virtual/modules/websites/tools/tools/ympd.nix | 9 +-- 5 files changed, 119 insertions(+), 11 deletions(-) create mode 100644 virtual/modules/websites/tools/tools/rompr.json create mode 100644 virtual/modules/websites/tools/tools/rompr.nix (limited to 'virtual') diff --git a/virtual/modules/websites/tools/ether/etherpad_lite.nix b/virtual/modules/websites/tools/ether/etherpad_lite.nix index f5f05b7..02071f1 100644 --- a/virtual/modules/websites/tools/ether/etherpad_lite.nix +++ b/virtual/modules/websites/tools/ether/etherpad_lite.nix @@ -1,6 +1,6 @@ { env, fetchedGithub, fetchurl, stdenv, writeText, pkgs, cacert }: let - listenPort = "18001"; + listenPort = env.listenPort; sessionkey = writeText "SESSIONKEY.txt" env.session_key; apikey = writeText "APIKEY.txt" env.api_key; jquery = fetchurl { @@ -41,7 +41,7 @@ let "favicon": "favicon.ico", "ip": "127.0.0.1", - "port" : ${listenPort}, + "port" : ${env.listenPort}, "showSettingsInAdminPage" : false, "dbType" : "postgres", "dbSettings" : { diff --git a/virtual/modules/websites/tools/tools/default.nix b/virtual/modules/websites/tools/tools/default.nix index 7fb4974..333ffb0 100644 --- a/virtual/modules/websites/tools/tools/default.nix +++ b/virtual/modules/websites/tools/tools/default.nix @@ -1,7 +1,9 @@ { lib, pkgs, config, myconfig, mylibs, ... }: let adminer = pkgs.callPackage ../../commons/adminer.nix {}; - ympd = pkgs.callPackage ./ympd.nix {}; + ympd = pkgs.callPackage ./ympd.nix { + env = myconfig.env.tools.ympd; + }; ttrss = pkgs.callPackage ./ttrss.nix { inherit (mylibs) fetchedGithub fetchedGit; env = myconfig.env.tools.ttrss; @@ -12,6 +14,10 @@ let inherit (mylibs) fetchedGithub; env = myconfig.env.tools.yourls; }; + rompr = pkgs.callPackage ./rompr.nix { + inherit (mylibs) fetchedGithub; + env = myconfig.env.tools.rompr; + }; cfg = config.services.myWebsites.tools.tools; in { @@ -28,9 +34,10 @@ in { ++ ttrss.apache.modules ++ roundcubemail.apache.modules ++ wallabag.apache.modules - ++ yourls.apache.modules; + ++ yourls.apache.modules + ++ rompr.apache.modules; - services.ympd = ympd.config // { enable = false; }; + services.ympd = ympd.config // { enable = true; }; services.myWebsites.tools.vhostConfs.tools = { certName = "eldiron"; @@ -43,6 +50,7 @@ in { roundcubemail.apache.vhostConf wallabag.apache.vhostConf yourls.apache.vhostConf + rompr.apache.vhostConf ]; }; @@ -52,6 +60,7 @@ in { roundcubemail = roundcubemail.phpFpm.pool; wallabag = wallabag.phpFpm.pool; yourls = yourls.phpFpm.pool; + rompr = rompr.phpFpm.pool; }; system.activationScripts = { @@ -59,6 +68,7 @@ in { roundcubemail = roundcubemail.activationScript; wallabag = wallabag.activationScript; yourls = yourls.activationScript; + rompr = rompr.activationScript; }; systemd.services.tt-rss = { diff --git a/virtual/modules/websites/tools/tools/rompr.json b/virtual/modules/websites/tools/tools/rompr.json new file mode 100644 index 0000000..778d915 --- /dev/null +++ b/virtual/modules/websites/tools/tools/rompr.json @@ -0,0 +1,15 @@ +{ + "tag": "1.24", + "meta": { + "name": "rompr", + "url": "https://github.com/fatg3erman/RompR", + "branch": "refs/tags/1.24" + }, + "github": { + "owner": "fatg3erman", + "repo": "RompR", + "rev": "0d8f597027ac71b320963fe3f33f461a136312ad", + "sha256": "13p3c4whhmvz1vvh9fva5gdx4xji288k108hjdi8b1yn506lzix2", + "fetchSubmodules": true + } +} diff --git a/virtual/modules/websites/tools/tools/rompr.nix b/virtual/modules/websites/tools/tools/rompr.nix new file mode 100644 index 0000000..055334e --- /dev/null +++ b/virtual/modules/websites/tools/tools/rompr.nix @@ -0,0 +1,86 @@ +{ lib, env, stdenv, fetchedGithub }: +let + rompr = let + in rec { + varDir = "/var/lib/rompr"; + activationScript = '' + install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ + ${varDir}/prefs ${varDir}/albumart ${varDir}/phpSessions + ''; + webRoot = stdenv.mkDerivation (fetchedGithub ./rompr.json // rec { + installPhase = '' + cp -a . $out + ln -sf ../../../../../../${varDir}/prefs $out/prefs + ln -sf ../../../../../../${varDir}/albumart $out/albumart + ''; + }); + apache = { + user = "wwwrun"; + group = "wwwrun"; + modules = [ "headers" "mime" "proxy_fcgi" ]; + vhostConf = '' + Alias /rompr ${webRoot} + + + Options Indexes FollowSymLinks + DirectoryIndex index.php + AllowOverride all + Require all granted + Order allow,deny + Allow from all + ErrorDocument 404 /rompr/404.php + AddType image/x-icon .ico + + + SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" + + + + + Header Set Cache-Control "max-age=0, no-store" + Header Set Cache-Control "no-cache, must-revalidate" + + + + Header Set Cache-Control "max-age=0, no-store" + Header Set Cache-Control "no-cache, must-revalidate" + + + + Use LDAPConnect + Require ldap-group cn=users,cn=mpd,ou=services,dc=immae,dc=eu + Require local + + ''; + }; + phpFpm = rec { + basedir = builtins.concatStringsSep ":" [ webRoot varDir ]; + socket = "/var/run/phpfpm/rompr.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] = RomprPHPSESSID + php_admin_value[open_basedir] = "${basedir}:/tmp" + php_admin_value[session.save_path] = "${varDir}/phpSessions" + php_flag[magic_quotes_gpc] = Off + php_flag[track_vars] = On + php_flag[register_globals] = Off + php_admin_flag[allow_url_fopen] = On + php_value[include_path] = ${webRoot} + php_admin_value[upload_tmp_dir] = "${varDir}/prefs" + php_admin_value[post_max_size] = 32M + php_admin_value[upload_max_filesize] = 32M + php_admin_value[memory_limit] = 256M + ''; + }; + }; +in + rompr diff --git a/virtual/modules/websites/tools/tools/ympd.nix b/virtual/modules/websites/tools/tools/ympd.nix index 74bf2e5..5744360 100644 --- a/virtual/modules/websites/tools/tools/ympd.nix +++ b/virtual/modules/websites/tools/tools/ympd.nix @@ -1,12 +1,9 @@ -{}: +{ env }: let ympd = rec { config = { - webPort = "localhost:18001"; - mpd = { - host = "malige.home.immae.eu"; - port = 6600; - }; + webPort = "localhost:${env.listenPort}"; + mpd = env.mpd; }; apache = { modules = [ -- cgit v1.2.3