]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/isabelle/aten_integration.nix
Remove overlay that overrides the php version
[perso/Immae/Config/Nix.git] / modules / private / websites / isabelle / aten_integration.nix
1 { lib, pkgs, config, ... }:
2 let
3 secrets = config.myEnv.websites.isabelle.aten_integration;
4 app = pkgs.callPackage ./aten_app {
5 composerEnv = pkgs.composerEnv.override { php = pkgs.php72; };
6 environment = secrets.environment;
7 varDir = "/var/lib/isabelle_aten_integration";
8 };
9 cfg = config.myServices.websites.isabelle.aten_integration;
10 pcfg = config.services.phpApplication;
11 in {
12 options.myServices.websites.isabelle.aten_integration.enable = lib.mkEnableOption "enable Aten's website in integration";
13
14 config = lib.mkIf cfg.enable {
15 services.duplyBackup.profiles.isabelle_aten_integration.rootDir = app.varDir;
16 services.phpApplication.apps.isabelle_aten_integration = {
17 websiteEnv = "integration";
18 httpdUser = config.services.httpd.Inte.user;
19 httpdGroup = config.services.httpd.Inte.group;
20 httpdWatchFiles = [
21 config.secrets.fullPaths."websites/isabelle/aten_integration"
22 ];
23 inherit (app) webRoot varDir;
24 inherit app;
25 serviceDeps = [ "postgresql.service" ];
26 preStartActions = [
27 "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup"
28 ];
29 phpOpenbasedir = [ "/tmp" ];
30 phpPool = {
31 "php_admin_value[upload_max_filesize]" = "20M";
32 "php_admin_value[post_max_size]" = "20M";
33 #"php_admin_flag[log_errors]" = "on";
34 "pm" = "ondemand";
35 "pm.max_children" = "5";
36 "pm.process_idle_timeout" = "60";
37 };
38 phpEnv = {
39 SYMFONY_DEBUG_MODE = "\"yes\"";
40 };
41 phpPackage = pkgs.php72;
42 };
43
44 secrets.keys = [{
45 dest = "websites/isabelle/aten_integration";
46 user = config.services.httpd.Inte.user;
47 group = config.services.httpd.Inte.group;
48 permissions = "0400";
49 text = let
50 # cf:
51 # https://secure.php.net/manual/fr/function.parse-url.php
52 # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery
53 psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}";
54 in ''
55 SetEnv APP_ENV "${app.environment}"
56 SetEnv APP_SECRET "${secrets.secret}"
57 SetEnv DATABASE_URL "${psql_url}"
58 '';
59 }];
60 services.websites.env.integration.vhostConfs.isabelle_aten_integration = {
61 certName = "integration";
62 addToCerts = true;
63 hosts = [ "dev.aten.pro" ];
64 root = pcfg.webappDirs.isabelle_aten_integration;
65 extraConfig = [
66 ''
67 <FilesMatch "\.php$">
68 SetHandler "proxy:unix:${pcfg.phpListenPaths.isabelle_aten_integration}|fcgi://localhost"
69 </FilesMatch>
70
71 Include ${config.secrets.fullPaths."websites/isabelle/aten_integration"}
72
73 <Location />
74 Use LDAPConnect
75 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
76 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
77 </Location>
78
79 <Location /backend>
80 Use LDAPConnect
81 Require ldap-group cn=dev.aten.pro,cn=httpd,ou=services,dc=immae,dc=eu
82 ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://aten.pro\"></html>"
83 </Location>
84
85 <Directory ${pcfg.webappDirs.isabelle_aten_integration}>
86 Options Indexes FollowSymLinks MultiViews Includes
87 AllowOverride All
88 Require all granted
89 DirectoryIndex index.php
90 FallbackResource /index.php
91 </Directory>
92 ''
93 ];
94 };
95 };
96 }