From d578d27021abba83de60143611230c692da46521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 29 Jan 2019 08:33:53 +0100 Subject: Add Jerome's ftp website Related issue: https://git.immae.eu/mantisbt/view.php?id=77 --- nixops/modules/websites/ftp/jerome.nix | 96 ++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 nixops/modules/websites/ftp/jerome.nix (limited to 'nixops/modules/websites/ftp/jerome.nix') diff --git a/nixops/modules/websites/ftp/jerome.nix b/nixops/modules/websites/ftp/jerome.nix new file mode 100644 index 0000000..199bfab --- /dev/null +++ b/nixops/modules/websites/ftp/jerome.nix @@ -0,0 +1,96 @@ +{ lib, pkgs, config, myconfig, mylibs, ... }: +let + adminer = pkgs.callPackage ../commons/adminer.nix {}; + cfg = config.services.myWebsites.Jerome; + varDir = "/var/lib/ftp/jerome"; + env = myconfig.env.websites.jerome; +in { + options.services.myWebsites.Jerome = { + production = { + enable = lib.mkEnableOption "enable Jerome's website"; + }; + }; + + imports = [ + ../commons/stats.nix + ]; + + config = lib.mkIf cfg.production.enable { + services.myWebsites.commons.stats.enable = true; + services.myWebsites.commons.stats.sites = [ + { + name = "naturaloutil.immae.eu"; + conf = ./jerome_goaccess.conf; + } + ]; + + security.acme.certs."ftp".extraDomains."naturaloutil.immae.eu" = null; + security.acme.certs."naturaloutil" = config.services.myCertificates.certConfig // { + domain = "naturaloutil.immae.eu"; + }; + + services.myPhpfpm.poolConfigs.jerome = let + configFile = pkgs.writeText "naturaloutil.inc.php" '' + ssl_set(NULL, NULL, "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt", NULL, NULL); + '' else ""} + $database = connect_db($db, $mysql_server, $mysql_base, $mysql_user, $mysql_password); + ?> + ''; + in '' + listen = /run/phpfpm/naturaloutil.sock + user = wwwrun + group = wwwrun + listen.owner = wwwrun + listen.group = wwwrun + + pm = ondemand + pm.max_children = 5 + pm.process_idle_timeout = 60 + + env[BDD_CONNECT] = "${configFile}" + php_admin_value[open_basedir] = "${configFile}:${varDir}:/tmp" + ''; + services.myPhpfpm.poolPhpConfigs.jerome = '' + extension=${pkgs.php}/lib/php/extensions/mysqli.so + ''; + services.myWebsites.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ]; + services.myWebsites.production.vhostConfs.naturaloutil = { + certName = "naturaloutil"; + hosts = ["naturaloutil.immae.eu" ]; + root = varDir; + extraConfig = [ + adminer.apache.vhostConf + '' + Use Stats naturaloutil.immae.eu + ServerAdmin ${env.server_admin} + ErrorLog "${varDir}/logs/error_log" + CustomLog "${varDir}/logs/access_log" combined + + + SetHandler "proxy:unix:/run/phpfpm/naturaloutil.sock|fcgi://localhost" + + + + AllowOverride None + Require all denied + + + DirectoryIndex index.php index.htm index.html + Options Indexes FollowSymLinks MultiViews Includes + AllowOverride None + Require all granted + + '' + ]; + }; + }; +} -- cgit v1.2.3