]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - nixops/modules/websites/chloe/chloe.nix
Move production websites to use stable web directories
[perso/Immae/Config/Nix.git] / nixops / modules / websites / chloe / chloe.nix
index 355cca7cb79fcf67a6771c374e1d5829e49ad88b..80e555479600aaa36b909760a1fc3474c8b783b7 100644 (file)
@@ -23,7 +23,8 @@ let
         env[SPIP_LDAP_SEARCH_DN] = "${config.ldap.dn}"
         env[SPIP_LDAP_SEARCH_PW] = "${config.ldap.password}"
         env[SPIP_LDAP_SEARCH] = "${config.ldap.search}"
-        env[SPIP_MYSQL_HOST] = "db-1.immae.eu"
+        env[SPIP_MYSQL_HOST] = "${config.mysql.host}"
+        env[SPIP_MYSQL_PORT] = "${config.mysql.port}"
         env[SPIP_MYSQL_DB] = "${config.mysql.name}"
         env[SPIP_MYSQL_USER] = "${config.mysql.user}"
         env[SPIP_MYSQL_PASSWORD] = "${config.mysql.password}"
@@ -39,10 +40,12 @@ let
         pm.max_spare_servers = 3
         ''}'';
     };
-    apache = {
+    apache = rec {
       user = "wwwrun";
       group = "wwwrun";
       modules = [ "proxy_fcgi" ];
+      webappName = "chloe_${environment}";
+      root = "/run/current-system/webapps/${webappName}";
       vhostConf = ''
         RewriteEngine On
         ${if environment == "prod" then ''
@@ -53,16 +56,16 @@ let
           SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost"
         </FilesMatch>
 
-        <Directory ${webRoot}>
+        <Directory ${root}>
           DirectoryIndex index.php index.htm index.html
           Options -Indexes +FollowSymLinks +MultiViews +Includes
-          Include ${webRoot}/htaccess.txt
+          Include ${root}/htaccess.txt
 
           AllowOverride AuthConfig FileInfo Limit
           Require all granted
         </Directory>
 
-        <DirectoryMatch "${webRoot}/squelettes">
+        <DirectoryMatch "${root}/squelettes">
           Require all denied
         </DirectoryMatch>