diff options
Diffstat (limited to 'modules/private/websites/isabelle/aten_production.nix')
-rw-r--r-- | modules/private/websites/isabelle/aten_production.nix | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/modules/private/websites/isabelle/aten_production.nix b/modules/private/websites/isabelle/aten_production.nix deleted file mode 100644 index 928a815..0000000 --- a/modules/private/websites/isabelle/aten_production.nix +++ /dev/null | |||
@@ -1,90 +0,0 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | secrets = config.myEnv.websites.isabelle.aten_production; | ||
4 | app = pkgs.callPackage ./aten_app { | ||
5 | composerEnv = pkgs.composerEnv.override { php = pkgs.php72; }; | ||
6 | environment = secrets.environment; | ||
7 | varDir = "/var/lib/isabelle_aten_production"; | ||
8 | }; | ||
9 | cfg = config.myServices.websites.isabelle.aten_production; | ||
10 | pcfg = config.services.phpApplication; | ||
11 | in { | ||
12 | options.myServices.websites.isabelle.aten_production.enable = lib.mkEnableOption "enable Aten's website in production"; | ||
13 | |||
14 | config = lib.mkIf cfg.enable { | ||
15 | services.webstats.sites = [ { name = "aten.pro"; } ]; | ||
16 | services.phpApplication.apps.isabelle_aten_production = { | ||
17 | websiteEnv = "production"; | ||
18 | httpdUser = config.services.httpd.Prod.user; | ||
19 | httpdGroup = config.services.httpd.Prod.group; | ||
20 | httpdWatchFiles = [ | ||
21 | config.secrets.fullPaths."websites/isabelle/aten_production" | ||
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" = "dynamic"; | ||
35 | "pm.max_children" = "20"; | ||
36 | "pm.start_servers" = "2"; | ||
37 | "pm.min_spare_servers" = "1"; | ||
38 | "pm.max_spare_servers" = "3"; | ||
39 | }; | ||
40 | phpPackage = pkgs.php72; | ||
41 | }; | ||
42 | |||
43 | secrets.keys."websites/isabelle/aten_production" = { | ||
44 | user = config.services.httpd.Prod.user; | ||
45 | group = config.services.httpd.Prod.group; | ||
46 | permissions = "0400"; | ||
47 | text = let | ||
48 | # cf: | ||
49 | # https://secure.php.net/manual/fr/function.parse-url.php | ||
50 | # vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery | ||
51 | psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}"; | ||
52 | in '' | ||
53 | SetEnv APP_ENV "${app.environment}" | ||
54 | SetEnv APP_SECRET "${secrets.secret}" | ||
55 | SetEnv DATABASE_URL "${psql_url}" | ||
56 | ''; | ||
57 | }; | ||
58 | services.websites.env.production.vhostConfs.isabelle_aten_production = { | ||
59 | certName = "isabelle"; | ||
60 | certMainHost = "aten.pro"; | ||
61 | hosts = [ "aten.pro" "www.aten.pro" ]; | ||
62 | root = app.webRoot; | ||
63 | extraConfig = [ | ||
64 | '' | ||
65 | <FilesMatch "\.php$"> | ||
66 | SetHandler "proxy:unix:${pcfg.phpListenPaths.isabelle_aten_production}|fcgi://localhost" | ||
67 | </FilesMatch> | ||
68 | |||
69 | Include ${config.secrets.fullPaths."websites/isabelle/aten_production"} | ||
70 | |||
71 | Use Stats aten.pro | ||
72 | |||
73 | <Location /backend> | ||
74 | Use LDAPConnect | ||
75 | Require ldap-group cn=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 | <Directory ${app.webRoot}> | ||
80 | Options Indexes FollowSymLinks MultiViews Includes | ||
81 | AllowOverride All | ||
82 | Require all granted | ||
83 | DirectoryIndex index.php | ||
84 | FallbackResource /index.php | ||
85 | </Directory> | ||
86 | '' | ||
87 | ]; | ||
88 | }; | ||
89 | }; | ||
90 | } | ||