|
1
|
"""Bootstrap command — infrastructure layer orchestration (v2 stub).""" |
|
2
|
|
|
3
|
from __future__ import annotations |
|
4
|
|
|
5
|
from pathlib import Path |
|
6
|
|
|
7
|
from rich.panel import Panel |
|
8
|
|
|
9
|
from boilerworks.console import console, print_info, print_warning |
|
10
|
|
|
11
|
_LAYERS = [ |
|
12
|
("1", "Foundation", "VPC, subnets, security groups, IAM roles"), |
|
13
|
("2", "Data", "RDS (Postgres), ElastiCache (Redis), S3 buckets"), |
|
14
|
("3", "Compute", "ECS/GKE cluster, service definitions, autoscaling"), |
|
15
|
("4", "Delivery", "Load balancer, TLS certificates, CDN, DNS"), |
|
16
|
("5", "Observability", "Metrics, logs, alerts, dashboards"), |
|
17
|
] |
|
18
|
|
|
19
|
_V2_NOTICE = ( |
|
20
|
"Infrastructure bootstrapping is coming in v2.\n" |
|
21
|
"For now, follow the ops template README to provision infrastructure manually.\n\n" |
|
22
|
"Ops template: [bold]https://github.com/ConflictHQ/boilerworks-opscode[/bold]" |
|
23
|
) |
|
24
|
|
|
25
|
|
|
26
|
def run_bootstrap(ops_dir: str | None = None, dry_run: bool = True) -> None: |
|
27
|
"""Show the infrastructure bootstrap execution plan.""" |
|
28
|
if ops_dir: |
|
29
|
ops_path = Path(ops_dir) |
|
30
|
if not ops_path.exists(): |
|
31
|
print_warning(f"Ops directory not found: {ops_path}") |
|
32
|
else: |
|
33
|
print_info("No --ops-dir specified; showing generic plan") |
|
34
|
|
|
35
|
# Build the plan panel |
|
36
|
plan_lines = ["[bold]Execution plan — 5 layers[/bold]\n"] |
|
37
|
for layer_num, layer_name, layer_desc in _LAYERS: |
|
38
|
plan_lines.append(f" [cyan]{layer_num}.[/cyan] [bold]{layer_name}[/bold]") |
|
39
|
plan_lines.append(f" {layer_desc}") |
|
40
|
plan_lines.append("") |
|
41
|
|
|
42
|
console.print(Panel("\n".join(plan_lines).rstrip(), title="[bold]Bootstrap Plan[/bold]", border_style="cyan")) |
|
43
|
console.print(Panel(_V2_NOTICE, title="[bold yellow]v1 — Stub[/bold yellow]", border_style="yellow")) |
|
44
|
|