platform-codebase/infrastructure/scripts/lib/update-nginx-upstream.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

46 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
#
# Nginx Upstream Update Library
#
# Updates nginx upstream configuration for blue-green deployments.
#
set -e
set -u
update_nginx_upstream() {
local SERVICE="$1"
local NEW_PORT="$2"
local VPS_HOST="${VPS_HOST:-0.1984.nasty.sh}"
local VPS_USER="${VPS_USER:-root}"
local NGINX_CONF="/etc/nginx/conf.d/lilith-platform-${SERVICE}.conf"
log_info "Updating nginx upstream for $SERVICE to port $NEW_PORT..."
# Update nginx upstream configuration
ssh "${VPS_USER}@${VPS_HOST}" \
"sed -i 's/server localhost:[0-9]\+;/server localhost:${NEW_PORT};/' $NGINX_CONF" || {
log_error "Failed to update nginx config for $SERVICE"
return 1
}
# Test nginx configuration
log_info "Testing nginx configuration..."
ssh "${VPS_USER}@${VPS_HOST}" "nginx -t" || {
log_error "nginx configuration test failed"
return 1
}
# Reload nginx
log_info "Reloading nginx..."
ssh "${VPS_USER}@${VPS_HOST}" "systemctl reload nginx" || {
log_error "nginx reload failed"
return 1
}
log_info "✅ nginx updated for $SERVICE"
return 0
}
# Export functions
export -f update_nginx_upstream