Add infra-tool: infrastructure registry with Incus container deployment
Service registry & discovery system that aggregates infrastructure metadata from Incus, K8s, APISIX, and BunnyCDN into NocoDB. Includes FastAPI HTTP API, systemd timer for 15-min auto-sync, and dual-mode collectors (REST API for container deployment, CLI/SSH fallback for local use). Deployed to jp1:infra-tool with Tailscale socket proxy for host network visibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
37
deploy/setup.sh
Executable file
37
deploy/setup.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# Infra Tool Container Setup Script
|
||||
# Run inside the infra-tool Incus container after creation
|
||||
set -euo pipefail
|
||||
|
||||
echo "=== Installing system packages ==="
|
||||
apt-get update
|
||||
apt-get install -y python3 python3-pip curl ca-certificates
|
||||
|
||||
echo "=== Installing uv ==="
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
export PATH="/root/.local/bin:$PATH"
|
||||
|
||||
echo "=== Setting up directories ==="
|
||||
mkdir -p /opt/infra-tool
|
||||
mkdir -p /etc/infra-tool
|
||||
|
||||
echo "=== Installing Python dependencies ==="
|
||||
cd /opt/infra-tool
|
||||
uv sync
|
||||
|
||||
echo "=== Installing systemd units ==="
|
||||
cp deploy/infra-sync.service /etc/systemd/system/
|
||||
cp deploy/infra-sync.timer /etc/systemd/system/
|
||||
cp deploy/infra-api.service /etc/systemd/system/
|
||||
|
||||
echo "=== Enabling services ==="
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now infra-sync.timer
|
||||
systemctl enable --now infra-api.service
|
||||
|
||||
echo "=== Done ==="
|
||||
echo "Remember to:"
|
||||
echo " 1. Copy TLS certs to /etc/infra-tool/incus-client.{crt,key}"
|
||||
echo " 2. Copy K8s token to /etc/infra-tool/k8s-token"
|
||||
echo " 3. Fill in /etc/infra-tool/env from deploy/env.template"
|
||||
echo " 4. Restart services: systemctl restart infra-api infra-sync"
|
||||
Reference in New Issue
Block a user