using container systemd services
This commit is contained in:
1 parent
b611ac0252
commit
2e940cc2c8
5 files changed
+33
-213
No files matched your search
+33
-14
@@ -35,24 +35,43 @@
|
|||||||
server.services = {
|
server.services = {
|
||||||
ai.enable = true;
|
ai.enable = true;
|
||||||
jellyfin.enable = false;
|
jellyfin.enable = false;
|
||||||
dockge = {
|
|
||||||
enable = true;
|
|
||||||
openFirewall = true;
|
|
||||||
volumes = {
|
|
||||||
stacks = {
|
|
||||||
nfsServer = "terra1.lab.internal";
|
|
||||||
share = "/mnt/Data/apps/bigbox/dockge/stacks";
|
|
||||||
};
|
|
||||||
data = {
|
|
||||||
nfsServer = "terra1.lab.internal";
|
|
||||||
share = "/mnt/Data/apps/bigbox/dockge/data";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
networkDrives.enable = true;
|
networkDrives.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Dockge container service group
|
||||||
|
skyg.nixos.common.container-services.dockge = {
|
||||||
|
services.dockge = {
|
||||||
|
image = "louislam/dockge:1";
|
||||||
|
ports = [ "5001:5001" ];
|
||||||
|
volumes = [
|
||||||
|
"/var/run/docker.sock:/var/run/docker.sock"
|
||||||
|
"dockge-data:/app/data"
|
||||||
|
"dockge-stacks:/opt/stacks"
|
||||||
|
];
|
||||||
|
environment.DOCKGE_STACKS_DIR = "/opt/stacks";
|
||||||
|
};
|
||||||
|
extraConfig.volumes = {
|
||||||
|
dockge-data = {
|
||||||
|
driver = "local";
|
||||||
|
driver_opts = {
|
||||||
|
type = "nfs";
|
||||||
|
o = "addr=terra1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime";
|
||||||
|
device = ":/mnt/Data/apps/bigbox/dockge/data";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
dockge-stacks = {
|
||||||
|
driver = "local";
|
||||||
|
driver_opts = {
|
||||||
|
type = "nfs";
|
||||||
|
o = "addr=terra1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime";
|
||||||
|
device = ":/mnt/Data/apps/bigbox/dockge/stacks";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services.displayManager.defaultSession = "gnome";
|
services.displayManager.defaultSession = "gnome";
|
||||||
services.displayManager.gdm.enable = false;
|
services.displayManager.gdm.enable = false;
|
||||||
|
|
||||||
|
|||||||
@@ -21,41 +21,6 @@
|
|||||||
# Disable firewall
|
# Disable firewall
|
||||||
networking.firewall.enable = false;
|
networking.firewall.enable = false;
|
||||||
|
|
||||||
# NFS Docker volumes for dockge
|
|
||||||
# system.activationScripts.dockge-create-volume-stacks = {
|
|
||||||
# text = ''
|
|
||||||
# ${pkgs.docker}/bin/docker volume create \
|
|
||||||
# --driver local \
|
|
||||||
# --opt type=nfs \
|
|
||||||
# --opt o=addr=terra1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime \
|
|
||||||
# --opt device=:/mnt/Data/apps/arrs/dockge/stacks \
|
|
||||||
# dockge-stacks
|
|
||||||
# '';
|
|
||||||
# deps = [ ];
|
|
||||||
# };
|
|
||||||
# system.activationScripts.dockge-create-volume-data = {
|
|
||||||
# text = ''
|
|
||||||
# ${pkgs.docker}/bin/docker volume create \
|
|
||||||
# --driver local \
|
|
||||||
# --opt type=nfs \
|
|
||||||
# --opt o=addr=terra1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime \
|
|
||||||
# --opt device=:/mnt/Data/apps/arrs/dockge/data \
|
|
||||||
# dockge-data
|
|
||||||
# '';
|
|
||||||
# deps = [ ];
|
|
||||||
# };
|
|
||||||
# system.activationScripts.scrypted-create-volume-nvr = {
|
|
||||||
# text = ''
|
|
||||||
# ${pkgs.docker}/bin/docker volume create \
|
|
||||||
# --driver local \
|
|
||||||
# --opt type=nfs \
|
|
||||||
# --opt o=addr=tnas1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime \
|
|
||||||
# --opt device=:/mnt/OneT/NVR \
|
|
||||||
# scrypted-nvr
|
|
||||||
# '';
|
|
||||||
# deps = [ ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
# Dockge container service group
|
# Dockge container service group
|
||||||
skyg.nixos.common.container-services.dockge = {
|
skyg.nixos.common.container-services.dockge = {
|
||||||
services.dockge = {
|
services.dockge = {
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
./comfyui
|
./comfyui
|
||||||
./ds4.nix
|
./ds4.nix
|
||||||
./jellyfin.nix
|
./jellyfin.nix
|
||||||
./scrypted.nix
|
|
||||||
./dockge.nix
|
|
||||||
./signal-cli.nix
|
./signal-cli.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.skyg.nixos.server.services.dockge;
|
|
||||||
volumeOptions = with lib; mkOption {
|
|
||||||
type = types.submodule {
|
|
||||||
options = {
|
|
||||||
nfsServer = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
share = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
skyg.nixos.server.services.dockge = with lib; {
|
|
||||||
enable = mkEnableOption
|
|
||||||
"Enable Dockge";
|
|
||||||
openFirewall = mkOption {
|
|
||||||
description =
|
|
||||||
"Open ports in the firewall for the dockge web interface.";
|
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
port = mkOption {
|
|
||||||
description = "The TCP port dockge will listen on.";
|
|
||||||
default = 5001;
|
|
||||||
type = types.port;
|
|
||||||
};
|
|
||||||
volumes = mkOption {
|
|
||||||
type = types.submodule {
|
|
||||||
options = {
|
|
||||||
stacks = volumeOptions;
|
|
||||||
data = volumeOptions;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
networking.firewall =
|
|
||||||
lib.mkIf cfg.openFirewall {
|
|
||||||
allowedTCPPorts = [ cfg.port ];
|
|
||||||
allowedUDPPorts = [ cfg.port ];
|
|
||||||
};
|
|
||||||
system.activationScripts = {
|
|
||||||
dockge-create-volume-stacks = {
|
|
||||||
text = ''
|
|
||||||
${pkgs.docker}/bin/docker volume create \
|
|
||||||
--driver local \
|
|
||||||
--opt type=nfs \
|
|
||||||
--opt o=addr=${cfg.volumes.stacks.nfsServer},rw,nfsvers=4.0,nolock,hard,noatime \
|
|
||||||
--opt device=:${cfg.volumes.stacks.share} \
|
|
||||||
dockge-stacks
|
|
||||||
'';
|
|
||||||
deps = [ ];
|
|
||||||
};
|
|
||||||
dockge-create-volume-data = {
|
|
||||||
text = ''
|
|
||||||
${pkgs.docker}/bin/docker volume create \
|
|
||||||
--driver local \
|
|
||||||
--opt type=nfs \
|
|
||||||
--opt o=addr=${cfg.volumes.data.nfsServer},rw,nfsvers=4.0,nolock,hard,noatime \
|
|
||||||
--opt device=:${cfg.volumes.data.share} \
|
|
||||||
dockge-data
|
|
||||||
'';
|
|
||||||
deps = [ ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
virtualisation.oci-containers = {
|
|
||||||
containers = {
|
|
||||||
dockge = {
|
|
||||||
autoStart = true;
|
|
||||||
image = "louislam/dockge:1";
|
|
||||||
ports = [
|
|
||||||
"${toString cfg.port}:5001"
|
|
||||||
];
|
|
||||||
volumes = [
|
|
||||||
"/var/run/docker.sock:/var/run/docker.sock"
|
|
||||||
''dockge-data:/app/data''
|
|
||||||
''dockge-stacks:/opt/stacks''
|
|
||||||
];
|
|
||||||
environment = {
|
|
||||||
DOCKGE_STACKS_DIR = "/opt/stacks";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.skyg.nixos.server.services.scrypted;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
skyg.nixos.server.services.scrypted = {
|
|
||||||
enable = lib.mkEnableOption
|
|
||||||
"Enable Scrypted";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
system.activationScripts = {
|
|
||||||
scrypted-create-volume-nvr = {
|
|
||||||
text = ''
|
|
||||||
${pkgs.docker}/bin/docker volume create \
|
|
||||||
--driver local \
|
|
||||||
--opt type=nfs \
|
|
||||||
--opt o=addr=tnas1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime \
|
|
||||||
--opt device=:/mnt/OneT/NVR \
|
|
||||||
scrypted-nvr
|
|
||||||
'';
|
|
||||||
deps = [ ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
skyg.server.timers = {
|
|
||||||
scrypted-backups = {
|
|
||||||
OnCalendar = "daily";
|
|
||||||
wantedBy = [
|
|
||||||
"homelab-terra1-Data-apps.mount"
|
|
||||||
];
|
|
||||||
script = ''
|
|
||||||
set -eu
|
|
||||||
${pkgs.rsync}/bin/rsync -avpzP --delete /opt/homelab/scrypted /homelab/terra1/Data/apps/
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
scrypted-autoupdate = {
|
|
||||||
OnCalendar = "weekly";
|
|
||||||
script = ''
|
|
||||||
set -eu
|
|
||||||
${pkgs.docker}/bin/docker pull ghcr.io/koush/scrypted
|
|
||||||
systemctl restart docker-scrypted.service
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
virtualisation.oci-containers = {
|
|
||||||
containers = {
|
|
||||||
scrypted = {
|
|
||||||
autoStart = true;
|
|
||||||
image = "ghcr.io/koush/scrypted";
|
|
||||||
extraOptions = [ "--network=host" ];
|
|
||||||
volumes = [
|
|
||||||
"/var/run/dbus:/var/run/dbus"
|
|
||||||
"/var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket"
|
|
||||||
"/opt/homelab/scrypted/db:/server/volume"
|
|
||||||
"scrypted-nvr:/nvr"
|
|
||||||
];
|
|
||||||
environment = {
|
|
||||||
SCRYPTED_NVR_VOLUME = "/nvr";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user