#!/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"