docs(infra): add complete CLI reference, examples, and phase docs to setup.sh + ECOSYSTEM_DEPLOYMENT.md

setup.sh header now includes:
- All 6 CLI flags (--resume, --resume-from, --phase, --reset, --status, --help)
- Phase descriptions (1-8)
- 6 usage examples (fresh install, retry, resume, jump, status, reset)
- Resume/retry explanation with state dir and build log paths

ECOSYSTEM_DEPLOYMENT.md now includes:
- Single-VM Bootstrap section with quick start
- Resume & Retry examples
- Phase table
- Per-service build & fallback explanation
- Health check script reference
This commit is contained in:
saravanakumardb1 2026-03-24 12:24:16 -07:00
parent b634708da8
commit acbab75aaa
2 changed files with 97 additions and 0 deletions

View File

@ -182,6 +182,77 @@ See `docs/devops/GITEA_NPM_REGISTRY_MIGRATION.md` for details.
---
## Single-VM Bootstrap (Azure / bare Ubuntu)
For deploying the entire ecosystem from scratch on a raw Ubuntu VM, use the automated bootstrap script:
```bash
# Location: docs/devops/single_azure_vm/setup.sh
```
This script installs **everything** — Docker, Node.js, pnpm, Gitea (npm registry), Ollama (LLM), clones all repos, builds packages, publishes to Gitea, and deploys the full 30-service ecosystem.
### Quick Start
```bash
# Fresh install (runs all 8 phases)
sudo ./setup.sh
# Check what's done
sudo ./setup.sh --status
```
### Resume & Retry
Phase completion is tracked in `/opt/bytelyst/.setup-state/`. If anything fails, you don't have to start over:
```bash
# Phase 7 failed? Retry just that phase
sudo ./setup.sh --phase=7
# SSH disconnected mid-run? Auto-resume from where it left off
sudo ./setup.sh --resume
# Jump straight to deploy after a manual fix
sudo ./setup.sh --resume-from=7
# Start completely over
sudo ./setup.sh --reset
```
### Phases
| Phase | Description |
|-------|-------------|
| 1 | System dependencies (Docker, Node.js 22, pnpm, Ollama) |
| 2 | Gitea npm registry (container on :3300) |
| 3 | Clone 11 repositories from GitHub |
| 4 | Build all @bytelyst/* packages |
| 5 | Publish packages to Gitea npm registry |
| 6 | Generate `.env.ecosystem` config |
| 7 | Build + deploy 30 Docker services (per-service, with fallback) |
| 8 | Health check (30 endpoints) |
### Per-Service Build & Fallback
Phase 7 builds each of the 30 services individually:
- **Pre-built images** (infra: cosmos-emulator, azurite, etc.) are detected and skipped
- **Failed builds** are skipped — remaining services still start
- **Build logs** are saved per-service to `/opt/bytelyst/.setup-state/builds/<service>.log`
- After fixing a build failure, re-run with `sudo ./setup.sh --phase=7`
### Health Check
After deployment, a standalone health-check script is created at `/opt/bytelyst/check-health.sh`:
```bash
/opt/bytelyst/check-health.sh
```
This checks all 30 endpoints (infrastructure, platform services, dashboards, product backends, product web apps) plus Gitea and Ollama.
---
## Architecture
```

View File

@ -21,6 +21,32 @@
# --resume-from=N Resume from phase N (1-8)
# --phase=N Run ONLY phase N (useful for retrying a single phase)
# --reset Clear phase markers and start fresh
# --status Show completed phases and exit
# -h, --help Show usage help
#
# Phases:
# 1 System dependencies (Docker, Node, pnpm, Ollama)
# 2 Gitea npm registry (container on :3300)
# 3 Clone 11 repositories from GitHub
# 4 Build all @bytelyst/* packages
# 5 Publish packages to Gitea npm registry
# 6 Generate .env.ecosystem config
# 7 Build + deploy 30 Docker services (per-service, with fallback)
# 8 Health check (30 endpoints)
#
# Examples:
# sudo ./setup.sh # Fresh install (all 8 phases)
# sudo ./setup.sh --phase=7 # Retry just the deploy phase
# sudo ./setup.sh --resume # Auto-resume after SSH disconnect
# sudo ./setup.sh --resume-from=7 # Jump to deploy after manual fix
# sudo ./setup.sh --status # Check what's done
# sudo ./setup.sh --reset # Start completely over
#
# Resume/retry:
# Phase completion is tracked in /opt/bytelyst/.setup-state/.
# If a phase fails, fix the issue and re-run with --resume or --phase=N.
# Phase 7 builds each service individually — failed builds are skipped,
# remaining services still start. Build logs: /opt/bytelyst/.setup-state/builds/
#
# Optional env vars:
# GITHUB_USER — GitHub org/user to clone from (default: saravanakumardb1)