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