portainer management
This commit is contained in:
1 parent
2a2bdd0b4b
commit
c304803fda
9 files changed
+90
-51
No files matched your search
+23
-1
@@ -342,7 +342,12 @@ export def "skyg decrypt" [secret: string@secret-names] {
|
||||
}
|
||||
|
||||
# Encrypt a file to secrets/ folder (re-encrypts using agenix)
|
||||
export def "skyg encrypt" [secret: string@secret-names, source?: string] {
|
||||
# --yaml Validate the content as YAML (via yq) before encrypting
|
||||
export def "skyg encrypt" [
|
||||
secret: string@secret-names,
|
||||
source?: string,
|
||||
--yaml # Validate the content as YAML (via yq) before encrypting
|
||||
] {
|
||||
cd $REPO_ROOT
|
||||
let src = $source | default $".tmp/unencrypted-($secret)"
|
||||
if not ($src | path exists) {
|
||||
@@ -354,6 +359,23 @@ export def "skyg encrypt" [secret: string@secret-names, source?: string] {
|
||||
}
|
||||
}
|
||||
vi $src
|
||||
|
||||
if $yaml {
|
||||
# `complete` captures stdout/stderr/exit_code; `try/catch` guards a missing yq
|
||||
let lint = (try { yq e '.' $src | complete } catch { null })
|
||||
if $lint == null {
|
||||
print $"❌ Could not run yq — is it on PATH? Add 'yq' to the devShell in flake.nix."
|
||||
return
|
||||
}
|
||||
if $lint.exit_code != 0 {
|
||||
print $"❌ YAML validation failed for ($src):"
|
||||
print ($lint.stderr | str trim)
|
||||
print $"Fix the syntax, then re-run: skyg encrypt ($secret) --yaml"
|
||||
return
|
||||
}
|
||||
print $"✅ YAML valid: ($src)"
|
||||
}
|
||||
|
||||
let dest = $"secrets/($secret).age"
|
||||
cat $src | EDITOR="cp /dev/stdin" agenix -e $dest
|
||||
print $"Encrypted ($dest)"
|
||||
|
||||
@@ -7,7 +7,7 @@ hl.animation({
|
||||
leaf = "workspaces",
|
||||
enabled = true,
|
||||
speed = 2,
|
||||
bezier = "wsslide",
|
||||
bezier = "default",
|
||||
style = "slidevert",
|
||||
})
|
||||
|
||||
|
||||
+24
-1
@@ -40,7 +40,30 @@
|
||||
networkDrives.enable = true;
|
||||
};
|
||||
|
||||
# Dockge container service group
|
||||
# Portainer Agent
|
||||
age.secrets.portainer-agent-bigbox1.file = ../secrets/portainer-agent-bigbox1.age;
|
||||
skyg.nixos.common.container-services.portainer-agent = {
|
||||
enable = true;
|
||||
autoUpdate.enable = true;
|
||||
services.agent = {
|
||||
image = "portainer/agent:2.45.0";
|
||||
volumes = [
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
"/var/lib/docker/volumes:/var/lib/docker/volumes"
|
||||
"portainer_agent_data:/data"
|
||||
];
|
||||
environmentFiles = [ config.age.secrets.portainer-agent-bigbox1.path ];
|
||||
environment = {
|
||||
EDGE_INSECURE_POLL = "1";
|
||||
EDGE = "1";
|
||||
};
|
||||
};
|
||||
volumes.portainer_agent_data = {
|
||||
name = "portainer_data";
|
||||
};
|
||||
};
|
||||
|
||||
# Jellyfin container service group
|
||||
skyg.nixos.common.container-services.jellyfin = {
|
||||
enable = true;
|
||||
autoUpdate.enable = true;
|
||||
|
||||
+22
-33
@@ -21,39 +21,6 @@
|
||||
# Disable firewall
|
||||
networking.firewall.enable = false;
|
||||
|
||||
# Dockge container service group
|
||||
skyg.nixos.common.container-services.dockge = {
|
||||
enable = true;
|
||||
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";
|
||||
};
|
||||
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/arrs/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/arrs/dockge/stacks";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Scrypted container service group
|
||||
skyg.nixos.common.container-services.scrypted = {
|
||||
enable = true;
|
||||
@@ -93,6 +60,28 @@
|
||||
};
|
||||
};
|
||||
|
||||
# Portainer Service
|
||||
skyg.nixos.common.container-services.portainer = {
|
||||
enable = true;
|
||||
autoUpdate.enable = true;
|
||||
services.portainer = {
|
||||
image = "portainer/portainer-ce:lts";
|
||||
volumes = [
|
||||
"/var/run/docker.sock:/var/run/docker.sock"
|
||||
"portainer_data:/data"
|
||||
];
|
||||
ports = [
|
||||
"9443:9443"
|
||||
"8000:8000"
|
||||
];
|
||||
};
|
||||
volumes = {
|
||||
portainer_data = {
|
||||
name = "portainer_data";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
age.secrets.stack1.file = ../secrets/stack1.age;
|
||||
skyg.nixos.common.container-services.stack1 = {
|
||||
enable = true;
|
||||
|
||||
@@ -8,8 +8,7 @@ How to add and modify homelab server roles/services. Read alongside the repo-roo
|
||||
## Anatomy of a service module
|
||||
|
||||
Most files here follow the same shape. When adding a new service, mirror an existing one
|
||||
(`jellyfin.nix` for a simple native service, `dockge.nix`/`scrypted.nix` for containerized
|
||||
NFS-backed services):
|
||||
(`jellyfin.nix` for a simple native service):
|
||||
|
||||
```nix
|
||||
{ config, lib, pkgs, ... }:
|
||||
@@ -41,7 +40,7 @@ Then add it to `services/default.nix`'s `imports` list (and to the `services/ABO
|
||||
choice from `modules/nixos/common/containers/`. Don't hardcode `docker run` in a service
|
||||
(the `openwrt` deploy script is the only sanctioned shell-out, and it lives elsewhere).
|
||||
5. **NFS-backed volumes**: create them with `system.activationScripts` + `docker volume
|
||||
create --driver local --opt type=nfs` (see `dockge.nix`), and reference homelab hosts by
|
||||
create --driver local --opt type=nfs`, and reference homelab hosts by
|
||||
their `*.lab.internal` names.
|
||||
6. **Scheduled jobs** (backups, auto-updates) should use the `skyg.server.timers.<name>`
|
||||
helper in `timers.nix` rather than hand-writing `systemd.timers`/`systemd.services`.
|
||||
|
||||
@@ -13,8 +13,6 @@ services/
|
||||
├── ai-services.nix # skyg.nixos.server.services.ai — ollama + Wyoming (whisper/piper/wake)
|
||||
├── audiobookshelf.nix # skyg.nixos.server.services.audiobookshelf — audiobook/podcast server
|
||||
├── jellyfin.nix # skyg.nixos.server.services.jellyfin — media server (uid/gid 7777)
|
||||
├── scrypted.nix # skyg.nixos.server.services.scrypted — NVR (host net, NFS NVR volume)
|
||||
├── dockge.nix # skyg.nixos.server.services.dockge — compose stack manager (NFS volumes)
|
||||
├── signal-cli.nix # skyg.nixos.server.services.signal-cli — signal-cli HTTP daemon (Hermes Signal bridge)
|
||||
├── openclaw.nix # skyg.nixos.server.services.openclaw — AI gateway (NOT imported by default)
|
||||
├── colibri.nix # skyg.nixos.server.services.colibri — coli serve HTTP API (GLM-5.2/OLMoE local inference)
|
||||
@@ -25,8 +23,6 @@ services/
|
||||
|
||||
- **`ai-services.nix`** runs ollama (GPU-passthrough) and openwakeword as containers and
|
||||
enables NixOS-native Wyoming faster-whisper + piper. Opens 11434/10200/10300/10400.
|
||||
- **`dockge.nix` / `scrypted.nix`** create NFS-backed docker volumes via
|
||||
`system.activationScripts` and use `skyg.server.timers` for backups/auto-updates.
|
||||
- **`openclaw.nix`** is a native systemd service (with agenix-token support and security
|
||||
hardening). Note: it is **not** listed in `default.nix`'s imports, so it must be imported
|
||||
explicitly if used.
|
||||
@@ -42,7 +38,6 @@ skyg.nixos.server.services.ai.enable
|
||||
skyg.nixos.server.services.audiobookshelf.{enable,package,configDir,dataDir}
|
||||
skyg.nixos.server.services.jellyfin.enable
|
||||
skyg.nixos.server.services.scrypted.enable
|
||||
skyg.nixos.server.services.dockge.{enable,openFirewall,port,volumes}
|
||||
skyg.nixos.server.services.signal-cli.{enable,host,port,configDir,account,environmentFile,openFirewall}
|
||||
skyg.nixos.server.services.openclaw.{enable,port,gatewayToken,...}
|
||||
skyg.nixos.server.services.colibri.{enable,package,model,host,port,environmentFile,openFirewall,...}
|
||||
|
||||
@@ -24,13 +24,13 @@ in
|
||||
networking.firewall.allowedTCPPorts = openPorts;
|
||||
virtualisation.oci-containers = {
|
||||
containers = {
|
||||
ollama = {
|
||||
autoStart = true;
|
||||
image = "ollama/ollama";
|
||||
extraOptions = [ "--device=nvidia.com/gpu=all" ];
|
||||
ports = [ "11434:11434" ];
|
||||
volumes = [ "ollama:/root/.ollama" ];
|
||||
};
|
||||
# ollama = {
|
||||
# autoStart = true;
|
||||
# image = "ollama/ollama";
|
||||
# extraOptions = [ "--device=nvidia.com/gpu=all" ];
|
||||
# ports = [ "11434:11434" ];
|
||||
# volumes = [ "ollama:/root/.ollama" ];
|
||||
# };
|
||||
openwakeword = {
|
||||
autoStart = true;
|
||||
image = "rhasspy/wyoming-openwakeword";
|
||||
|
||||
@@ -5,6 +5,7 @@ let
|
||||
minipc3 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEbvoe/UvhpRSWVXMCyj/qzuR7WnJdNF7CYRmmJE3yYu root@minisf1";
|
||||
terra1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHBKI8gqd7DDubShle4D3JGq61BP1NBKCZ81V3C9uyym root@nixos";
|
||||
fwdesk = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHbBcdMpNPaELUzHRIoRkTUQde+mBQ87Ra2R+974FuUy root@hl-fwdesk";
|
||||
bigbox1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFl5xiH4aFlmDWdoU+KmERLYOeOQK2aKP7jenY2G3rFb root@nixos";
|
||||
in
|
||||
{
|
||||
"secrets/dns-addresses.conf.age".publicKeys = [
|
||||
@@ -27,4 +28,7 @@ in
|
||||
# stack compose definition — minipc2
|
||||
"secrets/stack1.age".publicKeys = [ ari minipc2 ];
|
||||
"secrets/stack2.age".publicKeys = [ ari minipc2 ];
|
||||
|
||||
# portainer agent envs
|
||||
"secrets/portainer-agent-bigbox1.age".publicKeys = [ ari bigbox1 ];
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
age-encryption.org/v1
|
||||
-> ssh-ed25519 CIR0mA ejMujwOJsTCetZVSW14Xs0UiwBph7jDkOr5MyFZNWCE
|
||||
7L6UzE9GL91fMb9+vbcOSxbQaRaNoy203xk6mfb2Q9k
|
||||
-> ssh-ed25519 GhpmGA M6RvOGEKR5FrmnTendSchjzToxtNxuwR09+PAuP7mg4
|
||||
1FVS0e4B7NeLWZueBQSAQkEJcuqRQbEKNOmj+JjQKzQ
|
||||
--- jC5qDXTdBrHZGCTQ9Dn8aZ4p8PNzBuSKsI10YSqclj4
|
||||
i¬/t#è©¥+54!x+lüÌãÄ໯”ãý‰h�¯¬ŽXV,/aQnØ,(KÝ…láÐýÛ™Lqmó¢É‰�B/j„<× ë¿Ëé>h¢™Ú)†m9n+yñÑЈ(µ³×8�ªNýI„ÔZ"m”`:¦½”Œ[_‡N³Æô~òü*P4B›°2.ÕR\à8Ò�÷Ê%WŽd␍Ïúø`DéNÁÚâ3€Nîßµ¥{ �8AË&;æ÷ЗÎû�8ïG¦õ&W7¦E,H*‰Yfm%—|›RxdºwÖ´¯1
|
||||
Reference in new issue
Block a user