summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--takemi-os.scm28
1 files changed, 28 insertions, 0 deletions
diff --git a/takemi-os.scm b/takemi-os.scm
index f6c2aec..a35793d 100644
--- a/takemi-os.scm
+++ b/takemi-os.scm
@@ -1,5 +1,6 @@
(use-modules (gnu)
(gnu packages version-control)
+ (gnu services admin)
(gnu services certbot)
(gnu services cgit)
(gnu services ci)
@@ -279,6 +280,33 @@
;; repos.
(group "git")
(socket (string-append "tcp:" fcgiwrap-socket))))
+ ;; Log rotation.
+ (simple-service 'rotate-logs
+ rottlog-service-type
+ (list (log-rotation
+ (frequency 'daily)
+ (files '("/var/log/nginx/access.log"
+ "/var/log/nginx/error.log"))
+ (options `( ;; Keep a week of logs.
+ "rotate 6"
+ ;; Run post-rotate once per
+ ;; rotation rather than once
+ ;; for each file.
+ "sharedscripts"
+ ,@%default-log-rotation-options))
+ ;; Tell nginx to reopen its log files after rotation.
+ (post-rotate
+ (program-file
+ "nginx-post-rotate-hook"
+ #~(let ((pid (call-with-input-file
+ "/var/run/nginx/pid"
+ read)))
+ (kill pid SIGUSR1)))))
+ (log-rotation
+ (frequency 'daily)
+ (files '("/var/log/fcgiwrap.log"))
+ (options `("rotate 6"
+ ,@%default-log-rotation-options)))))
(modify-services %base-services
(guix-service-type config =>
(guix-configuration