aboutsummaryrefslogtreecommitdiff
path: root/modules/webapps
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-10-16 13:49:24 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-10-16 13:49:24 +0200
commit6a8252b11bb02f3e67857d5a9d733b1affa6a625 (patch)
tree175cb91c386b444ce951361baaa4875136d5c9e4 /modules/webapps
parent5304a64b84c5a84525c96419cc6126775af306e0 (diff)
downloadNix-6a8252b11bb02f3e67857d5a9d733b1affa6a625.tar.gz
Nix-6a8252b11bb02f3e67857d5a9d733b1affa6a625.tar.zst
Nix-6a8252b11bb02f3e67857d5a9d733b1affa6a625.zip
Add backup module
Diffstat (limited to 'modules/webapps')
-rw-r--r--modules/webapps/mastodon.nix30
-rw-r--r--modules/webapps/webstats/default.nix3
2 files changed, 33 insertions, 0 deletions
diff --git a/modules/webapps/mastodon.nix b/modules/webapps/mastodon.nix
index 26d5238..eed9e3f 100644
--- a/modules/webapps/mastodon.nix
+++ b/modules/webapps/mastodon.nix
@@ -190,6 +190,36 @@ in
190 unitConfig.RequiresMountsFor = cfg.dataDir; 190 unitConfig.RequiresMountsFor = cfg.dataDir;
191 }; 191 };
192 192
193 systemd.services.mastodon-cleanup = {
194 description = "Cleanup mastodon";
195 startAt = "daily";
196 restartIfChanged = false;
197
198 environment.RAILS_ENV = "production";
199 environment.BUNDLE_PATH = "${cfg.workdir.gems}/${cfg.workdir.gems.ruby.gemPath}";
200 environment.BUNDLE_GEMFILE = "${cfg.workdir.gems.confFiles}/Gemfile";
201 environment.SOCKET = cfg.sockets.rails;
202
203 path = [ cfg.workdir.gems cfg.workdir.gems.ruby pkgs.file ];
204
205 script = ''
206 exec ./bin/tootctl media remove --days 30
207 '';
208
209 serviceConfig = {
210 User = cfg.user;
211 EnvironmentFile = cfg.configFile;
212 PrivateTmp = true;
213 Type = "oneshot";
214 WorkingDirectory = cfg.workdir;
215 StateDirectory = cfg.systemdStateDirectory;
216 RuntimeDirectory = cfg.systemdRuntimeDirectory;
217 RuntimeDirectoryPreserve = "yes";
218 };
219
220 unitConfig.RequiresMountsFor = cfg.dataDir;
221 };
222
193 systemd.services.mastodon-sidekiq = { 223 systemd.services.mastodon-sidekiq = {
194 description = "Mastodon Sidekiq"; 224 description = "Mastodon Sidekiq";
195 wantedBy = [ "multi-user.target" ]; 225 wantedBy = [ "multi-user.target" ];
diff --git a/modules/webapps/webstats/default.nix b/modules/webapps/webstats/default.nix
index 924d72d..6771f01 100644
--- a/modules/webapps/webstats/default.nix
+++ b/modules/webapps/webstats/default.nix
@@ -37,6 +37,9 @@ in {
37 }; 37 };
38 38
39 config = lib.mkIf (builtins.length cfg.sites > 0) { 39 config = lib.mkIf (builtins.length cfg.sites > 0) {
40 services.backup.profiles.goaccess = {
41 rootDir = cfg.dataDir;
42 };
40 users.users.root.packages = [ 43 users.users.root.packages = [
41 pkgs.goaccess 44 pkgs.goaccess
42 ]; 45 ];