diff options
Diffstat (limited to 'bffe.scm')
-rw-r--r-- | bffe.scm | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/bffe.scm b/bffe.scm new file mode 100644 index 0000000..7f605d7 --- /dev/null +++ b/bffe.scm @@ -0,0 +1,56 @@ +;;; Build Farm Front-End +;;; +;;; Copyright © 2023 Christopher Baines <mail@cbaines.net> +;;; +;;; This program is free software: you can redistribute it and/or +;;; modify it under the terms of the GNU Affero General Public License +;;; as published by the Free Software Foundation, either version 3 of +;;; the License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Affero General Public License for more details. +;;; +;;; You should have received a copy of the GNU Affero General Public +;;; License along with this program. If not, see +;;; <http://www.gnu.org/licenses/>. + +(define-module (bffe) + #:use-module (ice-9 format) + #:use-module (oop goops) + #:use-module (prometheus) + #:use-module (logging logger) + #:use-module (logging port-log) + #:use-module (bffe server) + #:use-module (bffe manage-builds) + #:export (run-bffe-service)) + +(define* (run-bffe-service + #:key + (metrics-registry + (make-metrics-registry + #:namespace + "bffe")) + (build '()) + web-server-args) + (let ((lgr (make <logger>)) + (port-log (make <port-log> + #:port (current-output-port) + #:formatter + (lambda (lvl time str) + (format #f "~a (~5a): ~a~%" + (strftime "%F %H:%M:%S" (localtime time)) + lvl + str))))) + + (add-handler! lgr port-log) + (open-log! lgr) + (set-default-logger! lgr) + + (for-each start-submit-builds-thread + build) + + (apply start-bffe-web-server + `(,@web-server-args + #:metrics-registry ,metrics-registry)))) |