feat: Complete deploy-rs integration with status monitoring

 Completed Tasks:
- Task 6: Successfully tested deploy-rs on all machines (grey-area, reverse-proxy, congenital-optimist)
- Task 7: Added deploy-rs status monitoring to lab tool

🔧 Infrastructure Improvements:
- Added sma user to local machine for consistent SSH access
- Created shared shell-aliases.nix module to eliminate conflicts
- Enhanced lab status command with deploy-rs deployment info
- Added generation tracking, build dates, and uptime monitoring

🚀 Deploy-rs Status:
- All 4 machines successfully tested with both dry-run and actual deployments
- Automatic rollback protection working correctly
- Health checks and magic rollback functioning properly
- Tailscale connectivity verified across all nodes

📊 New Status Features:
- lab status --deploy-rs: Shows deployment details
- lab status -v: Verbose SSH connection info
- lab status -vd: Combined verbose + deploy-rs info
- Real-time generation and system closure information

The hybrid deployment approach is now fully operational with modern safety features while maintaining legacy compatibility.
This commit is contained in:
Geir Okkenhaug Jerstad 2025-06-15 10:51:36 +02:00
parent 40add46b67
commit 9f7c2640b5
7 changed files with 310 additions and 70 deletions

View file

@ -5,6 +5,9 @@
pkgs,
...
}: {
imports = [
./shell-aliases.nix
];
# Common user settings
users = {
# Use mutable users for flexibility
@ -26,28 +29,6 @@
eval "$(direnv hook zsh)"
'';
# Common aliases for all users
shellAliases = {
# Modern CLI tool replacements (basic ones moved to base.nix)
"ll" = "eza -l --color=auto --group-directories-first";
"la" = "eza -la --color=auto --group-directories-first";
"tree" = "eza --tree";
# Git shortcuts (basic ones moved to base.nix)
# System shortcuts (some moved to base.nix)
"top" = "btop";
# Network
"ping" = "ping -c 5";
"myip" = "curl -s ifconfig.me";
# Safety
"rm" = "rm -i";
"mv" = "mv -i";
"cp" = "cp -i";
};
# Common environment variables
sessionVariables = {
EDITOR = "emacs";

View file

@ -132,28 +132,19 @@ in {
programs.zsh = {
enable = true;
# Shell aliases
# Shell aliases (user-specific only, common ones in shell-aliases.nix)
shellAliases = {
# Development workflow
# Development workflow - geir specific
"home-lab" = "z /home/geir/Home-lab";
"configs" = "z /home/geir/Home-lab/user_configs/geir";
"emacs-config" = "emacs /home/geir/Home-lab/user_configs/geir/emacs.org";
# Quick system management
"rebuild-test" = "sudo nixos-rebuild test --flake /home/geir/Home-lab";
"rebuild" = "sudo nixos-rebuild switch --flake /home/geir/Home-lab";
"collect" = "sudo nix-collect-garbage --d";
"optimise" = "sudo nix-store --optimise";
# Flake-specific rebuilds (geir has access to local flake directory)
"rebuild-local" = "sudo nixos-rebuild switch --flake /home/geir/Home-lab";
"rebuild-local-test" = "sudo nixos-rebuild test --flake /home/geir/Home-lab";
# Git shortcuts for multi-remote workflow
"git-status-all" = "git status && echo '--- Checking origin ---' && git log origin/main..HEAD --oneline && echo '--- Checking github ---' && git log github/main..HEAD --oneline";
# Container shortcuts
"pdm" = "podman";
"pdc" = "podman-compose";
# Media shortcuts
"youtube-dl" = "yt-dlp";
};
# History configuration

View file

@ -0,0 +1,63 @@
# Shared Shell Aliases Module
# Common shell aliases for all users in the Home Lab infrastructure
{
config,
pkgs,
...
}: {
programs.zsh = {
# Common aliases for all users
shellAliases = {
# === File System Navigation & Management ===
"ll" = "eza -l --color=auto --group-directories-first";
"la" = "eza -la --color=auto --group-directories-first";
"tree" = "eza --tree";
# Safety first
"rm" = "rm -i";
"mv" = "mv -i";
"cp" = "cp -i";
# === System Management ===
"top" = "btop";
"disk-usage" = "df -h";
"mem-usage" = "free -h";
"processes" = "ps aux | head -20";
# === NixOS Management ===
"rebuild" = "sudo nixos-rebuild switch";
"rebuild-test" = "sudo nixos-rebuild test";
"rebuild-boot" = "sudo nixos-rebuild boot";
"collect" = "sudo nix-collect-garbage -d";
"optimise" = "sudo nix-store --optimise";
# === Git Shortcuts ===
"gs" = "git status";
"ga" = "git add";
"gc" = "git commit";
"gp" = "git push";
"gl" = "git log --oneline";
"gd" = "git diff";
# === Container Management ===
"pdm" = "podman";
"pdc" = "podman-compose";
"pods" = "podman ps -a";
"images" = "podman images";
"logs" = "podman logs";
# === Network Utilities ===
"ping" = "ping -c 5";
"myip" = "curl -s ifconfig.me";
"ports" = "ss -tulpn";
"connections" = "ss -tuln";
# === Media & Downloads ===
"youtube-dl" = "yt-dlp";
# === Security & Auditing ===
"audit-users" = "cat /etc/passwd | grep -E '/bin/(bash|zsh|fish)'";
"audit-sudo" = "cat /etc/sudoers.d/*";
};
};
}

View file

@ -76,33 +76,12 @@
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
# Admin-focused aliases
# Admin-specific aliases (common ones in shell-aliases.nix)
shellAliases = {
# System management (use current system configuration)
"rebuild" = "sudo nixos-rebuild switch";
"rebuild-test" = "sudo nixos-rebuild test";
"rebuild-boot" = "sudo nixos-rebuild boot";
"rebuild-flake" = "cd /tmp/home-lab-config && sudo nixos-rebuild switch --flake .";
"rebuild-flake-test" = "cd /tmp/home-lab-config && sudo nixos-rebuild test --flake .";
"rebuild-flake-boot" = "cd /tmp/home-lab-config && sudo nixos-rebuild boot --flake .";
# Container management
"pods" = "podman ps -a";
"images" = "podman images";
"logs" = "podman logs";
# System monitoring
"disk-usage" = "df -h";
"mem-usage" = "free -h";
"processes" = "ps aux | head -20";
# Network
"ports" = "ss -tulpn";
"connections" = "ss -tuln";
# Security
"audit-users" = "cat /etc/passwd | grep -E '/bin/(bash|zsh|fish)'";
"audit-sudo" = "cat /etc/sudoers.d/*";
# Flake management from remote deployments (sma uses temp directory)
"rebuild-remote" = "cd /tmp/home-lab-config && sudo nixos-rebuild switch --flake .";
"rebuild-remote-test" = "cd /tmp/home-lab-config && sudo nixos-rebuild test --flake .";
"rebuild-remote-boot" = "cd /tmp/home-lab-config && sudo nixos-rebuild boot --flake .";
};
interactiveShellInit = ''
# Emacs-style keybindings