chore(core): scrub personal domain/username literals and enforce pyright in flake checks
Core Architecture & Invariant CI / validate (pull_request) Failing after 1m16s
Core Architecture & Invariant CI / validate (pull_request) Failing after 1m16s
This commit is contained in:
1 parent
53404914c3
commit
8cc06e2470
15 files changed
+127
-75
No files matched your search
+11
-1
@@ -21,7 +21,17 @@ else
|
|||||||
echo "⚠️ [pre-commit] Neither ruff nor nix found; skipping ruff"
|
echo "⚠️ [pre-commit] Neither ruff nor nix found; skipping ruff"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 2. Run Pytest Suite
|
# 2. Run Pyright Type Checker
|
||||||
|
echo " ↳ Checking static types with Pyright..."
|
||||||
|
if command -v pyright >/dev/null 2>&1; then
|
||||||
|
pyright
|
||||||
|
elif command -v nix >/dev/null 2>&1 && [ -f flake.nix ]; then
|
||||||
|
nix develop --command pyright
|
||||||
|
else
|
||||||
|
echo "⚠️ [pre-commit] Neither pyright nor nix found; skipping pyright"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Run Pytest Suite
|
||||||
echo " ↳ Running structural and security test suite with Pytest..."
|
echo " ↳ Running structural and security test suite with Pytest..."
|
||||||
if [ -x ".venv/bin/pytest" ]; then
|
if [ -x ".venv/bin/pytest" ]; then
|
||||||
.venv/bin/pytest tests/
|
.venv/bin/pytest tests/
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ authentication_backend:
|
|||||||
address: 'ldap://lldap:3890'
|
address: 'ldap://lldap:3890'
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
start_tls: false
|
start_tls: false
|
||||||
base_dn: 'dc=roadtotech,dc=me'
|
base_dn: '{{ env "LLDAP_LDAP_BASE_DN" "dc=example,dc=test" }}'
|
||||||
additional_users_dn: 'ou=people'
|
additional_users_dn: 'ou=people'
|
||||||
users_filter: '(&({username_attribute}={input})(objectClass=person))'
|
users_filter: '(&({username_attribute}={input})(objectClass=person))'
|
||||||
additional_groups_dn: 'ou=groups'
|
additional_groups_dn: 'ou=groups'
|
||||||
@@ -24,7 +24,7 @@ authentication_backend:
|
|||||||
display_name: 'displayName'
|
display_name: 'displayName'
|
||||||
mail: 'mail'
|
mail: 'mail'
|
||||||
group_name: 'cn'
|
group_name: 'cn'
|
||||||
user: 'uid=admin,ou=people,dc=roadtotech,dc=me'
|
user: 'uid=admin,ou=people,{{ env "LLDAP_LDAP_BASE_DN" "dc=example,dc=test" }}'
|
||||||
|
|
||||||
access_control:
|
access_control:
|
||||||
default_policy: deny
|
default_policy: deny
|
||||||
|
|||||||
+10
-10
@@ -6,48 +6,48 @@
|
|||||||
schemaVersion: "1.0"
|
schemaVersion: "1.0"
|
||||||
repositories:
|
repositories:
|
||||||
snappymail:
|
snappymail:
|
||||||
path: "/home/kiskaadee/Sites/snappymail"
|
path: "~/Sites/snappymail"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-snappymail"
|
- "homelab-snappymail"
|
||||||
- "mail"
|
- "mail"
|
||||||
- "webmail"
|
- "webmail"
|
||||||
gitea:
|
gitea:
|
||||||
path: "/home/kiskaadee/Sites/homelab-gitea"
|
path: "~/Sites/homelab-gitea"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-gitea"
|
- "homelab-gitea"
|
||||||
- "git"
|
- "git"
|
||||||
jellyfin:
|
jellyfin:
|
||||||
path: "/home/kiskaadee/Sites/homelab-jellyfin"
|
path: "~/Sites/homelab-jellyfin"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-jellyfin"
|
- "homelab-jellyfin"
|
||||||
- "media"
|
- "media"
|
||||||
docs:
|
docs:
|
||||||
path: "/home/kiskaadee/Sites/homelab-doc2site"
|
path: "~/Sites/homelab-doc2site"
|
||||||
aliases:
|
aliases:
|
||||||
- "doc2site"
|
- "doc2site"
|
||||||
- "homelab-doc2site"
|
- "homelab-doc2site"
|
||||||
courses:
|
courses:
|
||||||
path: "/home/kiskaadee/Sites/courses"
|
path: "~/Sites/courses"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-courses"
|
- "homelab-courses"
|
||||||
bdinvite:
|
bdinvite:
|
||||||
path: "/home/kiskaadee/Sites/homelab-bdinvite"
|
path: "~/Sites/homelab-bdinvite"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-bdinvite"
|
- "homelab-bdinvite"
|
||||||
- "birthday"
|
- "birthday"
|
||||||
landing:
|
landing:
|
||||||
path: "/home/kiskaadee/Sites/homelab-landing"
|
path: "~/Sites/homelab-landing"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-landing"
|
- "homelab-landing"
|
||||||
mermaid:
|
mermaid:
|
||||||
path: "/home/kiskaadee/Sites/homelab-mermaid"
|
path: "~/Sites/homelab-mermaid"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-mermaid"
|
- "homelab-mermaid"
|
||||||
excalidraw:
|
excalidraw:
|
||||||
path: "/home/kiskaadee/Sites/homelab-excalidraw"
|
path: "~/Sites/homelab-excalidraw"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-excalidraw"
|
- "homelab-excalidraw"
|
||||||
houston:
|
houston:
|
||||||
path: "/home/kiskaadee/Sites/homelab-houston"
|
path: "~/Sites/homelab-houston"
|
||||||
aliases:
|
aliases:
|
||||||
- "homelab-houston"
|
- "homelab-houston"
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
- My Projects:
|
- My Projects:
|
||||||
- Github:
|
- Github:
|
||||||
- abbr: GH
|
- abbr: GH
|
||||||
href: https://github.com/kiskaadee?tab=repositories
|
href: https://github.com
|
||||||
|
|
||||||
- Social Media:
|
- Social Media:
|
||||||
- Instagram:
|
- Instagram:
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
- Knowledge & Notes:
|
- Knowledge & Notes:
|
||||||
- Docs-Viewer:
|
- Docs-Viewer:
|
||||||
icon: files.png
|
icon: files.png
|
||||||
href: https://docs.roadtotech.me
|
href: https://docs.example.test
|
||||||
description: Reactive Obsidian & Markdown Documentation Viewer
|
description: Reactive Obsidian & Markdown Documentation Viewer
|
||||||
server: my-docker
|
server: my-docker
|
||||||
container: docs
|
container: docs
|
||||||
- Excalidraw:
|
- Excalidraw:
|
||||||
icon: excalidraw.png
|
icon: excalidraw.png
|
||||||
href: https://excalidraw.roadtotech.me
|
href: https://excalidraw.example.test
|
||||||
description: Collaborative Whiteboarding & Sketching Tool
|
description: Collaborative Whiteboarding & Sketching Tool
|
||||||
server: my-docker
|
server: my-docker
|
||||||
container: excalidraw
|
container: excalidraw
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
- Media & Productivity:
|
- Media & Productivity:
|
||||||
- Jellyfin:
|
- Jellyfin:
|
||||||
icon: jellyfin.png
|
icon: jellyfin.png
|
||||||
href: https://jellyfin.roadtotech.me
|
href: https://jellyfin.example.test
|
||||||
description: Media Server & Streaming Hub
|
description: Media Server & Streaming Hub
|
||||||
server: my-docker
|
server: my-docker
|
||||||
container: jellyfin
|
container: jellyfin
|
||||||
+5
-5
@@ -106,11 +106,11 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- TZ=America/Bogota
|
- TZ=America/Bogota
|
||||||
- LLDAP_HTTP_URL=https://users.${DOMAIN}
|
- LLDAP_HTTP_URL=https://users.${DOMAIN}
|
||||||
- LLDAP_LDAP_BASE_DN=dc=roadtotech,dc=me
|
- LLDAP_LDAP_BASE_DN=${LLDAP_LDAP_BASE_DN:-dc=example,dc=test}
|
||||||
- LLDAP_JWT_SECRET=${LLDAP_JWT_SECRET}
|
- LLDAP_JWT_SECRET=${LLDAP_JWT_SECRET}
|
||||||
- LLDAP_KEY_SEED=${LLDAP_KEY_SEED}
|
- LLDAP_KEY_SEED=${LLDAP_KEY_SEED}
|
||||||
- LLDAP_LDAP_USER_PASS=${LLDAP_LDAP_USER_PASS}
|
- LLDAP_LDAP_USER_PASS=${LLDAP_LDAP_USER_PASS}
|
||||||
- LLDAP_LDAP_USER_EMAIL=admin@${DOMAIN:-roadtotech.me}
|
- LLDAP_LDAP_USER_EMAIL=${LLDAP_ADMIN_EMAIL:-admin@${DOMAIN:-example.test}}
|
||||||
- LLDAP_DATABASE_URL=sqlite:///data/users.db?mode=rwc
|
- LLDAP_DATABASE_URL=sqlite:///data/users.db?mode=rwc
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/lldap/data:/data
|
- ./config/lldap/data:/data
|
||||||
@@ -222,12 +222,12 @@ services:
|
|||||||
- DIUN_PROVIDERS_DOCKER_APIVERSION=${DOCKER_API_VERSION:-1.40}
|
- DIUN_PROVIDERS_DOCKER_APIVERSION=${DOCKER_API_VERSION:-1.40}
|
||||||
- DIUN_NOTIF_MAIL_HOST=stalwart
|
- DIUN_NOTIF_MAIL_HOST=stalwart
|
||||||
- DIUN_NOTIF_MAIL_PORT=465
|
- DIUN_NOTIF_MAIL_PORT=465
|
||||||
- DIUN_NOTIF_MAIL_USERNAME=notifier@${DOMAIN:-roadtotech.me}
|
- DIUN_NOTIF_MAIL_USERNAME=${DIUN_NOTIF_MAIL_USERNAME:-notifier@${DOMAIN:-example.test}}
|
||||||
- DIUN_NOTIF_MAIL_PASSWORD=${DIUN_SMTP_PASSWORD}
|
- DIUN_NOTIF_MAIL_PASSWORD=${DIUN_SMTP_PASSWORD}
|
||||||
- DIUN_NOTIF_MAIL_SSL=true
|
- DIUN_NOTIF_MAIL_SSL=true
|
||||||
- DIUN_NOTIF_MAIL_INSECURESKIPVERIFY=true
|
- DIUN_NOTIF_MAIL_INSECURESKIPVERIFY=true
|
||||||
- DIUN_NOTIF_MAIL_FROM=notifier@${DOMAIN:-roadtotech.me}
|
- DIUN_NOTIF_MAIL_FROM=${DIUN_NOTIF_MAIL_FROM:-notifier@${DOMAIN:-example.test}}
|
||||||
- DIUN_NOTIF_MAIL_TO=kiskaadee@${DOMAIN:-roadtotech.me}
|
- DIUN_NOTIF_MAIL_TO=${DIUN_NOTIF_MAIL_TO:-operator@${DOMAIN:-example.test}}
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/diun:/data
|
- ./config/diun:/data
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
git
|
git
|
||||||
pythonEnv
|
pythonEnv
|
||||||
ruff
|
ruff
|
||||||
|
pyright
|
||||||
];
|
];
|
||||||
} ''
|
} ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
@@ -59,6 +60,7 @@
|
|||||||
chmod -R u+w source
|
chmod -R u+w source
|
||||||
cd source
|
cd source
|
||||||
HOME=/tmp ruff check --no-cache .
|
HOME=/tmp ruff check --no-cache .
|
||||||
|
HOME=/tmp pyright
|
||||||
HOME=/tmp pytest -o cache_dir=/tmp/.pytest_cache tests/
|
HOME=/tmp pytest -o cache_dir=/tmp/.pytest_cache tests/
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# 🌐 Server NixOS Configuration — Turnkey Headless Homelab Appliance
|
# 🌐 Server NixOS Configuration — Turnkey Headless Homelab Appliance
|
||||||
# Standalone declarative configuration for the roadtotech.me homelab server.
|
# Standalone declarative configuration for the homelab server.
|
||||||
# No Home Manager. No shared desktop modules.
|
# No Home Manager. No shared desktop modules.
|
||||||
# Goal: wipe & restore from any NixOS installation via `nixos-install --flake ~/Core#server`
|
# Goal: wipe & restore from any NixOS installation via `nixos-install --flake ~/Core#server`
|
||||||
|
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
./modules/shell.nix # Declarative bash environment for the server
|
./modules/shell.nix # Declarative bash environment for the server
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# ── Homelab platform settings ────────────────────────────────────────────────
|
||||||
|
homelab.operatorUser = "kiskaadee";
|
||||||
|
|
||||||
# ── SOPS secrets configuration ──────────────────────────────────────────────
|
# ── SOPS secrets configuration ──────────────────────────────────────────────
|
||||||
# Set once here to avoid duplicate-option conflicts across submodules
|
# Set once here to avoid duplicate-option conflicts across submodules
|
||||||
sops.defaultSopsFile = ./secrets.yaml;
|
sops.defaultSopsFile = ./secrets.yaml;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ in
|
|||||||
sops.secrets."dynu/domain" = { };
|
sops.secrets."dynu/domain" = { };
|
||||||
sops.secrets."dynu/password" = { };
|
sops.secrets."dynu/password" = { };
|
||||||
sops.secrets."system/pdf_decrypt_password" = {
|
sops.secrets."system/pdf_decrypt_password" = {
|
||||||
owner = "kiskaadee";
|
owner = config.homelab.operatorUser;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Assemble the ddclient config file securely at boot time in /run/secrets/
|
# Assemble the ddclient config file securely at boot time in /run/secrets/
|
||||||
|
|||||||
@@ -4,6 +4,31 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# Declarative configuration options for Homelab Core
|
||||||
|
options.homelab = {
|
||||||
|
domain = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "example.test";
|
||||||
|
description = "Canonical domain for homelab services";
|
||||||
|
};
|
||||||
|
operatorUser = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "operator";
|
||||||
|
description = "Primary operator user identity";
|
||||||
|
};
|
||||||
|
coreDir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/home/${config.homelab.operatorUser}/Core";
|
||||||
|
description = "Path to Homelab Core repository";
|
||||||
|
};
|
||||||
|
sitesDir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/home/${config.homelab.operatorUser}/Sites";
|
||||||
|
description = "Path to Sites directory";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
# Define the keys to decrypt from secrets.yaml
|
# Define the keys to decrypt from secrets.yaml
|
||||||
sops.secrets = lib.genAttrs [
|
sops.secrets = lib.genAttrs [
|
||||||
"dynu/api_key"
|
"dynu/api_key"
|
||||||
@@ -18,13 +43,13 @@
|
|||||||
"brevo/smtp_login"
|
"brevo/smtp_login"
|
||||||
"brevo/smtp_key"
|
"brevo/smtp_key"
|
||||||
"diun/smtp_password"
|
"diun/smtp_password"
|
||||||
] (name: { owner = "kiskaadee"; });
|
] (name: { owner = config.homelab.operatorUser; });
|
||||||
|
|
||||||
# Generate the unified environment file at runtime in /run/secrets/homeserver.env
|
# Generate the unified environment file at runtime in /run/secrets/homeserver.env
|
||||||
sops.templates."homeserver.env" = {
|
sops.templates."homeserver.env" = {
|
||||||
owner = "kiskaadee";
|
owner = config.homelab.operatorUser;
|
||||||
content = lib.generators.toKeyValue {} {
|
content = lib.generators.toKeyValue {} {
|
||||||
DOMAIN = "roadtotech.me";
|
DOMAIN = config.homelab.domain;
|
||||||
DOCKER_API_VERSION = "1.40";
|
DOCKER_API_VERSION = "1.40";
|
||||||
DYNU_API_KEY = config.sops.placeholder."dynu/api_key";
|
DYNU_API_KEY = config.sops.placeholder."dynu/api_key";
|
||||||
ACME_EMAIL = config.sops.placeholder."traefik/acme_email";
|
ACME_EMAIL = config.sops.placeholder."traefik/acme_email";
|
||||||
@@ -53,7 +78,7 @@
|
|||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
WorkingDirectory = "/home/kiskaadee/Core";
|
WorkingDirectory = config.homelab.coreDir;
|
||||||
ExecStart = "${pkgs.docker-compose}/bin/docker-compose --env-file ${config.sops.templates."homeserver.env".path} up -d --remove-orphans";
|
ExecStart = "${pkgs.docker-compose}/bin/docker-compose --env-file ${config.sops.templates."homeserver.env".path} up -d --remove-orphans";
|
||||||
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
|
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
|
||||||
};
|
};
|
||||||
@@ -78,24 +103,24 @@
|
|||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
GITOPS_SECRET_FILE = config.sops.secrets."gitops/webhook_secret".path;
|
GITOPS_SECRET_FILE = config.sops.secrets."gitops/webhook_secret".path;
|
||||||
DOCKER_CONFIG = "/home/kiskaadee/.local/state/homelab/docker";
|
DOCKER_CONFIG = "/home/${config.homelab.operatorUser}/.local/state/homelab/docker";
|
||||||
};
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = "kiskaadee";
|
User = config.homelab.operatorUser;
|
||||||
SupplementaryGroups = [ "docker" ];
|
SupplementaryGroups = [ "docker" ];
|
||||||
WorkingDirectory = "/home/kiskaadee/Core";
|
WorkingDirectory = config.homelab.coreDir;
|
||||||
ExecStart = "${pkgs.webhook}/bin/webhook -hooks ${pkgs.writeText "hooks.json" (builtins.toJSON [
|
ExecStart = "${pkgs.webhook}/bin/webhook -hooks ${pkgs.writeText "hooks.json" (builtins.toJSON [
|
||||||
{
|
{
|
||||||
id = "deploy";
|
id = "deploy";
|
||||||
execute-command = "/home/kiskaadee/Core/scripts/gitops_dispatcher.py";
|
execute-command = "${config.homelab.coreDir}/scripts/gitops_dispatcher.py";
|
||||||
pass-arguments-to-command = [
|
pass-arguments-to-command = [
|
||||||
{ source = "raw-request-body"; }
|
{ source = "raw-request-body"; }
|
||||||
{ source = "header"; name = "X-Gitea-Signature"; }
|
{ source = "header"; name = "X-Gitea-Signature"; }
|
||||||
{ source = "header"; name = "X-Gitea-Event"; }
|
{ source = "header"; name = "X-Gitea-Event"; }
|
||||||
];
|
];
|
||||||
command-working-directory = "/home/kiskaadee/Core";
|
command-working-directory = config.homelab.coreDir;
|
||||||
response-message = "Deployment payload dispatched successfully.";
|
response-message = "Deployment payload dispatched successfully.";
|
||||||
}
|
}
|
||||||
])} -port 9000 -verbose";
|
])} -port 9000 -verbose";
|
||||||
@@ -110,8 +135,8 @@
|
|||||||
ProtectKernelTunables = true;
|
ProtectKernelTunables = true;
|
||||||
ProtectControlGroups = true;
|
ProtectControlGroups = true;
|
||||||
ReadWritePaths = [
|
ReadWritePaths = [
|
||||||
"/home/kiskaadee/Sites"
|
config.homelab.sitesDir
|
||||||
"/home/kiskaadee/.local/state/homelab"
|
"/home/${config.homelab.operatorUser}/.local/state/homelab"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -149,10 +174,10 @@
|
|||||||
APPCTL_AUDIT_LOG = "/var/log/homelab/appctl/audit.jsonl";
|
APPCTL_AUDIT_LOG = "/var/log/homelab/appctl/audit.jsonl";
|
||||||
APPCTL_LOCK_DIR = "/var/lib/homelab/appctl/locks";
|
APPCTL_LOCK_DIR = "/var/lib/homelab/appctl/locks";
|
||||||
APPCTL_TOKENS_FILE = "/run/secrets/appctl/tokens.json";
|
APPCTL_TOKENS_FILE = "/run/secrets/appctl/tokens.json";
|
||||||
SITES_DIR = "/home/kiskaadee/Sites";
|
SITES_DIR = config.homelab.sitesDir;
|
||||||
CORE_DIR = "/home/kiskaadee/Core";
|
CORE_DIR = config.homelab.coreDir;
|
||||||
HOMELAB_CONFIG_DIR = "/home/kiskaadee/.config/homelab";
|
HOMELAB_CONFIG_DIR = "/home/${config.homelab.operatorUser}/.config/homelab";
|
||||||
HOMELAB_DEPLOYMENTS_FILE = "/home/kiskaadee/Core/config/deployments.yaml";
|
HOMELAB_DEPLOYMENTS_FILE = "${config.homelab.coreDir}/config/deployments.yaml";
|
||||||
};
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
@@ -160,8 +185,8 @@
|
|||||||
User = "homelab-appctl";
|
User = "homelab-appctl";
|
||||||
Group = "homelab-operators";
|
Group = "homelab-operators";
|
||||||
SupplementaryGroups = [ "docker" ];
|
SupplementaryGroups = [ "docker" ];
|
||||||
WorkingDirectory = "/home/kiskaadee/Core";
|
WorkingDirectory = config.homelab.coreDir;
|
||||||
ExecStart = "${(pkgs.python3.withPackages (ps: with ps; [ pyyaml pydantic ]))}/bin/python3 /home/kiskaadee/Core/scripts/appctl_daemon.py";
|
ExecStart = "${(pkgs.python3.withPackages (ps: with ps; [ pyyaml pydantic ]))}/bin/python3 ${config.homelab.coreDir}/scripts/appctl_daemon.py";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = "5s";
|
RestartSec = "5s";
|
||||||
|
|
||||||
@@ -179,9 +204,9 @@
|
|||||||
ProtectKernelTunables = true;
|
ProtectKernelTunables = true;
|
||||||
ProtectControlGroups = true;
|
ProtectControlGroups = true;
|
||||||
ReadWritePaths = [
|
ReadWritePaths = [
|
||||||
"/home/kiskaadee/Sites"
|
config.homelab.sitesDir
|
||||||
"/home/kiskaadee/var/lib/homelab"
|
"/home/${config.homelab.operatorUser}/var/lib/homelab"
|
||||||
"/home/kiskaadee/Core/config/homepage"
|
"${config.homelab.coreDir}/config/homepage"
|
||||||
"/var/log/homelab/appctl"
|
"/var/log/homelab/appctl"
|
||||||
"/var/lib/homelab/appctl"
|
"/var/lib/homelab/appctl"
|
||||||
"/run/homelab"
|
"/run/homelab"
|
||||||
@@ -191,19 +216,20 @@
|
|||||||
|
|
||||||
# Ensure persistent directories have proper permissions for container runtimes
|
# Ensure persistent directories have proper permissions for container runtimes
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d /home/kiskaadee/Core/config/stalwart/data 0777 kiskaadee users -"
|
"d ${config.homelab.coreDir}/config/stalwart/data 0777 ${config.homelab.operatorUser} users -"
|
||||||
"d /home/kiskaadee/Core/config/stalwart/etc 0777 kiskaadee users -"
|
"d ${config.homelab.coreDir}/config/stalwart/etc 0777 ${config.homelab.operatorUser} users -"
|
||||||
"d /home/kiskaadee/Sites 0755 kiskaadee users -"
|
"d ${config.homelab.sitesDir} 0755 ${config.homelab.operatorUser} users -"
|
||||||
"d /home/kiskaadee/.local/state/homelab/gitops 0755 kiskaadee users -"
|
"d /home/${config.homelab.operatorUser}/.local/state/homelab/gitops 0755 ${config.homelab.operatorUser} users -"
|
||||||
"d /home/kiskaadee/.local/state/homelab/docker 0755 kiskaadee users -"
|
"d /home/${config.homelab.operatorUser}/.local/state/homelab/docker 0755 ${config.homelab.operatorUser} users -"
|
||||||
# POSIX ACLs granting homelab-appctl traverse and access to operator sites & homepage config
|
# POSIX ACLs granting homelab-appctl traverse and access to operator sites & homepage config
|
||||||
"a+ /home/kiskaadee - - - - u:homelab-appctl:x"
|
"a+ /home/${config.homelab.operatorUser} - - - - u:homelab-appctl:x"
|
||||||
"a+ /home/kiskaadee/Core - - - - u:homelab-appctl:x"
|
"a+ ${config.homelab.coreDir} - - - - u:homelab-appctl:x"
|
||||||
"a+ /home/kiskaadee/Sites - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
|
"a+ ${config.homelab.sitesDir} - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
|
||||||
"a+ /home/kiskaadee/var/lib/homelab - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
|
"a+ /home/${config.homelab.operatorUser}/var/lib/homelab - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
|
||||||
"a+ /home/kiskaadee/Core/config/homepage - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
|
"a+ ${config.homelab.coreDir}/config/homepage - - - - d:u:homelab-appctl:rwx,u:homelab-appctl:rwx"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Open ports in the firewall for Traefik, Gitea SSH, GitOps Webhook Receiver, and Mail (SMTP, Submission, SMTPS, IMAPS, ManageSieve)
|
# Open ports in the firewall for Traefik, Gitea SSH, GitOps Webhook Receiver, and Mail (SMTP, Submission, SMTPS, IMAPS, ManageSieve)
|
||||||
networking.firewall.allowedTCPPorts = [ 80 443 2223 9000 25 465 587 993 4190 ];
|
networking.firewall.allowedTCPPorts = [ 80 443 2223 9000 25 465 587 993 4190 ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -15,31 +15,31 @@
|
|||||||
"postgres/password"
|
"postgres/password"
|
||||||
"postgres/db"
|
"postgres/db"
|
||||||
"gitea/runner_token"
|
"gitea/runner_token"
|
||||||
] (name: { owner = "kiskaadee"; });
|
] (name: { owner = config.homelab.operatorUser; });
|
||||||
|
|
||||||
# Generate the unified environment file at runtime in /run/secrets/traefik-deployments.env
|
# Generate the unified environment file at runtime in /run/secrets/traefik-deployments.env
|
||||||
sops.templates."traefik-deployments.env" = {
|
sops.templates."traefik-deployments.env" = {
|
||||||
owner = "kiskaadee";
|
owner = config.homelab.operatorUser;
|
||||||
content = lib.generators.toKeyValue {} {
|
content = lib.generators.toKeyValue {} {
|
||||||
# --- Core / Infrastructure Settings ---
|
# --- Core / Infrastructure Settings ---
|
||||||
PROXY_NETWORK = "proxy-net";
|
PROXY_NETWORK = "proxy-net";
|
||||||
CERT_RESOLVER = "myresolver";
|
CERT_RESOLVER = "myresolver";
|
||||||
DOMAIN_SUFFIX = "roadtotech.me";
|
DOMAIN_SUFFIX = config.homelab.domain;
|
||||||
|
|
||||||
# --- Dashboard & Landing ---
|
# --- Dashboard & Landing ---
|
||||||
DASHBOARD_DOMAIN = "dashboard.roadtotech.me";
|
DASHBOARD_DOMAIN = "dashboard.${config.homelab.domain}";
|
||||||
LANDING_DOMAIN = "roadtotech.me";
|
LANDING_DOMAIN = config.homelab.domain;
|
||||||
|
|
||||||
# --- Docs ---
|
# --- Docs ---
|
||||||
DOCS_DOMAIN = "docs.roadtotech.me";
|
DOCS_DOMAIN = "docs.${config.homelab.domain}";
|
||||||
DOCS_PROJECT_PATH = "/home/kiskaadee/Brain";
|
DOCS_PROJECT_PATH = "/home/${config.homelab.operatorUser}/Brain";
|
||||||
|
|
||||||
# --- Excalidraw ---
|
# --- Excalidraw ---
|
||||||
EXCALIDRAW_DOMAIN = "excalidraw.roadtotech.me";
|
EXCALIDRAW_DOMAIN = "excalidraw.${config.homelab.domain}";
|
||||||
|
|
||||||
# --- Gitea ---
|
# --- Gitea ---
|
||||||
GITEA_DOMAIN = "gitea.roadtotech.me";
|
GITEA_DOMAIN = "gitea.${config.homelab.domain}";
|
||||||
GITEA_SSH_DOMAIN = "gitea.roadtotech.me";
|
GITEA_SSH_DOMAIN = "gitea.${config.homelab.domain}";
|
||||||
GITEA_SSH_PORT = "2223";
|
GITEA_SSH_PORT = "2223";
|
||||||
GITEA_AUTH_MIDDLEWARE = "https-redirect@docker";
|
GITEA_AUTH_MIDDLEWARE = "https-redirect@docker";
|
||||||
GITEA_RUNNER_TOKEN = config.sops.placeholder."gitea/runner_token";
|
GITEA_RUNNER_TOKEN = config.sops.placeholder."gitea/runner_token";
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
JELLYFIN_SERVICE_NAME = "jellyfin";
|
JELLYFIN_SERVICE_NAME = "jellyfin";
|
||||||
JELLYFIN_CONTAINER_NAME = "jellyfin";
|
JELLYFIN_CONTAINER_NAME = "jellyfin";
|
||||||
JELLYFIN_IMAGE_TAG = "latest";
|
JELLYFIN_IMAGE_TAG = "latest";
|
||||||
JELLYFIN_DOMAIN = "jellyfin.roadtotech.me";
|
JELLYFIN_DOMAIN = "jellyfin.${config.homelab.domain}";
|
||||||
JELLYFIN_TZ = "UTC";
|
JELLYFIN_TZ = "UTC";
|
||||||
JELLYFIN_PUID = "1000";
|
JELLYFIN_PUID = "1000";
|
||||||
JELLYFIN_PGID = "1000";
|
JELLYFIN_PGID = "1000";
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
# --- Learning Dashboard ---
|
# --- Learning Dashboard ---
|
||||||
LEARNING_SERVICE_NAME = "learning-hub";
|
LEARNING_SERVICE_NAME = "learning-hub";
|
||||||
LEARNING_DOMAIN = "learning.roadtotech.me";
|
LEARNING_DOMAIN = "learning.${config.homelab.domain}";
|
||||||
LEARNING_APP_PORT = "8000";
|
LEARNING_APP_PORT = "8000";
|
||||||
LEARNING_SOCKET_PROXY_NETWORK = "socket-net";
|
LEARNING_SOCKET_PROXY_NETWORK = "socket-net";
|
||||||
LEARNING_DOCKER_HOST = "tcp://socket-proxy:2375";
|
LEARNING_DOCKER_HOST = "tcp://socket-proxy:2375";
|
||||||
@@ -68,25 +68,25 @@
|
|||||||
TURSO_AUTH_TOKEN = config.sops.placeholder."learning/turso_auth_token";
|
TURSO_AUTH_TOKEN = config.sops.placeholder."learning/turso_auth_token";
|
||||||
|
|
||||||
# --- Mermaid ---
|
# --- Mermaid ---
|
||||||
MERMAID_DOMAIN = "mermaid.roadtotech.me";
|
MERMAID_DOMAIN = "mermaid.${config.homelab.domain}";
|
||||||
MERMAID_SERVICE_NAME = "mermaid";
|
MERMAID_SERVICE_NAME = "mermaid";
|
||||||
|
|
||||||
# --- Minecraft ---
|
# --- Minecraft ---
|
||||||
MINECRAFT_DOMAIN = "minecraft.roadtotech.me";
|
MINECRAFT_DOMAIN = "minecraft.${config.homelab.domain}";
|
||||||
|
|
||||||
# --- MongoDB ---
|
# --- MongoDB ---
|
||||||
MONGO_ROOT_USERNAME = config.sops.placeholder."mongo/root_username";
|
MONGO_ROOT_USERNAME = config.sops.placeholder."mongo/root_username";
|
||||||
MONGO_ROOT_PASSWORD = config.sops.placeholder."mongo/root_password";
|
MONGO_ROOT_PASSWORD = config.sops.placeholder."mongo/root_password";
|
||||||
MONGO_DOMAIN = "mongodb.roadtotech.me";
|
MONGO_DOMAIN = "mongodb.${config.homelab.domain}";
|
||||||
|
|
||||||
# --- PostgreSQL ---
|
# --- PostgreSQL ---
|
||||||
POSTGRES_USER = config.sops.placeholder."postgres/user";
|
POSTGRES_USER = config.sops.placeholder."postgres/user";
|
||||||
POSTGRES_PASSWORD = config.sops.placeholder."postgres/password";
|
POSTGRES_PASSWORD = config.sops.placeholder."postgres/password";
|
||||||
POSTGRES_DB = config.sops.placeholder."postgres/db";
|
POSTGRES_DB = config.sops.placeholder."postgres/db";
|
||||||
POSTGRES_DOMAIN = "pgsql.roadtotech.me";
|
POSTGRES_DOMAIN = "pgsql.${config.homelab.domain}";
|
||||||
|
|
||||||
# --- Ollama ---
|
# --- Ollama ---
|
||||||
OLLAMA_DOMAIN = "ollama.roadtotech.me";
|
OLLAMA_DOMAIN = "ollama.${config.homelab.domain}";
|
||||||
OLLAMA_API_KEY = config.sops.placeholder."ollama/api_key";
|
OLLAMA_API_KEY = config.sops.placeholder."ollama/api_key";
|
||||||
OLLAMA_REPLICAS = "1";
|
OLLAMA_REPLICAS = "1";
|
||||||
OLLAMA_DATA_VOLUME = "ollama_data";
|
OLLAMA_DATA_VOLUME = "ollama_data";
|
||||||
|
|||||||
@@ -285,6 +285,10 @@ def get_trusted_repository_mapping() -> dict[str, Path]:
|
|||||||
raw_path = entry.get("path")
|
raw_path = entry.get("path")
|
||||||
if not raw_path:
|
if not raw_path:
|
||||||
continue
|
continue
|
||||||
|
if raw_path.startswith("~/Sites/") or raw_path == "~/Sites":
|
||||||
|
sub = raw_path[len("~/Sites"):].lstrip("/")
|
||||||
|
p = (SITES_DIR / sub).resolve() if sub else SITES_DIR.resolve()
|
||||||
|
else:
|
||||||
p = Path(raw_path).expanduser().resolve()
|
p = Path(raw_path).expanduser().resolve()
|
||||||
# Enforce strict containment strictly inside SITES_DIR
|
# Enforce strict containment strictly inside SITES_DIR
|
||||||
if SITES_DIR.is_dir() and p.is_relative_to(SITES_DIR.resolve()):
|
if SITES_DIR.is_dir() and p.is_relative_to(SITES_DIR.resolve()):
|
||||||
|
|||||||
@@ -180,13 +180,20 @@ exit 0
|
|||||||
def test_platform_genericism_no_hardcoded_personal_domains_in_scripts_and_tests():
|
def test_platform_genericism_no_hardcoded_personal_domains_in_scripts_and_tests():
|
||||||
"""Ensure personal domains and operator usernames are absent from scripts, tests, and documentation."""
|
"""Ensure personal domains and operator usernames are absent from scripts, tests, and documentation."""
|
||||||
forbidden = ["roadtotech.me", "kiskaadee"]
|
forbidden = ["roadtotech.me", "kiskaadee"]
|
||||||
root_dirs = [CORE_ROOT / "scripts", CORE_ROOT / "tests", CORE_ROOT / "docs"]
|
root_dirs = [
|
||||||
|
CORE_ROOT / "scripts",
|
||||||
|
CORE_ROOT / "tests",
|
||||||
|
CORE_ROOT / "docs",
|
||||||
|
CORE_ROOT / "nixos" / "modules",
|
||||||
|
CORE_ROOT / "config",
|
||||||
|
]
|
||||||
root_files = [
|
root_files = [
|
||||||
CORE_ROOT / "README.md",
|
CORE_ROOT / "README.md",
|
||||||
CORE_ROOT / "ROADMAP.md",
|
CORE_ROOT / "ROADMAP.md",
|
||||||
CORE_ROOT / "AGENTS.md",
|
CORE_ROOT / "AGENTS.md",
|
||||||
CORE_ROOT / "SECURITY.md",
|
CORE_ROOT / "SECURITY.md",
|
||||||
CORE_ROOT / "flake.nix",
|
CORE_ROOT / "flake.nix",
|
||||||
|
CORE_ROOT / "docker-compose.yml",
|
||||||
]
|
]
|
||||||
violations = []
|
violations = []
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ def test_manifest_data_overrides_default_values(app_factory: AppFactory):
|
|||||||
dir_name="homelab-custom",
|
dir_name="homelab-custom",
|
||||||
manifest_yaml="""
|
manifest_yaml="""
|
||||||
name: custom-app
|
name: custom-app
|
||||||
domain: custom.roadtotech.local
|
domain: custom.example.test
|
||||||
auth: false
|
auth: false
|
||||||
visible: false
|
visible: false
|
||||||
networks:
|
networks:
|
||||||
@@ -95,7 +95,7 @@ def test_manifest_data_overrides_default_values(app_factory: AppFactory):
|
|||||||
app = engine.resolve_app("custom-app", apps)
|
app = engine.resolve_app("custom-app", apps)
|
||||||
|
|
||||||
assert app is not None
|
assert app is not None
|
||||||
assert app.domain == "custom.roadtotech.local"
|
assert app.domain == "custom.example.test"
|
||||||
assert app.auth is False
|
assert app.auth is False
|
||||||
assert app.networks == ["custom-net"]
|
assert app.networks == ["custom-net"]
|
||||||
|
|
||||||
|
|||||||
@@ -29,4 +29,4 @@ x 2026-10-19 (B) Implement operational router, pure-Python dotenv loader, Compos
|
|||||||
x 2026-10-19 (B) Implement dual-transport HTTP/1.1 daemon (UDS + loopback TCP) and wire gitops_dispatcher.py worker to daemon in scripts/appctl_daemon.py +daemon @p4
|
x 2026-10-19 (B) Implement dual-transport HTTP/1.1 daemon (UDS + loopback TCP) and wire gitops_dispatcher.py worker to daemon in scripts/appctl_daemon.py +daemon @p4
|
||||||
x 2026-10-19 (B) Add comprehensive unit and security test suite for P4 contracts, RBAC, audit guard, concurrency, and dual-transport parity in tests/unit/test_appctl_daemon.py +test @p4
|
x 2026-10-19 (B) Add comprehensive unit and security test suite for P4 contracts, RBAC, audit guard, concurrency, and dual-transport parity in tests/unit/test_appctl_daemon.py +test @p4
|
||||||
x 2026-10-19 (C) Re-implement scripts/appctl as a thin UDS HTTP client and declare homelab-appctl.service with POSIX ACLs in nixos/modules/homeserver.nix +cli @p4
|
x 2026-10-19 (C) Re-implement scripts/appctl as a thin UDS HTTP client and declare homelab-appctl.service with POSIX ACLs in nixos/modules/homeserver.nix +cli @p4
|
||||||
(C) Scrub remaining hardcoded domain and username literals across NixOS modules, Compose stack, and config/deployments.yaml and add pyright to flake.nix checks +generic @core
|
x 2026-10-19 (C) Scrub remaining hardcoded domain and username literals across NixOS modules, Compose stack, and config/deployments.yaml and add pyright to flake.nix checks +generic @core
|
||||||
Reference in new issue
Block a user