diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 01:35:06 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 02:11:48 +0200 |
commit | 1a64deeb894dc95e2645a75771732c6cc53a79ad (patch) | |
tree | 1b9df4838f894577a09b9b260151756272efeb53 /systems/eldiron/websites/performance | |
parent | fa25ffd4583cc362075cd5e1b4130f33306103f0 (diff) | |
download | Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.gz Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.zst Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.zip |
Squash changes containing private information
There were a lot of changes since the previous commit, but a lot of them
contained personnal information about users. All thos changes got
stashed into a single commit (history is kept in a different place) and
private information was moved in a separate private repository
Diffstat (limited to 'systems/eldiron/websites/performance')
-rw-r--r-- | systems/eldiron/websites/performance/default.nix | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/systems/eldiron/websites/performance/default.nix b/systems/eldiron/websites/performance/default.nix new file mode 100644 index 0000000..23f754a --- /dev/null +++ b/systems/eldiron/websites/performance/default.nix | |||
@@ -0,0 +1,93 @@ | |||
1 | { pkgs, lib, config, ... }: | ||
2 | let | ||
3 | env = config.myEnv.tools.status_engine; | ||
4 | package = pkgs.status-engine-interface.override({ config_file = config.secrets.fullPaths."status_engine_ui"; }); | ||
5 | apacheRoot = "${package}/public"; | ||
6 | cfg = config.myServices.websites.tools.performance; | ||
7 | in | ||
8 | { | ||
9 | options.myServices.websites.tools.performance = { | ||
10 | enable = lib.mkEnableOption "Enable performance website"; | ||
11 | }; | ||
12 | |||
13 | config = lib.mkIf cfg.enable { | ||
14 | myServices.dns.zones."immae.eu".subdomains.performance = | ||
15 | with config.myServices.dns.helpers; ips servers.eldiron.ips.main; | ||
16 | |||
17 | secrets.keys = { | ||
18 | status_engine_ui = { | ||
19 | permissions = "0400"; | ||
20 | user = "wwwrun"; | ||
21 | group = "wwwrun"; | ||
22 | text = '' | ||
23 | allow_anonymous: 0 | ||
24 | anonymous_can_submit_commands: 0 | ||
25 | urls_without_login: | ||
26 | - login | ||
27 | - loginstate | ||
28 | auth_type: ldap | ||
29 | ldap_server: ${env.ldap.host} | ||
30 | ldap_use_ssl: 1 | ||
31 | ldap_port: 636 | ||
32 | ldap_bind_dn: ${env.ldap.dn} | ||
33 | ldap_bind_password: ${env.ldap.password} | ||
34 | ldap_base_dn: ${env.ldap.base} | ||
35 | ldap_filter: "${env.ldap.filter}" | ||
36 | ldap_attribute: | ||
37 | - memberOf | ||
38 | use_crate: 0 | ||
39 | use_mysql: 1 | ||
40 | mysql: | ||
41 | host: 127.0.0.1 | ||
42 | port: ${builtins.toString env.mysql.port} | ||
43 | username: ${env.mysql.user} | ||
44 | password: ${env.mysql.password} | ||
45 | database: ${env.mysql.database} | ||
46 | display_perfdata: 1 | ||
47 | perfdata_backend: mysql | ||
48 | ''; | ||
49 | }; | ||
50 | }; | ||
51 | |||
52 | services.websites.env.tools.modules = [ "proxy_fcgi" ]; | ||
53 | |||
54 | security.acme.certs.eldiron.extraDomainNames = [ "performance.immae.eu" ]; | ||
55 | services.websites.env.tools.vhostConfs.performance = { | ||
56 | certName = "eldiron"; | ||
57 | hosts = [ "performance.immae.eu" ]; | ||
58 | root = apacheRoot; | ||
59 | extraConfig = [ | ||
60 | '' | ||
61 | <Directory ${apacheRoot}> | ||
62 | DirectoryIndex index.html | ||
63 | AllowOverride None | ||
64 | Require all granted | ||
65 | <FilesMatch "\.php$"> | ||
66 | SetHandler "proxy:unix:${config.services.phpfpm.pools.status_engine.socket}|fcgi://localhost" | ||
67 | </FilesMatch> | ||
68 | </Directory> | ||
69 | '' | ||
70 | ]; | ||
71 | }; | ||
72 | |||
73 | services.phpfpm.pools.status_engine = { | ||
74 | user = "wwwrun"; | ||
75 | group = "wwwrun"; | ||
76 | settings = { | ||
77 | "listen.owner" = "wwwrun"; | ||
78 | "listen.group" = "wwwrun"; | ||
79 | "pm" = "dynamic"; | ||
80 | "pm.max_children" = "60"; | ||
81 | "pm.start_servers" = "2"; | ||
82 | "pm.min_spare_servers" = "1"; | ||
83 | "pm.max_spare_servers" = "10"; | ||
84 | |||
85 | "php_admin_value[session.save_handler]" = "redis"; | ||
86 | "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=Tools:StatusEngine:'"; | ||
87 | "php_admin_value[open_basedir]" = "${package}:/tmp:${config.secrets.fullPaths."status_engine_ui"}"; | ||
88 | }; | ||
89 | phpPackage = pkgs.php74.withExtensions({ enabled, all }: enabled ++ [ all.redis ]); | ||
90 | }; | ||
91 | |||
92 | }; | ||
93 | } | ||