aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/forge.skb7
-rw-r--r--guix/forge/klaus.scm29
2 files changed, 33 insertions, 3 deletions
diff --git a/doc/forge.skb b/doc/forge.skb
index e11b255..5c5a5fd 100644
--- a/doc/forge.skb
+++ b/doc/forge.skb
@@ -36,7 +36,9 @@ email.])
(p [guix-forge integrates the following software components:]
(itemize
(item [,(ref :url "https://laminar.ohwg.net/" :text "laminar")
-for continuous integration])))
+for continuous integration])
+ (item [,(ref :url "https://github.com/jonashaag/klaus/" :text
+"klaus") to serve project git repositories on the web])))
(p [In the future, it will also provide:]
(itemize
(item [web server to serve static project sites])
@@ -299,4 +301,5 @@ gunicorn is run in.]))
[Identifier of the webhook. This hook is triggered at ,(ref
:url [http://host:port/hooks/<id>]).])
(record-field "run"
- [G-expression to run when the webhook is triggered])))))
+ [G-expression to run when the webhook is triggered]))
+ (docstring-function-documentation "guix/forge/klaus.scm" 'klaus-gunicorn-app))))
diff --git a/guix/forge/klaus.scm b/guix/forge/klaus.scm
index ba963ee..54b374f 100644
--- a/guix/forge/klaus.scm
+++ b/guix/forge/klaus.scm
@@ -18,19 +18,22 @@
;;; <https://www.gnu.org/licenses/>.
(define-module (forge klaus)
+ #:use-module (forge gunicorn)
#:use-module ((gnu packages check) #:select (python-nose python-pytest))
#:use-module ((gnu packages python-web)
#:select (python-flask python-werkzeug))
#:use-module ((gnu packages python-xyz)
#:select (python-dulwich python-humanize python-pygments))
#:use-module ((gnu packages version-control) #:select (git-minimal))
+ #:use-module (gnu system file-systems)
#:use-module (guix build-system pyproject)
#:use-module (guix build-system python)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
- #:use-module (guix utils))
+ #:use-module (guix utils)
+ #:export (klaus-gunicorn-app))
(define-public python-httpauth
(package
@@ -117,3 +120,27 @@ routes using HTTP Digest Authentication.")
@item Code navigation using Exuberant ctags
@end itemize")
(license license:isc)))
+
+(define* (klaus-gunicorn-app repository-directory sockets
+ #:key site-name)
+ "Return a @code{<gunicorn-app>} object to deploy klaus on
+@var{sockets}, a list of @code{<forge-ip-socket>} or
+@code{<forge-unix-socket>} objects.
+
+@var{repository-directory} is the path to the directory containing git
+repositories to serve.
+
+@var{site-name} is the name of the klaus site to be displayed in the
+banner."
+ (gunicorn-app
+ (name "klaus")
+ (package python-klaus)
+ (wsgi-app-module "klaus.contrib.wsgi_autoreload")
+ (sockets sockets)
+ (environment-variables `(("KLAUS_REPOS_ROOT" . ,repository-directory)
+ ,@(if site-name
+ `(("KLAUS_SITE_NAME" . ,site-name))
+ '())))
+ (mappings (list (file-system-mapping
+ (source repository-directory)
+ (target source))))))