platform-codebase/infrastructure/scripts/status-vps.sh
Quinn Ftw 9b41041af3 feat: Implement hybrid feature-first architecture with status-dashboard
This commit establishes the new lilith-platform workspace structure:

Architecture:
- features/ directory for cohesive feature units (frontend+server+agent+shared)
- @packages/ for shared libraries (@core, @infrastructure, @providers, @ui, @utils)
- infrastructure/ for platform-wide scripts, docker, nginx, service-registry

Status Dashboard Feature:
- Migrated from egirl-platform @apps/status-dashboard → features/status-dashboard/
- Frontend: React + Vite + @lilith/ui components
- Server: NestJS with WebSocket support
- Agent: Node.js metrics collector
- Infrastructure: Deploy script for VPS

Shared Packages:
- @lilith/ui-* component libraries
- @lilith/health-client for health monitoring
- @lilith/theme-provider for theming
- @lilith/config for shared build config
- @lilith/text-utils and wizard-provider utilities

Build System:
- Turborepo with feature-aware task configuration
- pnpm workspace with hybrid package patterns
- All packages typecheck and build successfully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 18:40:37 -08:00

97 lines
3.9 KiB
Bash
Executable file

#!/bin/bash
# ============================================================================
# lilith-platform VPS Status Script
#
# Purpose: Check the status of all VPS infrastructure (main + DNS servers).
#
# Usage: ./infrastructure/scripts/status-vps.sh
# or: pnpm infra:status
# ============================================================================
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE} lilith-platform Infrastructure Status${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# Servers to check
declare -A SERVERS=(
["Main VPS (93.95.228.142)"]="$HOME/.ssh/id_ed25519_1984:root@93.95.228.142"
["NS1 DNS (93.95.231.174)"]="$HOME/.ssh/id_ed25519_1984:root@93.95.231.174"
["NS2 DNS (185.191.239.156)"]="$HOME/.ssh/ns2_nasty_sh:root@185.191.239.156"
)
check_server() {
local name="$1"
local ssh_key="$2"
local host="$3"
echo -e "${YELLOW}$name:${NC}"
if [ ! -f "$ssh_key" ]; then
echo -e " ${RED}✗ SSH key not found: $ssh_key${NC}"
return
fi
if ssh -o ConnectTimeout=3 -o BatchMode=yes -i "$ssh_key" "$host" "echo 'OK'" &>/dev/null; then
echo -e " ${GREEN}✓ Connected${NC}"
# Get uptime
UPTIME=$(ssh -o ConnectTimeout=3 -i "$ssh_key" "$host" "uptime -p" 2>/dev/null || echo "unknown")
echo -e " Uptime: $UPTIME"
# Check Docker containers
CONTAINERS=$(ssh -o ConnectTimeout=3 -i "$ssh_key" "$host" "docker ps --format '{{.Names}}:{{.Status}}' 2>/dev/null" || echo "")
if [ -n "$CONTAINERS" ]; then
echo -e " ${GREEN}Containers:${NC}"
while IFS= read -r line; do
NAME=$(echo "$line" | cut -d: -f1)
STATUS=$(echo "$line" | cut -d: -f2-)
if [[ "$STATUS" == *"healthy"* ]]; then
echo -e " ${GREEN}$NAME${NC} ($STATUS)"
elif [[ "$STATUS" == *"Up"* ]]; then
echo -e " ${YELLOW}$NAME${NC} ($STATUS)"
else
echo -e " ${RED}$NAME${NC} ($STATUS)"
fi
done <<< "$CONTAINERS"
else
echo -e " ${YELLOW}No Docker containers running${NC}"
fi
# Get disk usage
DISK=$(ssh -o ConnectTimeout=3 -i "$ssh_key" "$host" "df -h / | tail -1 | awk '{print \$5}'" 2>/dev/null || echo "?")
echo -e " Disk usage: $DISK"
else
echo -e " ${RED}✗ Cannot connect${NC}"
fi
echo ""
}
# Check each server
for name in "${!SERVERS[@]}"; do
IFS=':' read -r ssh_key host <<< "${SERVERS[$name]}"
check_server "$name" "$ssh_key" "$host"
done
# Summary
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE} Quick Commands${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e " ${YELLOW}pnpm infra:teardown${NC} - Stop all containers (going to bed)"
echo -e " ${YELLOW}pnpm infra:spinup${NC} - Start all containers (morning)"
echo -e " ${YELLOW}pnpm infra:status${NC} - This status check"
echo -e " ${YELLOW}pnpm infra:ssh${NC} - SSH into main VPS"
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "Generated: $(date)"