Skip to main content

DevOps Patterns

These are kitty workflows for real server administration, designed for reliability and repeatability.

Core Idea

Kitty's value in DevOps comes from four things: GPU-accelerated multi-window views, kittens for inline data (images, diffs), SSH terminfo forwarding, and scriptable remote control.

Pattern 1: Server Health Dashboard

Monitor a server's health from a single kitty tab with tiled windows:

~/bin/healthdash.sh
#!/bin/bash
# Create a health monitoring tab in the current kitty window

# Launch the main monitoring layout
kitty @ launch --type=tab --title "health"
kitty @ launch --type=window --location=hsplit
kitty @ launch --type=window --location=vsplit
kitty @ launch --type=window --location=vsplit

# Small delay for layout to settle
sleep 0.3

# Send commands to each window
kitty @ send-text --match-title health -m "title:health" "htop\n"
kitty @ send-text --match-title health -m "title:health" "watch -n 3 df -h\n"
kitty @ send-text --match-title health -m "title:health" "watch -n 3 free -h\n"
kitty @ send-text --match-title health -m "title:health" "tail -f /var/log/syslog\n"

echo "Health dashboard created in new tab"

Pattern 2: Deployment Workspace

A deployment tab with role-isolated windows:

~/bin/deploy-tab.sh
#!/bin/bash
APP_DIR="/srv/myapp"

kitty @ launch --type=tab --title "deploy"
kitty @ launch --type=window --location=hsplit
kitty @ launch --type=window --location=vsplit

kitty @ send-text --match-title deploy "cd $APP_DIR && echo 'Ready to deploy'\n"
kitty @ send-text --match-title deploy "watch systemctl status myapp.service\n"
kitty @ send-text --match-title deploy "tail -f $APP_DIR/logs/app.log\n"

echo "Deployment tab created"

Pattern 3: Incident Response Tab

When something is on fire, open a structured incident workspace:

~/bin/incident.sh
#!/bin/bash
TAB_TITLE="incident-$(date +%Y%m%d-%H%M)"

kitty @ launch --type=tab --title "$TAB_TITLE"

# Window 1: triage (htop)
kitty @ send-text --match-title "$TAB_TITLE" "htop\n"

# Window 2: logs (split)
kitty @ launch --type=window --location=vsplit
kitty @ send-text --match-title "$TAB_TITLE" "journalctl -f -u myapp.service\n"

# Window 3: error logs
kitty @ launch --type=window --location=hsplit
kitty @ send-text --match-title "$TAB_TITLE" "tail -f /var/log/nginx/error.log\n"

echo "Incident tab '$TAB_TITLE' created — naming creates an automatic audit trail"

Pattern 4: Multi-Server SSH in Windows

Open SSH connections to multiple servers in a single tab:

~/bin/multiserver.sh
#!/bin/bash
SERVERS=("web01" "web02" "db01" "cache01")

kitty @ launch --type=tab --title "servers"
kitty @ send-text --match-title servers "ssh ${SERVERS[0]}\n"

for SERVER in "${SERVERS[@]:1}"; do
kitty @ launch --type=window --location=hsplit
kitty @ send-text --match-title servers "ssh $SERVER\n"
done

echo "Multi-server tab opened with ${#SERVERS[@]} connections"

Pattern 5: Long-Running Job Monitoring

For jobs that take hours:

~/bin/longrun.sh
#!/bin/bash
LOG_FILE="/var/log/backup.log"

kitty @ launch --type=tab --title "longrun"

# Window for the job itself
kitty @ send-text --match-title longrun \
"time rsync -avz /data /backup 2>&1 | tee $LOG_FILE\n"

# Second window for monitoring progress
kitty @ launch --type=window --location=vsplit
kitty @ send-text --match-title longrun \
"tail -f $LOG_FILE\n"

echo "Long-running job tab created"

Using Kitty SSH for Remote Sessions

# Connect to remote with full kitty support
kitty +kitten ssh admin@prod-server

# Inside the SSH session, you can still use remote control
kitty @ launch --type=window --cwd=current
kitty @ send-text --match-title "prod" "htop\n"

Session Management for Different Environments

~/.bashrc
# Quick-launch aliases
alias dev="kitty @ launch --type=tab --title dev && \
kitty @ send-text --match-title dev 'cd ~/projects/myapp\n'"
alias staging="kitty @ launch --type=tab --title staging && \
kitty @ send-text --match-title staging 'ssh deploy@staging.example.com\n'"
alias prod="kitty +kitten ssh admin@prod.example.com"

Workflow Summary

PatternWindowsLayoutUse Case
Health dashboard42x2 tiledReal-time server monitoring
Deployment workspace3Main-verticalZero-downtime deploys
Incident response3Separate windowsEmergency triage
Multi-server SSHNHorizontal splitParallel server access
Long-running job2Vertical splitBackup or build monitoring

Common Pitfalls

PitfallSymptomFix
kitty @ commands not foundRemote control disabledMust set allow_remote_control yes in kitty.conf
Window title matching wrong windowCommand sent to incorrect windowUse unique titles and verify with kitty @ ls
Timing issues with layoutCommands run before window createdAdd sleep 0.3 between launch and send-text
SSH kitten not needed for localUnnecessary overheadUse plain ssh for kitty-to-kitty connections

Hands-On Practice

# Test the health dashboard pattern manually
kitty @ launch --type=tab --title "practice"
kitty @ launch --type=window --location=hsplit
kitty @ launch --type=window --location=vsplit
kitty @ launch --type=window --location=vsplit

# Verify layout
kitty @ ls

# Send practice commands
kitty @ send-text --match-title practice "echo 'Pane 1'\n"
kitty @ send-text --match-title practice "echo 'Pane 2'\n"
kitty @ send-text --match-title practice "echo 'Pane 3'\n"
kitty @ send-text --match-title practice "echo 'Pane 4'\n"

What's Next