From f8026b6e4c869aa108f6361c8ccd50890657994d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 18 May 2019 10:49:00 +0200 Subject: Move personal websites to modules --- .../private/websites/naturaloutil/production.nix | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 modules/private/websites/naturaloutil/production.nix (limited to 'modules/private/websites/naturaloutil/production.nix') diff --git a/modules/private/websites/naturaloutil/production.nix b/modules/private/websites/naturaloutil/production.nix new file mode 100644 index 0000000..b6cf069 --- /dev/null +++ b/modules/private/websites/naturaloutil/production.nix @@ -0,0 +1,86 @@ +{ lib, pkgs, config, myconfig, ... }: +let + adminer = pkgs.callPackage ../commons/adminer.nix {}; + cfg = config.myServices.websites.naturaloutil.production; + varDir = "/var/lib/ftp/jerome"; + env = myconfig.env.websites.jerome; +in { + options.myServices.websites.naturaloutil.production.enable = lib.mkEnableOption "enable Naturaloutil's website"; + + config = lib.mkIf cfg.enable { + services.webstats.sites = [ { name = "naturaloutil.immae.eu"; } ]; + + security.acme.certs."ftp".extraDomains."naturaloutil.immae.eu" = null; + + secrets.keys = [{ + dest = "webapps/prod-naturaloutil"; + user = "wwwrun"; + group = "wwwrun"; + permissions = "0400"; + text = '' + 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); + ?> + ''; + }]; + services.myPhpfpm.serviceDependencies.jerome = [ "mysql.service" ]; + services.myPhpfpm.poolConfigs.jerome = '' + 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] = "/var/secrets/webapps/prod-naturaloutil" + php_admin_value[open_basedir] = "/var/secrets/webapps/prod-naturaloutil:${varDir}:/tmp" + ''; + services.myPhpfpm.poolPhpConfigs.jerome = '' + extension=${pkgs.php}/lib/php/extensions/mysqli.so + ''; + services.websites.production.modules = adminer.apache.modules ++ [ "proxy_fcgi" ]; + services.websites.production.vhostConfs.naturaloutil = { + certName = "naturaloutil"; + certMainHost = "naturaloutil.immae.eu"; + 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