]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/isabelle/aten_integration.nix
Add config for CI
[perso/Immae/Config/Nix.git] / modules / private / websites / isabelle / aten_integration.nix
index fb6eda977c7a2b881cace05b1084f646dd24efbf..c55ef929b202683fc7a660632ba2f6191e3024d8 100644 (file)
@@ -1,26 +1,26 @@
 { lib, pkgs, config,  ... }:
 let
   secrets = config.myEnv.websites.isabelle.aten_integration;
-  app = pkgs.webapps.aten.override { environment = secrets.environment; };
+  webRoot = "/var/lib/ftp/immae/aten/public";
   cfg = config.myServices.websites.isabelle.aten_integration;
   pcfg = config.services.phpApplication;
 in {
   options.myServices.websites.isabelle.aten_integration.enable = lib.mkEnableOption "enable Aten's website in integration";
 
   config = lib.mkIf cfg.enable {
-    services.duplyBackup.profiles.aten_dev.rootDir = app.varDir;
-    services.phpApplication.apps.aten_dev = {
+    services.phpApplication.apps.isabelle_aten_integration = {
       websiteEnv = "integration";
       httpdUser = config.services.httpd.Inte.user;
       httpdGroup = config.services.httpd.Inte.group;
       httpdWatchFiles = [
-        config.secrets.fullPaths."webapps/${app.environment}-aten"
+        config.secrets.fullPaths."websites/isabelle/aten_integration"
       ];
-      inherit (app) webRoot varDir;
-      inherit app;
+      inherit webRoot;
+      varDir = "/var/lib/ftp/immae/aten_var";
+      app = "/var/lib/ftp/immae/aten";
       serviceDeps = [ "postgresql.service" ];
       preStartActions = [
-        "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup"
+        "APP_ENV=dev ./bin/console --env=dev cache:clear --no-warmup"
       ];
       phpOpenbasedir = [ "/tmp" ];
       phpPool = {
@@ -32,12 +32,12 @@ in {
         "pm.process_idle_timeout" = "60";
       };
       phpEnv = {
-        SYMFONY_DEBUG_MODE = "yes";
+        SYMFONY_DEBUG_MODE = "\"yes\"";
       };
+      phpPackage = pkgs.php72;
     };
 
-    secrets.keys = [{
-      dest = "webapps/${app.environment}-aten";
+    secrets.keys."websites/isabelle/aten_integration" = {
       user = config.services.httpd.Inte.user;
       group = config.services.httpd.Inte.group;
       permissions = "0400";
@@ -47,37 +47,37 @@ in {
         #   vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery
         psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}";
       in ''
-        SetEnv APP_ENV      "${app.environment}"
+        SetEnv APP_ENV      "dev"
         SetEnv APP_SECRET   "${secrets.secret}"
         SetEnv DATABASE_URL "${psql_url}"
         '';
-    }];
-    services.websites.env.integration.vhostConfs.aten_dev = {
+    };
+    services.websites.env.integration.vhostConfs.isabelle_aten_integration = {
       certName    = "integration";
       addToCerts  = true;
-      hosts       = [ "dev.aten.pro" ];
-      root        = pcfg.webappDirs.aten_dev;
+      hosts       = [ "aten.ic.immae.dev" ];
+      root        = webRoot;
       extraConfig = [
         ''
         <FilesMatch "\.php$">
-          SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_dev}|fcgi://localhost"
+          SetHandler "proxy:unix:${pcfg.phpListenPaths.isabelle_aten_integration}|fcgi://localhost"
         </FilesMatch>
 
-        Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"}
+        Include ${config.secrets.fullPaths."websites/isabelle/aten_integration"}
 
         <Location />
           Use LDAPConnect
-          Require ldap-group   cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
+          Require ldap-group   cn=ic.immae.dev,cn=httpd,ou=services,dc=immae,dc=eu
           ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
         </Location>
 
         <Location /backend>
           Use LDAPConnect
-          Require ldap-group   cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
+          Require ldap-group   cn=ic.immae.dev,cn=httpd,ou=services,dc=immae,dc=eu
           ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
         </Location>
 
-        <Directory ${pcfg.webappDirs.aten_dev}>
+        <Directory ${webRoot}>
           Options Indexes FollowSymLinks MultiViews Includes
           AllowOverride All
           Require all granted