use podman and kanboard with podman

This commit is contained in:
quitte 2024-05-19 11:16:49 +02:00
parent 16f8ec19f9
commit c8afe48290
3 changed files with 33 additions and 49 deletions

View file

@ -1,65 +1,49 @@
{ pkgs, config, lib, ... }: { config, pkgs, ... }:
let let
domain = "kanboard.${config.networking.domain}"; domain = "kanboard.${config.networking.domain}";
domain_short = "kb.${config.networking.domain}"; domain_short = "kb.${config.networking.domain}";
user = "kanboard";
group = "kanboard";
in in
{ {
users.users.${user} = { sops.secrets."kanboard_env" = { };
group = group;
isSystemUser = true;
};
users.groups.${group} = { };
services.phpfpm.pools.kanboard = {
user = "kanboard"; # Podman
group = "kanboard"; virtualisation.containers.enable = true;
settings = { virtualisation = {
"listen.owner" = config.services.nginx.user; podman = {
"pm" = "dynamic"; enable = true;
"pm.max_children" = 32;
"pm.max_requests" = 500; # Create a `docker` alias for podman, to use it as a drop-in replacement
"pm.start_servers" = 2; dockerCompat = true;
"pm.min_spare_servers" = 2;
"pm.max_spare_servers" = 5; # Required for containers under podman-compose to be able to talk to each other.
"php_admin_value[error_log]" = "stderr"; defaultNetwork.settings.dns_enabled = true;
"php_admin_flag[log_errors]" = true; };
"catch_workers_output" = true; };
virtualisation.oci-containers.backend = "podman";
virtualisation.oci-containers = {
containers.kanboard = {
image = "ghcr.io/kanboard/kanboard:v1.2.35";
volumes = [
"kanboard_data:/var/www/app/data"
"kanboard_plugins:/var/www/app/plugins"
];
ports = [ "127.0.0.1:8045:80" ];
environmentFiles = [
config.sops.secrets."kanboard_env".path
];
}; };
phpEnv."PATH" = lib.makeBinPath [ pkgs.php ];
}; };
services.nginx.enable = true;
services.nginx = { services.nginx = {
virtualHosts."${domain_short}" = { virtualHosts."${domain_short}" = {
locations."/".return = "301 $scheme://${domain}$request_uri"; locations."/".return = "301 $scheme://${domain}$request_uri";
}; };
virtualHosts."${domain}" = { virtualHosts."${domain}" = {
root = "/srv/web/kanboard"; locations."/" = {
extraConfig = '' proxyPass = "http://127.0.0.1:8045";
index index.html index.php;
'';
locations = {
"/" = {
tryFiles = "$uri $uri/ =404";
};
"~ \.php$" = {
extraConfig = ''
try_files $uri =404;
fastcgi_pass unix:${config.services.phpfpm.pools.kanboard.socket};
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include ${pkgs.nginx}/conf/fastcgi_params;
include ${pkgs.nginx}/conf/fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
'';
};
"/data".return = "403";
}; };
}; };
}; };

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
sops.secrets."strukturbot_env" = { }; sops.secrets."strukturbot_env" = { };
virtualisation.docker.daemon.settings.dns = [ "141.30.1.1" "141.76.14.1" ]; # virtualisation.docker.daemon.settings.dns = [ "141.30.1.1" "141.76.14.1" ];
virtualisation.oci-containers = { virtualisation.oci-containers = {
containers.struktur-bot = { containers.struktur-bot = {
image = "struktur-bot"; image = "struktur-bot";

View file

@ -7,7 +7,7 @@ in
sops.secrets."directus_env" = { }; sops.secrets."directus_env" = { };
environment.systemPackages = [ pkgs.nodejs_21 ]; environment.systemPackages = [ pkgs.nodejs_21 ];
virtualisation.oci-containers = { virtualisation.oci-containers = {
backend = "docker"; # backend = "docker";
containers.directus-ese = { containers.directus-ese = {
image = "directus/directus:latest"; image = "directus/directus:latest";
volumes = [ volumes = [