Klaus
The recommended method for deploying Klaus according to the developer is using uWSGI or Gunicorn. This article provides an example deployment using uWSGI.
services.uwsgi = {
enable = true;
plugins = [ "python3" ];
instance = {
type = "normal";
master = true;
http-socket = ":8080";
module = "klaus.contrib.wsgi:application";
chdir = pkgs.klaus;
pythonPackages = self: with self; [
klaus
markdown # adds markdown support, optional
];
env = [
"KLAUS_REPOS_ROOT=/repos"
"PATH=${pkgs.git}/bin" # klaus makes a direct call to git
];
};
};
When loading a repository, you may encounter a 500, traced back to a git
command call in the uWSGI logs. Try setting services.uwsgi.user
and services.uwsgi.group
to match the ownership of the repository.
Autoreloading
By default, Klaus will scan for the list of repositories only the first time a page is loaded, and never again (until it is restarted). In order to have it keep track of added and deleted repositories, Klaus needs to be configured to autoreload.
services.uwsgi.instance = {
module = "klaus.contrib.wsgi_autoreload:application";
enable-threads = true;
lazy-apps = true;
};