This directory contains shell scripts for installation, automation, and interactive usage.
[toc]
All management commands and their shell aliases (set up via install.sh aliases):
Alias (default sm- prefix) |
Management Command | App | Description |
|---|---|---|---|
sm-check-health |
check_health |
checkers | Run health checks (CPU, memory, disk, network, process) |
sm-run-check |
run_check |
checkers | Run a single checker with checker-specific options |
sm-check-and-alert |
run_pipeline --checks-only |
orchestration | Run checks through orchestrated pipeline |
sm-get-recommendations |
get_recommendations |
intelligence | Get AI-powered system recommendations |
sm-run-pipeline |
run_pipeline |
orchestration | Execute the full pipeline |
sm-monitor-pipeline |
monitor_pipeline |
orchestration | Monitor pipeline run history |
sm-test-notify |
test_notify |
notify | Test notification delivery |
sm-cli |
— | — | Interactive CLI menu |
sm-update |
— | — | Auto-update from origin/main |
Aliases pass all flags through. Example: sm-check-health --json = uv run python manage.py check_health --json.
See docs/Installation.md for setup guide and pipeline workflow examples.
For full flag reference per command, see the app READMEs:
apps/checkers/README.md—check_health(10 flags),run_check(11 flags)apps/orchestration/README.md—run_pipeline(includes checker flags)apps/intelligence/README.md—get_recommendations(11 flags)apps/notify/README.md—test_notify(14 flags)apps/orchestration/README.md—run_pipeline(12 flags),monitor_pipeline(3 flags)
Set up shell aliases so you can run sm-check-health instead of uv run python manage.py check_health.
# Interactive setup (prompts for prefix, default: sm)
./bin/install.sh aliases
# Custom prefix
./bin/install.sh aliases --prefix maint
# Creates: maint-check-health, maint-run-check, etc.
# Show current aliases
./bin/install.sh aliases --list
# Remove aliases and source line from shell profile
./bin/install.sh aliases --removeWhat it does:
- Generates
bin/aliases.sh(gitignored) with aliases locked to the project path - Adds a
sourceline to~/.zshrcor~/.bashrc --removeundoes both
After setup, activate immediately:
source ~/.zshrc # or source ~/.bashrcAn interactive menu-driven interface for all management commands. Recommended for new users and manual operations.
# Start interactive mode
./bin/cli.sh
# Direct shortcuts
./bin/cli.sh install # Jump to installation menu
./bin/cli.sh health # Jump to health monitoring
./bin/cli.sh alerts # Jump to alerts menu
./bin/cli.sh intel # Jump to intelligence menu
./bin/cli.sh pipeline # Jump to pipeline menu
./bin/cli.sh notify # Jump to notifications menu
./bin/cli.sh help # Show all optionsFeatures:
- Arrow-key menus powered by tuin (vendored, zero-dependency); falls back to numbered input on non-TTY/CI
- Arrow-key pickers for single-checker and notify-driver selection (no typing names)
- Each submenu loops; Back returns up a level and Exit quits
- Color-coded output
- Confirms before running commands
- Installation status check
- Shell alias setup option
Module structure (bin/cli/):
| Module | Menu functions |
|---|---|
install_menu.sh |
Install/setup, installation status |
health.sh |
Health checks, environment selection |
alerts.sh |
Run checks, orchestrated check pipeline |
intelligence.sh |
AI recommendations, custom analysis |
pipeline.sh |
Show/run/monitor pipelines |
notifications.sh |
Test notifications, driver config |
Full installation script for setting up the project.
./bin/install.shWhat it does:
- Verifies Python 3.10+ (tries python3.13 → python3.10 → python3)
- Installs
uvif missing - Creates
.envfrom.env.sample - Prompts for dev/production configuration
- Installs dependencies with
uv sync - Runs Django migrations
- Optionally runs health checks
- Optionally sets up cron
- Optionally sets up shell aliases
See docs/Installation.md for full details.
Save and load installer configurations for fleet consistency:
# Save after install
./bin/install.sh --save-profile prod-web
# Load on another machine (pre-fills all prompts)
./bin/install.sh --profile prod-web
# Fully automated (only prompts for secrets)
./bin/install.sh --profile prod-web --yesProfiles are stored as .install-profile* files (gitignored by default). They contain all non-sensitive .env values plus installer state (cron schedule, alias prefix, etc.). Secrets (DJANGO_SECRET_KEY, HUB_API_KEY) are never saved to profiles.
Deploys the project via Docker Compose or systemd, depending on the install mode. Builds images, starts services, and verifies health.
# Deploy (auto-detects mode from .env)
./bin/install.sh deploySets up scheduled health checks via cron.
./bin/install.sh cronWhat it does:
- Detects project directory
- Lets you choose a schedule (5 min / 15 min / hourly / custom)
- Writes crontab entry for
run_pipeline --checks-only --json - Logs to
cron.login project root - Optionally sets up automatic updates (
bin/update.sh --rollback --auto-env)
Useful commands after setup:
crontab -l # View cron entries
tail -f ./cron.log # Follow cron outputChecks for updates from origin/main and applies them. Syncs dependencies, runs migrations, and restarts services based on the detected deployment mode.
# Check and apply updates
./bin/update.sh
# Dry run (show what would happen)
./bin/update.sh --dry-run
# Enable automatic rollback on failure
./bin/update.sh --rollback
# Auto-append new env vars from .env.sample
./bin/update.sh --auto-env
# JSON output (for CI or monitoring)
./bin/update.sh --jsonWhat it does:
git fetch origin main— check for new commitsgit pull origin main— apply changes- Sync
.envwith.env.sample— warn or auto-append new keys uv sync— sync dependencies (mode-aware)python manage.py migrate— apply database migrations- Restart services (systemd, docker compose, or skip for dev)
- Notify on success or failure (best-effort)
Flags:
--rollback— revert to previous version if any step fails--auto-env— auto-append new.env.samplekeys to.env--dry-run— preview without applying--json— JSON output
Exit codes: 0 = up to date or updated, 1 = error.
Cron: Run ./bin/install.sh cron and answer "y" to the auto-update prompt.
Audits the security configuration of a deployment. Auto-detects whether this node is an agent, hub, or standalone instance.
# Run security audit
./bin/check_security.sh
# JSON output (for CI or monitoring)
./bin/check_security.sh --jsonMode detection:
- Agent (
HUB_URLset): checks TLS,HUB_API_KEYpresence, hub reachability, certificate validity - Hub (
API_KEY_AUTH_ENABLED=1): checks API-key auth, bind address, reverse proxy, HTTPS termination - Standalone: common checks only (secret key, debug mode, .env permissions, allowed hosts, dependency audit)
Exit codes: 0 = all pass, 1 = warnings only, 2 = failures present.
If you get "permission denied", make scripts executable:
chmod +x ./bin/*.sh