]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - nixops/modules/websites/piedsjaloux/piedsjaloux.nix
Move production websites to use stable web directories
[perso/Immae/Config/Nix.git] / nixops / modules / websites / piedsjaloux / piedsjaloux.nix
index 1b53c4a5022e0531ca3cf2591512aa869d2b53c7..4caf48a701ba5dff1de1d46a9f1025c85c368ab4 100644 (file)
@@ -7,14 +7,14 @@ let
       writeText "parameters.yml" ''
         # This file is auto-generated during the composer install
         parameters:
-            database_host: db-1.immae.eu
-            database_port: null
+            database_host: ${config.mysql.host}
+            database_port: ${config.mysql.port}
             database_name: ${config.mysql.name}
             database_user: ${config.mysql.user}
             database_password: ${config.mysql.password}
             database_server_version: ${pkgs.mariadb.mysqlVersion}
             mailer_transport: smtp
-            mailer_host: mail.immae.eu
+            mailer_host: 127.0.0.1
             mailer_user: null
             mailer_password: null
             secret: ${config.secret}
@@ -35,6 +35,7 @@ let
         ;php_admin_flag[log_errors] = on
         php_admin_value[open_basedir] = "${configRoot}:${webappDir}:${varDir}:/tmp"
         php_admin_value[session.save_path] = "${varDir}/phpSessions"
+        env[PATH] = ${lib.makeBinPath [ pkgs.apg pkgs.unzip ]}
         ${if environment == "dev" then ''
         pm = ondemand
         pm.max_children = 5
@@ -48,10 +49,12 @@ let
         pm.max_spare_servers = 3
         ''}'';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "piedsjaloux_${environment}";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
       <FilesMatch "\.php$">
         SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
@@ -64,7 +67,7 @@ let
         ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://piedsjaloux.fr\"></html>"
       </Location>
 
-      <Directory ${webRoot}>
+      <Directory ${root}>
         Options Indexes FollowSymLinks MultiViews Includes
         AllowOverride None
         Require all granted
@@ -107,7 +110,7 @@ let
       '' else ''
       Use Stats piedsjaloux.fr
 
-      <Directory ${webRoot}>
+      <Directory ${root}>
         Options Indexes FollowSymLinks MultiViews Includes
         AllowOverride All
         Require all granted