X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fwebsites%2Faten%2Fintegration.nix;h=7e12b389caa945a93b936ac4319d007a81e6756d;hb=ab8f306d7c2c49b8116e1af7b355ed2384617ed9;hp=0dbc4fa91495aedb835b05caec2eb09b287e3ed7;hpb=29f8cb850d74b456d6481a456311bbf5361d328c;p=perso%2FImmae%2FConfig%2FNix.git
diff --git a/modules/private/websites/aten/integration.nix b/modules/private/websites/aten/integration.nix
index 0dbc4fa..7e12b38 100644
--- a/modules/private/websites/aten/integration.nix
+++ b/modules/private/websites/aten/integration.nix
@@ -1,43 +1,89 @@
-{ lib, pkgs, config, myconfig, ... }:
+{ lib, pkgs, config, ... }:
let
- aten = pkgs.callPackage ./builder.nix {
- inherit (pkgs.webapps) aten;
- config = myconfig.env.websites.aten.integration;
- apacheUser = config.services.httpd.Inte.user;
- apacheGroup = config.services.httpd.Inte.group;
- };
-
+ secrets = config.myEnv.websites.aten.integration;
+ app = pkgs.webapps.aten.override { environment = secrets.environment; };
cfg = config.myServices.websites.aten.integration;
+ pcfg = config.services.phpApplication;
in {
options.myServices.websites.aten.integration.enable = lib.mkEnableOption "enable Aten's website in integration";
config = lib.mkIf cfg.enable {
- services.phpApplication.aten_dev = let
- app = pkgs.webapps.aten.override { environment = "dev"; };
- in {
+ services.duplyBackup.profiles.aten_dev.rootDir = app.varDir;
+ services.phpApplication.apps.aten_dev = {
websiteEnv = "integration";
httpdUser = config.services.httpd.Inte.user;
httpdGroup = config.services.httpd.Inte.group;
+ httpdWatchFiles = [
+ config.secrets.fullPaths."webapps/${app.environment}-aten"
+ ];
inherit (app) webRoot varDir;
inherit app;
serviceDeps = [ "postgresql.service" ];
preStartActions = [
"APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup"
];
- watchFiles = [
- "${config.secrets.location}/webapps/${app.environment}-aten"
- ];
- webappName = "aten_dev";
+ phpOpenbasedir = [ "/tmp" ];
+ phpPool = ''
+ php_admin_value[upload_max_filesize] = 20M
+ php_admin_value[post_max_size] = 20M
+ ;php_admin_flag[log_errors] = on
+ pm = ondemand
+ pm.max_children = 5
+ pm.process_idle_timeout = 60
+ env[SYMFONY_DEBUG_MODE] = "yes"
+ '';
};
- secrets.keys = aten.keys;
- services.phpfpm.poolConfigs.aten_dev = aten.phpFpm.pool;
- services.websites.env.integration.vhostConfs.aten = {
+ secrets.keys = [{
+ dest = "webapps/${app.environment}-aten";
+ user = config.services.httpd.Inte.user;
+ group = config.services.httpd.Inte.group;
+ permissions = "0400";
+ text = let
+ # cf:
+ # https://secure.php.net/manual/fr/function.parse-url.php
+ # 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_SECRET "${secrets.secret}"
+ SetEnv DATABASE_URL "${psql_url}"
+ '';
+ }];
+ services.websites.env.integration.vhostConfs.aten_dev = {
certName = "eldiron";
addToCerts = true;
hosts = [ "dev.aten.pro" ];
- root = aten.apache.root;
- extraConfig = [ aten.apache.vhostConf ];
+ root = pcfg.webappDirs.aten_dev;
+ extraConfig = [
+ ''
+
+ SetHandler "proxy:unix:${pcfg.phpListenPaths.aten_dev}|fcgi://localhost"
+
+
+ Include ${config.secrets.fullPaths."webapps/${app.environment}-aten"}
+
+
+ Use LDAPConnect
+ Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
+ ErrorDocument 401 ""
+
+
+
+ Use LDAPConnect
+ Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
+ ErrorDocument 401 ""
+
+
+
+ Options Indexes FollowSymLinks MultiViews Includes
+ AllowOverride All
+ Require all granted
+ DirectoryIndex index.php
+ FallbackResource /index.php
+
+ ''
+ ];
};
};
}