From 0062a554f2dfef4a6f921efcda5e3c6078697eed Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 19 Sep 2023 18:08:40 +0100 Subject: [PATCH] hydra: beid: Update config. Various overdue config updates. * hydra/beid.scm (my-nginx-service): Use 127.0.0.1 rather than localhost for the data service. (guix-data-service-nars-cleanup): New procedure. (mcron-service-configuration): Add nars cleanup job. : Change target to targets. : Remove now unused file system. : Add extra special file for nars cleanup, update openssh config, provide more PostgreSQL connections and reduce the max processes for the data service processing jobs. --- hydra/beid.scm | 79 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 16 deletions(-) diff --git a/hydra/beid.scm b/hydra/beid.scm index db42323..78ab726 100644 --- a/hydra/beid.scm +++ b/hydra/beid.scm @@ -202,7 +202,7 @@ (servers '("localhost:8080"))) (nginx-upstream-configuration (name "guix-data-service-proxy") - (servers '("localhost:8765"))))) + (servers '("127.0.0.1:8765"))))) (server-blocks (list (nginx-server-configuration @@ -262,9 +262,9 @@ (assoc-ref (package-native-inputs guix-data-service) "guile")))) -(define (guix-data-service-branch-cleanup guix-data-service) +(define (guix-data-service-nars-cleanup guix-data-service) (program-file - "guix-data-service-branch-cleanup" + "guix-data-service-nars-cleanup" (with-extensions (cons* guix-data-service guile-gcrypt (map (match-lambda @@ -274,12 +274,60 @@ (setvbuf (current-output-port) 'line) (setvbuf (current-error-port) 'line) - (simple-format #t "~A: start: guix-data-service-branch-cleanup\n" + (simple-format #t "~A: start: guix-data-service-nars-cleanup\n" (strftime "%c" (localtime (current-time)))) (use-modules (guix-data-service data-deletion)) (begin - (delete-data-for-all-deleted-branches) - (delete-revisions-for-all-branches-except-most-recent-n 350)))) + (delete-nars-for-unknown-store-paths)))) + #:guile + (car + (assoc-ref (package-native-inputs guix-data-service) + "guile")))) + +(define (guix-data-service-branch-cleanup guix-data-service) + (program-file + "guix-data-service-branch-cleanup" + (with-extensions + (cons* guix-data-service + guile-gcrypt + (map (match-lambda + ((name pkg) pkg)) + (package-propagated-inputs guix-data-service))) + #~(begin + (setvbuf (current-output-port) 'line) + (setvbuf (current-error-port) 'line) + + (simple-format #t "~A: start: guix-data-service-branch-cleanup\n" + (strftime "%c" (localtime (current-time)))) + (use-modules (squee) + (ice-9 match) + (guix-data-service database) + (guix-data-service data-deletion)) + (begin + (delete-data-for-all-deleted-branches) + (delete-revisions-for-all-branches-except-most-recent-n 350) + + (with-postgresql-connection + "data-deletion" + (lambda (conn) + (for-each + (match-lambda + ((git-repository-id branch) + (delete-revisions-from-branch-except-most-recent-n + conn + (string->number git-repository-id) + branch + 1))) + (exec-query + conn + " +SELECT git_repository_id, name +FROM git_branches +WHERE + (git_repository_id = 1 AND name LIKE 'issue-%') + OR + (git_repository_id = 2 AND name NOT LIKE 'master') +ORDER BY id ASC"))))))) #:guile (car (assoc-ref (package-native-inputs guix-data-service) @@ -293,7 +341,9 @@ "guix gc") #~(job "0 0 * * *" #$(guix-data-service-branch-cleanup my-guix-data-service)) - #~(job "0 0 * * 0" + #~(job "0 0 * * *" + #$(guix-data-service-nars-cleanup my-guix-data-service)) + #~(job "0 2 * * 0" #$(guix-data-service-derivation-cleanup my-guix-data-service)))))) (operating-system @@ -303,7 +353,7 @@ (bootloader (bootloader-configuration (bootloader grub-bootloader) - (target "/dev/sda"))) + (targets '("/dev/sda")))) (initrd-modules (append (list "virtio_scsi") %base-initrd-modules)) @@ -312,11 +362,6 @@ (device (file-system-label "root")) (mount-point "/") (type "ext4")) - (file-system - (device "/dev/disk/by-id/scsi-0HC_Volume_10097981") - (mount-point "/mnt/beid-postgresql-additional-data") - (type "ext4") - (options "discard")) %base-file-systems)) (swap-devices '("/swapfile")) @@ -338,13 +383,15 @@ (extra-special-file "/usr/bin/guix-data-service-branch-cleanup" (guix-data-service-branch-cleanup my-guix-data-service)) + (extra-special-file "/usr/bin/guix-data-service-nars-cleanup" + (guix-data-service-nars-cleanup my-guix-data-service)) (extra-special-file "/usr/bin/guix-data-service-derivation-cleanup" (guix-data-service-derivation-cleanup my-guix-data-service)) (service ntp-service-type) (service openssh-service-type (openssh-configuration - (permit-root-login 'without-password) + (permit-root-login 'prohibit-password) (password-authentication? #f))) (service certbot-service-type (certbot-configuration @@ -367,10 +414,10 @@ (getmail-idle-mailboxes '("INBOX")) (extra-options '("--postgresql-statement-timeout=300000" - "--thread-pool-threads=32")) + "--postgresql-connections=64")) (extra-process-jobs-options '("--max-processes=1" - "--latest-branch-revision-max-processes=6")) + "--latest-branch-revision-max-processes=4")) (commits-getmail-retriever-configuration (getmail-retriever-configuration (type "SimpleIMAPSSLRetriever")