prvng_core/scripts/deploy-cp-server.sh
Jesús Pérez 894046ef5a
feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration
- DAG architecture: `dag show/validate/export` (nulib/main_provisioning/dag.nu),
    config loader (lib_provisioning/config/loader/dag.nu), taskserv dag-executor.
    Backed by schemas/lib/dag/*.ncl; orchestrator emits NATS events via
    WorkspaceComposition::into_workflow. See ADR-020, ADR-021.
  - Unified Component Architecture: components/mod.nu, main_provisioning/
    {components,workflow,extensions,ontoref-queries}.nu. Full workflow engine with
    topological sort and NATS subject emission. Blocks A-H complete (libre-daoshi).
  - Commands-registry: nulib/commands-registry.ncl (Nickel source, 314 lines) +
    JSON cache at ~/.cache/provisioning/commands-registry.json rebuilt on source
    change. cli/provisioning fast-path alias expansion avoids cold Nu startup.
    ADDING_COMMANDS.md documents new-command workflow.
  - Platform service manager: service-manager.nu (+573), startup.nu (+611),
    service-check.nu (+255); autostart/bootstrap/health/target refactored.
  - Nushell 0.112.2 migration: removed all try/catch and bash redirections;
    external commands prefixed with ^; type signatures enforced. Driven by
    scripts/refactor-try-catch{,-simplified}.nu.
  - TTY stack: removed shlib/*-tty.sh; replaced by cli/tty-dispatch.sh,
    tty-filter.sh, tty-commands.conf.
  - New domain modules: images/ (golden image lifecycle), workspace/{state,sync}.nu,
    main_provisioning/{bootstrap,cluster-deploy,fip,state}.nu, commands/{state,
    build,integrations/auth,utilities/alias}.nu, platform.nu expanded (+874).
  - Config loader overhaul: loader/core.nu slimmed (-759), cache/core.nu
    refactored (-454), removed legacy loaders/file_loader.nu (-330).
  - Thirteen new provisioning-<domain>.nu top-level modules for bash dispatcher.
  - Tests: test_workspace_state.nu (+351); updates to test_oci_registry,
    test_services.
  - README + CHANGELOG updated.
2026-04-17 04:27:33 +01:00

46 lines
1.2 KiB
Bash

#!/bin/bash
# Deploy wuji-cp-0 control plane server on Hetzner
# Usage: ./deploy-cp-server.sh
set -euo pipefail
HCLOUD_TOKEN="${HCLOUD_TOKEN:?HCLOUD_TOKEN required}"
HOSTNAME="wuji-cp-0"
SERVER_TYPE="cax21"
IMAGE="120350" # NixOS minimal aarch64
LOCATION="nbg1"
SSH_KEY="htz_ops"
echo "=== Deploying $HOSTNAME ==="
echo "Image: $IMAGE (NixOS minimal aarch64)"
echo "Type: $SERVER_TYPE | Location: $LOCATION"
# Create server
echo ""
echo "Creating server..."
hcloud server create \
--name "$HOSTNAME" \
--type "$SERVER_TYPE" \
--location "$LOCATION" \
--image "$IMAGE" \
--ssh-key "$SSH_KEY" \
--public-net enable_ipv4=true,ipv6=false
# Get server details
SERVER_ID=$(hcloud server describe "$HOSTNAME" -o format='{{.ID}}')
SERVER_IP=$(hcloud server describe "$HOSTNAME" -o format='{{.PublicNet.IPv4.IP}}')
echo ""
echo "✓ Server created!"
echo " ID: $SERVER_ID"
echo " IP: $SERVER_IP"
echo " Hostname: $HOSTNAME"
echo ""
echo "Next steps:"
echo "1. Wait 30 seconds for SSH to become available"
echo "2. Connect: ssh -o StrictHostKeyChecking=no root@$SERVER_IP"
echo "3. Run provisioning bootstrap on the server"
echo ""
echo "SSH Key: $SSH_KEY"
echo "Get public IPs: hcloud server list"
echo "Delete: hcloud server delete $SERVER_ID"