Wendy: Enable logrotate for httpd logs. Re-enable duplicity backups for subversion.
Eelco Dolstra committed
Jul 11, 2014 at 11:57 UTC
260558799bed2c1d14d5f2d88b48c36876fc4927
1 file changed
+54
-4
delft/wendy.nix
+54
-4
@@ -1,21 +1,49 @@
1
{ config, pkgs, ... }:
2
3
with pkgs.lib;
4
+let
5
+ duplicityBackup = pkgs.writeScript "backup-duplicity" ''
6
+ #! /bin/sh
7
+ echo "Starting backups"
8
+ export PATH=$PATH:/var/run/current-system/sw/bin
9
+ time duplicity --full-if-older-than 30D --no-encryption /data/pt-wiki file:///backup/cartman/pt-wiki
10
+ time duplicity --no-encryption --force remove-all-inc-of-but-n-full 1 file:///backup/cartman/pt-wiki
11
12
+ time duplicity --full-if-older-than 30D --no-encryption /data/subversion file:///backup/cartman/subversion
13
+ time duplicity --no-encryption --force remove-all-inc-of-but-n-full 1 file:///backup/cartman/subversion
14
+
15
+ time duplicity --full-if-older-than 30D --no-encryption /data/subversion-ptg file:///backup/cartman/subversion-ptg
16
+ time duplicity --no-encryption --force remove-all-inc-of-but-n-full 1 file:///backup/cartman/subversion-ptg
17
+
18
+ time duplicity --full-if-older-than 30D --no-encryption /data/subversion-strategoxt file:///backup/cartman/subversion-strategoxt
19
+ time duplicity --no-encryption --force remove-all-inc-of-but-n-full 1 file:///backup/cartman/subversion-strategoxt
20
+
21
+ echo Done
22
+ '';
23
+
24
+in
25
{
6
- imports = [ ./build-machines-dell-r815.nix ./delft-webserver.nix ./sysstat.nix ];
26
+ imports = [ ./build-machines-dell-r815.nix ./delft-webserver.nix ./sysstat.nix ./datadog.nix ];
27
28
fileSystems."/backup" =
29
{ device = "130.161.158.5:/dxs/users4/group/buildfarm";
30
fsType = "nfs4";
31
};
32
13
- /*
33
+ services.dd-agent.postgresqlConfig = ''
34
+ init_config:
35
+
36
+ instances:
37
+ - host: localhost
38
+ port: 5432
39
+ username: datadog
40
+ password: ${builtins.readFile ./datadog.secret}
41
+ '';
42
+
43
services.postgresqlBackup = {
44
enable = true;
16
- databases = [ "hydra" "jira" ];
45
+ databases = [ "hydra" ];
46
};
18
- */
47
48
services.postgresql = {
49
enable = true;
@@ -64,6 +92,7 @@ with pkgs.lib;
92
# pinging the other side. This is necessary to remain
93
# reachable from the outside.
94
"*/10 * * * * root ${pkgs.iputils}/sbin/ping6 -c 1 2001:610:600:88d::1"
95
+ "40 2 * * * root ${duplicityBackup} &>> /var/log/backup-duplicity.log"
96
];
97
98
services.radvd.enable = false;
@@ -136,4 +165,25 @@ with pkgs.lib;
165
'';
166
startAt = "*:03";
167
};
168
+
169
+ services.logrotate.enable = true;
170
+ services.logrotate.config = ''
171
+ /var/log/httpd/access_log
172
+ /var/log/httpd/error_log
173
+ /var/log/httpd/access_log*.nl
174
+ /var/log/httpd/error_log*.nl
175
+ /var/log/httpd/access_log*.org
176
+ /var/log/httpd/error_log*.org
177
+ {
178
+ daily
179
+ dateext
180
+ rotate 10000
181
+ compress
182
+ sharedscripts
183
+ postrotate
184
+ ${pkgs.coreutils}/bin/kill -HUP `${pkgs.coreutils}/bin/cat /var/run/httpd/httpd.pid`
185
+ endscript
186
+ }
187
+ '';
188
+
189
}