diff options
Diffstat (limited to 'modules/private/websites/ressourcerie_banon')
3 files changed, 123 insertions, 0 deletions
diff --git a/modules/private/websites/ressourcerie_banon/cloud.nix b/modules/private/websites/ressourcerie_banon/cloud.nix new file mode 100644 index 0000000..5179218 --- /dev/null +++ b/modules/private/websites/ressourcerie_banon/cloud.nix | |||
@@ -0,0 +1,20 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | cfg = config.myServices.websites.ressourcerie_banon.cloud; | ||
4 | nextcloud = config.myServices.tools.cloud.farm.package; | ||
5 | in { | ||
6 | options.myServices.websites.ressourcerie_banon.cloud.enable = lib.mkEnableOption "enable Ressourcerie Banon’s cloud"; | ||
7 | |||
8 | config = lib.mkIf cfg.enable { | ||
9 | myServices.tools.cloud.farm.instances = [ "ressourcerie_banon" ]; | ||
10 | services.websites.env.production.modules = [ "proxy_fcgi" ]; | ||
11 | services.websites.env.production.vhostConfs.ressourcerie_banon_cloud = { | ||
12 | certName = "ressourcerie_banon"; | ||
13 | addToCerts = true; | ||
14 | hosts = ["cloud.le-garage-autonome.org"]; | ||
15 | root = nextcloud; | ||
16 | extraConfig = [ config.myServices.tools.cloud.farm.vhosts.ressourcerie_banon ]; | ||
17 | }; | ||
18 | }; | ||
19 | } | ||
20 | |||
diff --git a/modules/private/websites/ressourcerie_banon/cryptpad.nix b/modules/private/websites/ressourcerie_banon/cryptpad.nix new file mode 100644 index 0000000..961302d --- /dev/null +++ b/modules/private/websites/ressourcerie_banon/cryptpad.nix | |||
@@ -0,0 +1,33 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | cfg = config.myServices.websites.ressourcerie_banon.cryptpad; | ||
4 | configFile = "${pkgs.cryptpad}/lib/node_modules/cryptpad/config/config.example.js"; | ||
5 | in { | ||
6 | options.myServices.websites.ressourcerie_banon.cryptpad.enable = lib.mkEnableOption "Enable Ressourcerie Banon’s cryptpad"; | ||
7 | |||
8 | config = lib.mkIf cfg.enable { | ||
9 | systemd.services.cryptpad-ressourcerie_banon = { | ||
10 | description = "Cryptpad Banon Service"; | ||
11 | wantedBy = [ "multi-user.target" ]; | ||
12 | after = [ "networking.target" ]; | ||
13 | serviceConfig = { | ||
14 | DynamicUser = true; | ||
15 | Environment = [ | ||
16 | "CRYPTPAD_CONFIG=${configFile}" | ||
17 | "HOME=%S/cryptpad/ressourcerie_banon" | ||
18 | ]; | ||
19 | ExecStart = "${pkgs.cryptpad}/bin/cryptpad"; | ||
20 | PrivateTmp = true; | ||
21 | Restart = "always"; | ||
22 | StateDirectory = "cryptpad/ressourcerie_banon"; | ||
23 | WorkingDirectory = "%S/cryptpad/ressourcerie_banon"; | ||
24 | }; | ||
25 | }; | ||
26 | services.websites.env.production.vhostConfs.ressourcerie_banon_cryptpad = { | ||
27 | certName = "ressourcerie_banon"; | ||
28 | addToCerts = true; | ||
29 | hosts = ["pad.le-garage-autonome.org"]; | ||
30 | root = null; | ||
31 | }; | ||
32 | }; | ||
33 | } | ||
diff --git a/modules/private/websites/ressourcerie_banon/production.nix b/modules/private/websites/ressourcerie_banon/production.nix new file mode 100644 index 0000000..fa00d92 --- /dev/null +++ b/modules/private/websites/ressourcerie_banon/production.nix | |||
@@ -0,0 +1,70 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | cfg = config.myServices.websites.ressourcerie_banon.production; | ||
4 | varDir = "/var/lib/ftp/ressourcerie_banon"; | ||
5 | apacheUser = config.services.httpd.Prod.user; | ||
6 | apacheGroup = config.services.httpd.Prod.group; | ||
7 | in { | ||
8 | options.myServices.websites.ressourcerie_banon.production.enable = lib.mkEnableOption "enable Ressourcerie Banon's website"; | ||
9 | |||
10 | config = lib.mkIf cfg.enable { | ||
11 | services.webstats.sites = [ { name = "ressourcerie-banon.org"; } ]; | ||
12 | |||
13 | system.activationScripts.ressourcerie_banon = { | ||
14 | deps = [ "httpd" ]; | ||
15 | text = '' | ||
16 | install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/php/sessions/ressourcerie_banon | ||
17 | ''; | ||
18 | }; | ||
19 | systemd.services.phpfpm-ressourcerie_banon.after = lib.mkAfter [ "mysql.service" ]; | ||
20 | systemd.services.phpfpm-ressourcerie_banon.wants = [ "mysql.service" ]; | ||
21 | services.phpfpm.pools.ressourcerie_banon = { | ||
22 | user = apacheUser; | ||
23 | group = apacheGroup; | ||
24 | settings = { | ||
25 | "listen.owner" = apacheUser; | ||
26 | "listen.group" = apacheGroup; | ||
27 | |||
28 | "pm" = "ondemand"; | ||
29 | "pm.max_children" = "5"; | ||
30 | "pm.process_idle_timeout" = "60"; | ||
31 | |||
32 | "php_admin_value[open_basedir]" = "/var/lib/php/sessions/ressourcerie_banon:${varDir}:/tmp"; | ||
33 | "php_admin_value[session.save_path]" = "/var/lib/php/sessions/ressourcerie_banon"; | ||
34 | }; | ||
35 | phpOptions = config.services.phpfpm.phpOptions + '' | ||
36 | disable_functions = "mail" | ||
37 | ''; | ||
38 | phpPackage = pkgs.php72; | ||
39 | }; | ||
40 | services.websites.env.production.modules = [ "proxy_fcgi" ]; | ||
41 | services.websites.env.production.vhostConfs.ressourcerie_banon = { | ||
42 | certName = "ressourcerie_banon"; | ||
43 | certMainHost = "ressourcerie-banon.org"; | ||
44 | hosts = ["ressourcerie-banon.org" "www.ressourcerie-banon.org" "ressourcerie-sault.org" "www.ressourcerie-sault.org" "le-garage-autonome.org" | ||
45 | "www.le-garage-autonome.org"]; | ||
46 | root = varDir; | ||
47 | extraConfig = [ | ||
48 | '' | ||
49 | Use Stats ressourcerie-banon.org | ||
50 | |||
51 | RewriteEngine on | ||
52 | RewriteCond "%{HTTP_HOST}" "!^ressourcerie-banon\.org$" [NC] | ||
53 | RewriteRule ^(.+)$ https://ressourcerie-banon.org$1 [R=302,L] | ||
54 | |||
55 | <FilesMatch "\.php$"> | ||
56 | SetHandler "proxy:unix:${config.services.phpfpm.pools.ressourcerie_banon.socket}|fcgi://localhost" | ||
57 | </FilesMatch> | ||
58 | |||
59 | <Directory ${varDir}> | ||
60 | DirectoryIndex index.php index.htm index.html | ||
61 | Options Indexes FollowSymLinks MultiViews Includes | ||
62 | AllowOverride all | ||
63 | Require all granted | ||
64 | </Directory> | ||
65 | '' | ||
66 | ]; | ||
67 | }; | ||
68 | }; | ||
69 | } | ||
70 | |||