Configure podman and koito
This commit is contained in:
parent
547365c5c3
commit
a339897c48
6 changed files with 104 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ lib, pkgs, ... }: {
|
{ config, lib, pkgs, ... }: {
|
||||||
imports = [ ./filesystems.nix ];
|
imports = [ ./filesystems.nix ];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
@ -14,7 +14,18 @@
|
||||||
environment.systemPackages = with pkgs; [ arion docker-client ];
|
environment.systemPackages = with pkgs; [ arion docker-client ];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
firewall.enable = true;
|
firewall = {
|
||||||
|
enable = true;
|
||||||
|
interfaces = let
|
||||||
|
matchAll =
|
||||||
|
if !config.networking.nftables.enable then "podman+" else "podman*";
|
||||||
|
in {
|
||||||
|
"${matchAll}" = {
|
||||||
|
allowedTCPPorts = [ 5432 ];
|
||||||
|
allowedUDPPorts = [ 53 ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
hostName = "greatyamada";
|
hostName = "greatyamada";
|
||||||
networkmanager.enable = true;
|
networkmanager.enable = true;
|
||||||
useDHCP = lib.mkDefault false;
|
useDHCP = lib.mkDefault false;
|
||||||
|
@ -43,10 +54,14 @@
|
||||||
users.avery.extraGroups = [ "media" ];
|
users.avery.extraGroups = [ "media" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualisation.podman = {
|
virtualisation = {
|
||||||
enable = true;
|
oci-containers.backend = "podman";
|
||||||
dockerSocket.enable = true;
|
podman = {
|
||||||
defaultNetwork.settings.dns_enabled = true;
|
enable = true;
|
||||||
|
autoPrune.enable = true;
|
||||||
|
dockerSocket.enable = true;
|
||||||
|
defaultNetwork.settings.dns_enabled = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
time.timeZone = "UTC";
|
time.timeZone = "UTC";
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
adguardhome-dhcp-udp = 67;
|
adguardhome-dhcp-udp = 67;
|
||||||
forgejo-http = 3000;
|
forgejo-http = 3000;
|
||||||
jellyfin-http = 8096;
|
jellyfin-http = 8096;
|
||||||
|
koito = 4110;
|
||||||
minecraft = 13914;
|
minecraft = 13914;
|
||||||
navidrome-https = 4533;
|
navidrome-https = 4533;
|
||||||
nginx-https = 443;
|
nginx-https = 443;
|
||||||
|
|
|
@ -20,7 +20,7 @@ in {
|
||||||
session_ttl = "720h";
|
session_ttl = "720h";
|
||||||
};
|
};
|
||||||
dns = {
|
dns = {
|
||||||
bind_hosts = [ "0.0.0.0" ];
|
bind_hosts = [ "10.0.0.1" ];
|
||||||
port = portDefinitions.adguardhome-dns;
|
port = portDefinitions.adguardhome-dns;
|
||||||
anonymize_client_ip = false;
|
anonymize_client_ip = false;
|
||||||
ratelimit = 0;
|
ratelimit = 0;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
./forgejo.nix
|
./forgejo.nix
|
||||||
./inadyn.nix
|
./inadyn.nix
|
||||||
./jellyfin.nix
|
./jellyfin.nix
|
||||||
|
./koito.nix
|
||||||
# ./minecraft
|
# ./minecraft
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
./pgadmin.nix
|
./pgadmin.nix
|
||||||
|
|
71
hosts/greatyamada/services/koito.nix
Normal file
71
hosts/greatyamada/services/koito.nix
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
let
|
||||||
|
portDefinitions = import ./_port-definitions.nix;
|
||||||
|
nginxLocalConfig = import ./nginx-local-config.nix;
|
||||||
|
in {
|
||||||
|
virtualisation.oci-containers.containers."koito" = {
|
||||||
|
image = "gabehf/koito:latest";
|
||||||
|
environment = {
|
||||||
|
"KOITO_ALLOWED_HOSTS" = "koito.rcia.dev";
|
||||||
|
"KOITO_ENABLE_LBZ_RELAY" = "true";
|
||||||
|
"KOITO_LBZ_RELAY_URL" = "https://api.listenbrainz.org/1";
|
||||||
|
};
|
||||||
|
environmentFiles = [ config.sops.templates."koito.env".path ];
|
||||||
|
volumes = [ "/mnt/hdd-01/koito:/etc/koito:rw" ];
|
||||||
|
ports = [ "${toString portDefinitions.koito}:4110/tcp" ];
|
||||||
|
log-driver = "journald";
|
||||||
|
extraOptions = [ "--network-alias=koito" "--network=koito_default" ];
|
||||||
|
};
|
||||||
|
systemd.services."podman-koito" = {
|
||||||
|
serviceConfig = { Restart = lib.mkOverride 90 "always"; };
|
||||||
|
after = [ "podman-network-koito_default.service" ];
|
||||||
|
requires = [ "podman-network-koito_default.service" ];
|
||||||
|
partOf = [ "podman-compose-koito-root.target" ];
|
||||||
|
wantedBy = [ "podman-compose-koito-root.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx.virtualHosts."koito.rcia.dev" = {
|
||||||
|
locations."/".proxyPass =
|
||||||
|
"http://localhost:${toString portDefinitions.koito}";
|
||||||
|
forceSSL = true;
|
||||||
|
useACMEHost = "rcia.dev";
|
||||||
|
};
|
||||||
|
|
||||||
|
sops = {
|
||||||
|
secrets = {
|
||||||
|
"koito/database_url" = { };
|
||||||
|
"koito/listenbrainz_token" = { };
|
||||||
|
};
|
||||||
|
templates."koito.env".content = ''
|
||||||
|
KOITO_DATABASE_URL=${config.sops.placeholder."koito/database_url"}
|
||||||
|
KOITO_LBZ_RELAY_TOKEN=${
|
||||||
|
config.sops.placeholder."koito/listenbrainz_token"
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Networks
|
||||||
|
systemd.services."podman-network-koito_default" = {
|
||||||
|
path = [ pkgs.podman ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStop = "podman network rm -f koito_default";
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
podman network inspect koito_default || podman network create koito_default
|
||||||
|
'';
|
||||||
|
partOf = [ "podman-compose-koito-root.target" ];
|
||||||
|
wantedBy = [ "podman-compose-koito-root.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Root service
|
||||||
|
# When started, this will automatically create all resources and start
|
||||||
|
# the containers. When stopped, this will teardown all resources.
|
||||||
|
systemd.targets."podman-compose-koito-root" = {
|
||||||
|
unitConfig = { Description = "Root target generated by compose2nix."; };
|
||||||
|
after = [ "postgresql.service" ];
|
||||||
|
requires = [ "postgresql.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -4,8 +4,17 @@ in {
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.postgresql_16;
|
package = pkgs.postgresql_16;
|
||||||
|
enableTCPIP = true;
|
||||||
dataDir =
|
dataDir =
|
||||||
"/mnt/ssd-01/postgresql/${config.services.postgresql.package.psqlSchema}";
|
"/mnt/ssd-01/postgresql/${config.services.postgresql.package.psqlSchema}";
|
||||||
settings.port = portDefinitions.postgresql;
|
settings.port = portDefinitions.postgresql;
|
||||||
|
authentication = pkgs.lib.mkOverride 10 ''
|
||||||
|
local all all trust
|
||||||
|
host all all 127.0.0.1/32 trust
|
||||||
|
host all all ::1/128 trust
|
||||||
|
|
||||||
|
# Allow containers access to the database
|
||||||
|
host all all 10.89.0.0/16 trust
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue