diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-06-01 00:01:46 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-06-01 00:01:46 +0200 |
commit | 17f6eae9907a122d4472da727ae8b1ac1c40c027 (patch) | |
tree | 133ab8877a47ec707cb8c96e561a29e45395fce6 /modules/private | |
parent | f33aade75160a345a721fd60451b9edaa4d10e44 (diff) | |
download | Nix-17f6eae9907a122d4472da727ae8b1ac1c40c027.tar.gz Nix-17f6eae9907a122d4472da727ae8b1ac1c40c027.tar.zst Nix-17f6eae9907a122d4472da727ae8b1ac1c40c027.zip |
Add a filesWatcher service to restart them when secrets change
Diffstat (limited to 'modules/private')
21 files changed, 112 insertions, 1 deletions
diff --git a/modules/private/buildbot/default.nix b/modules/private/buildbot/default.nix index fa6a6f2..d023a83 100644 --- a/modules/private/buildbot/default.nix +++ b/modules/private/buildbot/default.nix | |||
@@ -37,6 +37,10 @@ in | |||
37 | extraGroups = [ "keys" ]; | 37 | extraGroups = [ "keys" ]; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | services.websites.tools.watchPaths = lib.attrsets.mapAttrsToList | ||
41 | (k: project: "/var/secrets/buildbot/${project.name}/webhook-httpd-include") | ||
42 | myconfig.env.buildbot.projects; | ||
43 | |||
40 | services.websites.tools.vhostConfs.git.extraConfig = lib.attrsets.mapAttrsToList (k: project: '' | 44 | services.websites.tools.vhostConfs.git.extraConfig = lib.attrsets.mapAttrsToList (k: project: '' |
41 | RedirectMatch permanent "^/buildbot/${project.name}$" "/buildbot/${project.name}/" | 45 | RedirectMatch permanent "^/buildbot/${project.name}$" "/buildbot/${project.name}/" |
42 | RewriteEngine On | 46 | RewriteEngine On |
@@ -106,6 +110,14 @@ in | |||
106 | } | 110 | } |
107 | ]; | 111 | ]; |
108 | 112 | ||
113 | services.filesWatcher = lib.attrsets.mapAttrs' (k: project: lib.attrsets.nameValuePair "buildbot-${project.name}" { | ||
114 | restart = true; | ||
115 | paths = [ | ||
116 | "/var/secrets/buildbot/ldap" | ||
117 | "/var/secrets/buildbot/ssh_key" | ||
118 | ] ++ lib.attrsets.mapAttrsToList (k: v: "/var/secrets/buildbot/${project.name}/${k}") project.secrets; | ||
119 | }) myconfig.env.buildbot.projects; | ||
120 | |||
109 | systemd.services = lib.attrsets.mapAttrs' (k: project: lib.attrsets.nameValuePair "buildbot-${project.name}" { | 121 | systemd.services = lib.attrsets.mapAttrs' (k: project: lib.attrsets.nameValuePair "buildbot-${project.name}" { |
110 | description = "Buildbot Continuous Integration Server ${project.name}."; | 122 | description = "Buildbot Continuous Integration Server ${project.name}."; |
111 | after = [ "network-online.target" ]; | 123 | after = [ "network-online.target" ]; |
diff --git a/modules/private/databases/openldap/default.nix b/modules/private/databases/openldap/default.nix index e048d56..f09113a 100644 --- a/modules/private/databases/openldap/default.nix +++ b/modules/private/databases/openldap/default.nix | |||
@@ -144,6 +144,11 @@ in | |||
144 | ''; | 144 | ''; |
145 | }; | 145 | }; |
146 | 146 | ||
147 | services.filesWatcher.openldap = { | ||
148 | restart = true; | ||
149 | paths = [ "${config.secrets.location}/ldap/" ]; | ||
150 | }; | ||
151 | |||
147 | services.openldap = { | 152 | services.openldap = { |
148 | enable = true; | 153 | enable = true; |
149 | dataDir = cfg.dataDir; | 154 | dataDir = cfg.dataDir; |
diff --git a/modules/private/ftp.nix b/modules/private/ftp.nix index ada5f41..59cae59 100644 --- a/modules/private/ftp.nix +++ b/modules/private/ftp.nix | |||
@@ -72,6 +72,11 @@ in | |||
72 | ''; | 72 | ''; |
73 | }]; | 73 | }]; |
74 | 74 | ||
75 | services.filesWatcher.pure-ftpd = { | ||
76 | restart = true; | ||
77 | paths = [ "/var/secrets/pure-ftpd-ldap" ]; | ||
78 | }; | ||
79 | |||
75 | systemd.services.pure-ftpd = let | 80 | systemd.services.pure-ftpd = let |
76 | configFile = pkgs.writeText "pure-ftpd.conf" '' | 81 | configFile = pkgs.writeText "pure-ftpd.conf" '' |
77 | PassivePortRange 40000 50000 | 82 | PassivePortRange 40000 50000 |
diff --git a/modules/private/mpd.nix b/modules/private/mpd.nix index 9903bdf..17454d7 100644 --- a/modules/private/mpd.nix +++ b/modules/private/mpd.nix | |||
@@ -20,6 +20,11 @@ | |||
20 | networking.firewall.allowedTCPPorts = [ 6600 ]; | 20 | networking.firewall.allowedTCPPorts = [ 6600 ]; |
21 | users.users.mpd.extraGroups = [ "wwwrun" "keys" ]; | 21 | users.users.mpd.extraGroups = [ "wwwrun" "keys" ]; |
22 | systemd.services.mpd.serviceConfig.RuntimeDirectory = "mpd"; | 22 | systemd.services.mpd.serviceConfig.RuntimeDirectory = "mpd"; |
23 | services.filesWatcher.mpd = { | ||
24 | restart = true; | ||
25 | paths = [ "/var/secrets/mpd-config" ]; | ||
26 | }; | ||
27 | |||
23 | services.mpd = { | 28 | services.mpd = { |
24 | enable = true; | 29 | enable = true; |
25 | network.listenAddress = "any"; | 30 | network.listenAddress = "any"; |
diff --git a/modules/private/tasks/default.nix b/modules/private/tasks/default.nix index 30f49ee..83a1b61 100644 --- a/modules/private/tasks/default.nix +++ b/modules/private/tasks/default.nix | |||
@@ -101,6 +101,7 @@ in { | |||
101 | SetEnv TASKD_LDAP_FILTER "${env.ldap.search}" | 101 | SetEnv TASKD_LDAP_FILTER "${env.ldap.search}" |
102 | ''; | 102 | ''; |
103 | }]; | 103 | }]; |
104 | services.websites.tools.watchPaths = [ "/var/secrets/webapps/tools-taskwarrior-web" ]; | ||
104 | services.websites.tools.modules = [ "proxy_fcgi" "sed" ]; | 105 | services.websites.tools.modules = [ "proxy_fcgi" "sed" ]; |
105 | services.websites.tools.vhostConfs.task = { | 106 | services.websites.tools.vhostConfs.task = { |
106 | certName = "eldiron"; | 107 | certName = "eldiron"; |
diff --git a/modules/private/websites/aten/integration.nix b/modules/private/websites/aten/integration.nix index 748e388..384b324 100644 --- a/modules/private/websites/aten/integration.nix +++ b/modules/private/websites/aten/integration.nix | |||
@@ -27,6 +27,9 @@ in { | |||
27 | root = aten.apache.root; | 27 | root = aten.apache.root; |
28 | extraConfig = [ aten.apache.vhostConf ]; | 28 | extraConfig = [ aten.apache.vhostConf ]; |
29 | }; | 29 | }; |
30 | services.websites.integration.watchPaths = [ | ||
31 | "/var/secrets/webapps/${aten.app.environment}-aten" | ||
32 | ]; | ||
30 | }; | 33 | }; |
31 | } | 34 | } |
32 | 35 | ||
diff --git a/modules/private/websites/aten/production.nix b/modules/private/websites/aten/production.nix index 7a4adb5..1a55e8a 100644 --- a/modules/private/websites/aten/production.nix +++ b/modules/private/websites/aten/production.nix | |||
@@ -29,6 +29,8 @@ in { | |||
29 | root = aten.apache.root; | 29 | root = aten.apache.root; |
30 | extraConfig = [ aten.apache.vhostConf ]; | 30 | extraConfig = [ aten.apache.vhostConf ]; |
31 | }; | 31 | }; |
32 | services.websites.production.watchPaths = [ | ||
33 | "/var/secrets/webapps/${aten.app.environment}-aten" | ||
34 | ]; | ||
32 | }; | 35 | }; |
33 | } | 36 | } |
34 | |||
diff --git a/modules/private/websites/chloe/integration.nix b/modules/private/websites/chloe/integration.nix index c42a428..25ec4db 100644 --- a/modules/private/websites/chloe/integration.nix +++ b/modules/private/websites/chloe/integration.nix | |||
@@ -32,5 +32,8 @@ in { | |||
32 | root = chloe.apache.root; | 32 | root = chloe.apache.root; |
33 | extraConfig = [ chloe.apache.vhostConf ]; | 33 | extraConfig = [ chloe.apache.vhostConf ]; |
34 | }; | 34 | }; |
35 | services.websites.integration.watchPaths = [ | ||
36 | "/var/secrets/webapps/${chloe.app.environment}-chloe" | ||
37 | ]; | ||
35 | }; | 38 | }; |
36 | } | 39 | } |
diff --git a/modules/private/websites/chloe/production.nix b/modules/private/websites/chloe/production.nix index 0bf2d8f..6e0c34d 100644 --- a/modules/private/websites/chloe/production.nix +++ b/modules/private/websites/chloe/production.nix | |||
@@ -34,5 +34,8 @@ in { | |||
34 | root = chloe.apache.root; | 34 | root = chloe.apache.root; |
35 | extraConfig = [ chloe.apache.vhostConf ]; | 35 | extraConfig = [ chloe.apache.vhostConf ]; |
36 | }; | 36 | }; |
37 | services.websites.production.watchPaths = [ | ||
38 | "/var/secrets/webapps/${chloe.app.environment}-chloe" | ||
39 | ]; | ||
37 | }; | 40 | }; |
38 | } | 41 | } |
diff --git a/modules/private/websites/connexionswing/integration.nix b/modules/private/websites/connexionswing/integration.nix index 1d8488a..7d77ac7 100644 --- a/modules/private/websites/connexionswing/integration.nix +++ b/modules/private/websites/connexionswing/integration.nix | |||
@@ -31,6 +31,10 @@ in { | |||
31 | root = connexionswing.apache.root; | 31 | root = connexionswing.apache.root; |
32 | extraConfig = [ connexionswing.apache.vhostConf ]; | 32 | extraConfig = [ connexionswing.apache.vhostConf ]; |
33 | }; | 33 | }; |
34 | services.filesWatcher.phpfpm-connexionswing_dev = { | ||
35 | restart = true; | ||
36 | paths = [ "/var/secrets/webapps/${connexionswing.app.environment}-connexionswing" ]; | ||
37 | }; | ||
34 | }; | 38 | }; |
35 | } | 39 | } |
36 | 40 | ||
diff --git a/modules/private/websites/connexionswing/production.nix b/modules/private/websites/connexionswing/production.nix index 555f129..f4cb377 100644 --- a/modules/private/websites/connexionswing/production.nix +++ b/modules/private/websites/connexionswing/production.nix | |||
@@ -33,6 +33,10 @@ in { | |||
33 | root = connexionswing.apache.root; | 33 | root = connexionswing.apache.root; |
34 | extraConfig = [ connexionswing.apache.vhostConf ]; | 34 | extraConfig = [ connexionswing.apache.vhostConf ]; |
35 | }; | 35 | }; |
36 | services.filesWatcher.phpfpm-connexionswing_prod = { | ||
37 | restart = true; | ||
38 | paths = [ "/var/secrets/webapps/${connexionswing.app.environment}-connexionswing" ]; | ||
39 | }; | ||
36 | }; | 40 | }; |
37 | } | 41 | } |
38 | 42 | ||
diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index 8b02977..c3d941c 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix | |||
@@ -138,6 +138,10 @@ in | |||
138 | ''; | 138 | ''; |
139 | }; | 139 | }; |
140 | 140 | ||
141 | services.filesWatcher.httpdProd.paths = [ "/var/secrets/apache-ldap" ]; | ||
142 | services.filesWatcher.httpdInte.paths = [ "/var/secrets/apache-ldap" ]; | ||
143 | services.filesWatcher.httpdTools.paths = [ "/var/secrets/apache-ldap" ]; | ||
144 | |||
141 | services.websites.production = { | 145 | services.websites.production = { |
142 | enable = true; | 146 | enable = true; |
143 | adminAddr = "httpd@immae.eu"; | 147 | adminAddr = "httpd@immae.eu"; |
diff --git a/modules/private/websites/florian/app.nix b/modules/private/websites/florian/app.nix index 3a6d152..55fb3cb 100644 --- a/modules/private/websites/florian/app.nix +++ b/modules/private/websites/florian/app.nix | |||
@@ -32,5 +32,9 @@ in { | |||
32 | adminer.apache.vhostConf | 32 | adminer.apache.vhostConf |
33 | ]; | 33 | ]; |
34 | }; | 34 | }; |
35 | services.filesWatcher.phpfpm-tellesflorian_dev = { | ||
36 | restart = true; | ||
37 | paths = [ "/var/secrets/webapps/${tellesflorian.app.environment}-tellesflorian" ]; | ||
38 | }; | ||
35 | }; | 39 | }; |
36 | } | 40 | } |
diff --git a/modules/private/websites/ludivinecassal/integration.nix b/modules/private/websites/ludivinecassal/integration.nix index ed0dc9f..f0ef3a6 100644 --- a/modules/private/websites/ludivinecassal/integration.nix +++ b/modules/private/websites/ludivinecassal/integration.nix | |||
@@ -28,5 +28,9 @@ in { | |||
28 | root = ludivinecassal.apache.root; | 28 | root = ludivinecassal.apache.root; |
29 | extraConfig = [ ludivinecassal.apache.vhostConf ]; | 29 | extraConfig = [ ludivinecassal.apache.vhostConf ]; |
30 | }; | 30 | }; |
31 | services.filesWatcher.phpfpm-ludivinecassal_dev = { | ||
32 | restart = true; | ||
33 | paths = [ "/var/secrets/webapps/${ludivinecassal.app.environment}-ludivinecassal" ]; | ||
34 | }; | ||
31 | }; | 35 | }; |
32 | } | 36 | } |
diff --git a/modules/private/websites/ludivinecassal/production.nix b/modules/private/websites/ludivinecassal/production.nix index 3df5613..6a22d98 100644 --- a/modules/private/websites/ludivinecassal/production.nix +++ b/modules/private/websites/ludivinecassal/production.nix | |||
@@ -29,5 +29,9 @@ in { | |||
29 | root = ludivinecassal.apache.root; | 29 | root = ludivinecassal.apache.root; |
30 | extraConfig = [ ludivinecassal.apache.vhostConf ]; | 30 | extraConfig = [ ludivinecassal.apache.vhostConf ]; |
31 | }; | 31 | }; |
32 | services.filesWatcher.phpfpm-ludivinecassal_prod = { | ||
33 | restart = true; | ||
34 | paths = [ "/var/secrets/webapps/${ludivinecassal.app.environment}-ludivinecassal" ]; | ||
35 | }; | ||
32 | }; | 36 | }; |
33 | } | 37 | } |
diff --git a/modules/private/websites/tools/diaspora/default.nix b/modules/private/websites/tools/diaspora/default.nix index efa1fab..6742a81 100644 --- a/modules/private/websites/tools/diaspora/default.nix +++ b/modules/private/websites/tools/diaspora/default.nix | |||
@@ -145,6 +145,11 @@ in { | |||
145 | configDir = "/var/secrets/webapps/diaspora"; | 145 | configDir = "/var/secrets/webapps/diaspora"; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | services.filesWatcher.diaspora = { | ||
149 | restart = true; | ||
150 | paths = [ dcfg.configDir ]; | ||
151 | }; | ||
152 | |||
148 | services.websites.tools.modules = [ | 153 | services.websites.tools.modules = [ |
149 | "headers" "proxy" "proxy_http" | 154 | "headers" "proxy" "proxy_http" |
150 | ]; | 155 | ]; |
diff --git a/modules/private/websites/tools/ether/default.nix b/modules/private/websites/tools/ether/default.nix index ebcbf61..3e68d54 100644 --- a/modules/private/websites/tools/ether/default.nix +++ b/modules/private/websites/tools/ether/default.nix | |||
@@ -133,6 +133,11 @@ in { | |||
133 | 133 | ||
134 | systemd.services.etherpad-lite.serviceConfig.SupplementaryGroups = "keys"; | 134 | systemd.services.etherpad-lite.serviceConfig.SupplementaryGroups = "keys"; |
135 | 135 | ||
136 | services.filesWatcher.etherpad-lite = { | ||
137 | restart = true; | ||
138 | paths = [ ecfg.sessionKeyFile ecfg.apiKeyFile ecfg.configFile ]; | ||
139 | }; | ||
140 | |||
136 | services.websites.tools.modules = [ | 141 | services.websites.tools.modules = [ |
137 | "headers" "proxy" "proxy_http" "proxy_wstunnel" | 142 | "headers" "proxy" "proxy_http" "proxy_wstunnel" |
138 | ]; | 143 | ]; |
diff --git a/modules/private/websites/tools/mastodon/default.nix b/modules/private/websites/tools/mastodon/default.nix index d742a33..1a4b387 100644 --- a/modules/private/websites/tools/mastodon/default.nix +++ b/modules/private/websites/tools/mastodon/default.nix | |||
@@ -63,6 +63,19 @@ in { | |||
63 | socketsPrefix = "live_immae"; | 63 | socketsPrefix = "live_immae"; |
64 | dataDir = "/var/lib/mastodon_immae"; | 64 | dataDir = "/var/lib/mastodon_immae"; |
65 | }; | 65 | }; |
66 | services.filesWatcher.mastodon-streaming = { | ||
67 | restart = true; | ||
68 | paths = [ mcfg.configFile ]; | ||
69 | }; | ||
70 | services.filesWatcher.mastodon-web = { | ||
71 | restart = true; | ||
72 | paths = [ mcfg.configFile ]; | ||
73 | }; | ||
74 | services.filesWatcher.mastodon-sidekiq = { | ||
75 | restart = true; | ||
76 | paths = [ mcfg.configFile ]; | ||
77 | }; | ||
78 | |||
66 | 79 | ||
67 | services.websites.tools.modules = [ | 80 | services.websites.tools.modules = [ |
68 | "headers" "proxy" "proxy_wstunnel" "proxy_http" | 81 | "headers" "proxy" "proxy_wstunnel" "proxy_http" |
diff --git a/modules/private/websites/tools/mgoblin/default.nix b/modules/private/websites/tools/mgoblin/default.nix index 5da81f6..1d398db 100644 --- a/modules/private/websites/tools/mgoblin/default.nix +++ b/modules/private/websites/tools/mgoblin/default.nix | |||
@@ -78,6 +78,14 @@ in { | |||
78 | plugins = builtins.attrValues pkgs.webapps.mediagoblin-plugins; | 78 | plugins = builtins.attrValues pkgs.webapps.mediagoblin-plugins; |
79 | configFile = "/var/secrets/webapps/tools-mediagoblin"; | 79 | configFile = "/var/secrets/webapps/tools-mediagoblin"; |
80 | }; | 80 | }; |
81 | services.filesWatcher.mediagoblin-web = { | ||
82 | restart = true; | ||
83 | paths = [ mcfg.configFile ]; | ||
84 | }; | ||
85 | services.filesWatcher.mediagoblin-celeryd = { | ||
86 | restart = true; | ||
87 | paths = [ mcfg.configFile ]; | ||
88 | }; | ||
81 | 89 | ||
82 | services.websites.tools.modules = [ | 90 | services.websites.tools.modules = [ |
83 | "proxy" "proxy_http" | 91 | "proxy" "proxy_http" |
diff --git a/modules/private/websites/tools/peertube/default.nix b/modules/private/websites/tools/peertube/default.nix index dee1b81..dd28530 100644 --- a/modules/private/websites/tools/peertube/default.nix +++ b/modules/private/websites/tools/peertube/default.nix | |||
@@ -153,6 +153,11 @@ in { | |||
153 | services.websites.tools.modules = [ | 153 | services.websites.tools.modules = [ |
154 | "headers" "proxy" "proxy_http" "proxy_wstunnel" | 154 | "headers" "proxy" "proxy_http" "proxy_wstunnel" |
155 | ]; | 155 | ]; |
156 | services.filesWatcher.peertube = { | ||
157 | restart = true; | ||
158 | paths = [ pcfg.configFile ]; | ||
159 | }; | ||
160 | |||
156 | services.websites.tools.vhostConfs.peertube = { | 161 | services.websites.tools.vhostConfs.peertube = { |
157 | certName = "eldiron"; | 162 | certName = "eldiron"; |
158 | addToCerts = true; | 163 | addToCerts = true; |
diff --git a/modules/private/websites/tools/tools/default.nix b/modules/private/websites/tools/tools/default.nix index 94a2be1..d75def4 100644 --- a/modules/private/websites/tools/tools/default.nix +++ b/modules/private/websites/tools/tools/default.nix | |||
@@ -212,6 +212,11 @@ in { | |||
212 | }; | 212 | }; |
213 | }; | 213 | }; |
214 | 214 | ||
215 | services.filesWatcher.ympd = { | ||
216 | restart = true; | ||
217 | paths = [ "/var/secrets/mpd" ]; | ||
218 | }; | ||
219 | |||
215 | services.phpfpm.pools.roundcubemail = { | 220 | services.phpfpm.pools.roundcubemail = { |
216 | listen = roundcubemail.phpFpm.socket; | 221 | listen = roundcubemail.phpFpm.socket; |
217 | extraConfig = roundcubemail.phpFpm.pool; | 222 | extraConfig = roundcubemail.phpFpm.pool; |
@@ -297,6 +302,13 @@ in { | |||
297 | "${kanboard.apache.webappName}" = kanboard.webRoot; | 302 | "${kanboard.apache.webappName}" = kanboard.webRoot; |
298 | }; | 303 | }; |
299 | 304 | ||
305 | services.websites.tools.watchPaths = [ | ||
306 | "/var/secrets/webapps/tools-wallabag" | ||
307 | ]; | ||
308 | services.filesWatcher.phpfpm-wallabag = { | ||
309 | restart = true; | ||
310 | paths = [ "/var/secrets/webapps/tools-wallabag" ]; | ||
311 | }; | ||
300 | }; | 312 | }; |
301 | } | 313 | } |
302 | 314 | ||