User Tools

Site Tools


infrastructure:bootstrap

This is an old revision of the document!


Bootstrap Guide

Komplettanleitung zum Aufbau des Automation Stacks von Grund auf. Wir haben hier als Standard-Fall die Installation im lokalen Netzwerk dokumentiert. Parallel teste ich aber auch auf einem preiswerten VPS auf Hetzner im Projekt mxmlabs-test, daher manchmal wo notwendig Abweichungen.

Übersicht

DAY 0 (manuell)          DAY 1 (automatisiert)         DAY 2
─────────────────        ─────────────────────         ──────────
Proxmox                  bootstrap.sh                  Operations
UniFi Netzwerk           └─► LXCs erstellen            • Monitoring
Cloudflare               └─► Services deployen         • Backups
vault.yml                └─► Secrets migrieren         • Updates

DAY 0 — Foundation

Netzwerk

UniFi

VLAN anlegen:

VLAN Name Subnet Gateway
160 Server 10.100.160.0/23 10.100.161.254

Firewall-Regeln:

Regel Von Nach Port Aktion
WAN-HTTP WAN 10.100.161.102 80,443 Allow
VPN-Server 192.168.7.0/24 10.100.160.0/23 * Allow
Server-LAN 10.100.160.0/23 LAN * Allow

Port-Forwarding:

Extern Intern Service
80 10.100.161.102:80 Traefik HTTP
443 10.100.161.102:443 Traefik HTTPS

Cloudflare

Domain hinzufügen:

  1. home.miskam.xyz → Cloudflare DNS

API Token erstellen:

  1. My Profile → API Tokens → Create Token
  2. Template: “Edit zone DNS
  3. Zone: home.miskam.xyz
  4. → Token speichern für vault.yml

DNS Records:

Type Name Value
A *.home.miskam.xyz <WAN-IP>

Proxmox

lokal

Installation:

  • ISO von proxmox.com
  • Storage: local-lvm (LXC root disks)
  • Netzwerk: vmbr0 als VLAN-aware Bridge

Bridge-Konfiguration (/etc/network/interfaces):

cat > /etc/network/interfaces <<EOF
auto vmbr0
iface vmbr0 inet manual
    bridge-ports enp1s0
    bridge-stp off
    bridge-fd 0
    bridge-vlan-aware yes
EOF
ifreload -a 

Hetzner

cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback

auto eno1
#real IP address
iface nic0 inet static
        address  198.51.100.5/24
        gateway  198.51.100.1

auto vmbr0
#private sub network
iface vmbr0 inet static
        address  10.10.10.1/24
        bridge-ports none
        bridge-stp off
        bridge-fd 0

        post-up   echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up   iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o eno1 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o eno1 -j MASQUERADE
EOF
ifreload -a

API Token erstellen:

  • Datacenter → Permissions → API Tokens
  • User: root@pam
  • Token ID: ansible
  • Privilege Separation: aus
  • → Token speichern für vault.yml

Ops Container einrichten (OpenClaw)

pveam download local debian-13-standard_13.1-2_amd64.tar.zst

TEMPLATE="local:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst"

pct create 100 $TEMPLATE --hostname ops --memory 2048 --cores 2 \
  --rootfs local-lvm:16 --net0 name=eth0,bridge=vmbr0,ip=10.10.10.2/24,gw=10.10.10.1 \
  --features nesting=1 --unprivileged 1 --start 1

# install curl, requirement for the openclaw installer
pct exec 100 -- bash -c "apt update && apt install curl -y"
# install openclaw (unconfigured)
pct exec 100 -- bash -c "curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard"
# install uv 
pct exec 100 -- bash -c  "curl -LsSf https://astral.sh/uv/install.sh | sh"
# add uv to $PATH
pct exec 100 -- bash -c "/root/.local/bin/uv tool update-shell"
# install ansible
pct exec 100 -- bash -c "/rrot/.local/bin/uv tool install ansible-core"
pct exec 100 -- bash -c "/root/.local/bin/uv tool install --with proxmoxer --with requests ansible"


vault.yml vorbereiten

Alle Secrets für den Bootstrap in einer Datei:

cd ansible/
cat > vault.yml.plain << 'EOF'
# Proxmox
vault_proxmox_api_user: "root@pam!ansible"
vault_proxmox_api_token: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
 
# Cloudflare
vault_cloudflare_token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
 
# PostgreSQL
vault_postgresql_admin: "GENERATE_ME"
vault_postgresql_n8n: "GENERATE_ME"
vault_postgresql_vaultwarden: "GENERATE_ME"
vault_postgresql_forgejo: "GENERATE_ME"
 
# Services
vault_vaultwarden_admin_token: "GENERATE_ME"
vault_n8n_encryption_key: "GENERATE_ME"
vault_grafana_admin: "GENERATE_ME"
vault_dokuwiki_admin: "GENERATE_ME"
 
# Bot User (für Vaultwarden nach Migration)
vault_bot_email: "[email protected]"
vault_bot_password: "GENERATE_ME"
EOF
 
# Secrets generieren
sed -i "s/GENERATE_ME/$(openssl rand -base64 24 | tr -dc 'a-zA-Z0-9' | head -c24)/g" vault.yml.plain
 
# Verschlüsseln
ansible-vault encrypt vault.yml.plain --output vault.yml
rm vault.yml.plain

DAY 1 — Bootstrap

Voraussetzungen

  • Proxmox erreichbar (SSH + API)
  • Netzwerk konfiguriert (VLAN 160)
  • vault.yml verschlüsselt vorhanden
  • Git-Repo geklont

1.1 Bootstrap starten

cd ansible/
./bootstrap.sh
# → Vault-Passwort eingeben

Ablauf (automatisch)

bootstrap.sh
    │
    ├─► 1. Control Node (CT 103)
    │       └── Ansible, Git, SSH-Key
    │
    ├─► 2. Traefik (CT 102)
    │       └── CF-Token, Wildcard-Cert
    │
    ├─► 3. PostgreSQL (CT 110)
    │       └── DBs: n8n, vaultwarden, forgejo
    │
    ├─► 4. Vaultwarden (CT 112)
    │       └── Admin-Token konfiguriert
    │
    ├─► 5. Services (parallel)
    │       ├── n8n (CT 111)
    │       ├── DokuWiki (CT 113)
    │       ├── Uptime Kuma (CT 114)
    │       ├── Monitoring (CT 115)
    │       └── Forgejo (CT 116)
    │
    ├─► 6. Traefik-Routen
    │       └── automation.yml deployen
    │
    ├─► 7. /etc/hosts
    │       └── *.srv.internal auf allen Hosts
    │
    ├─► 8. node_exporter
    │       └── Port 9100 auf allen Hosts
    │
    └─► 9. migrate-secrets.yml
            └── vault.yml → Vaultwarden API

Container-Übersicht

CT Name IP RAM Disk Port
102 traefik 10.100.161.102 512M 2G 80,443
103 openclaw 10.100.160.249 2G 8G 18789
110 postgres 10.100.161.110 1G 8G 5432
111 n8n 10.100.161.111 1G 4G 5678
112 vaultwarden 10.100.161.112 512M 2G 8080
113 dokuwiki 10.100.161.113 512M 2G 80
114 uptime-kuma 10.100.161.114 512M 2G 3001
115 monitoring 10.100.161.115 1G 4G 9090,3000
116 forgejo 10.100.161.116 512M 4G 3000

Abhängigkeiten

                    Proxmox + UniFi + Cloudflare
                              │
                              ▼
                    ┌─────────────────┐
                    │   vault.yml     │
                    └────────┬────────┘
                             │
              ┌──────────────┼──────────────┐
              ▼              ▼              ▼
        ┌──────────┐  ┌──────────┐  ┌──────────┐
        │ Control  │  │ Traefik  │  │PostgreSQL│
        │  Node    │  │   102    │  │   110    │
        └────┬─────┘  └────┬─────┘  └────┬─────┘
             │             │             │
             │             │             ▼
             │             │      ┌──────────┐
             │             │      │Vaultwarden│
             │             │      │   112    │
             │             │      └────┬─────┘
             │             │           │
             │      ┌──────┴───────────┴──────┐
             │      ▼      ▼      ▼     ▼     ▼
             │   ┌─────┐┌─────┐┌─────┐┌─────┐┌─────┐
             │   │ n8n ││Wiki ││Kuma ││Graf.││Forge│
             │   │ 111 ││ 113 ││ 114 ││ 115 ││ 116 │
             │   └──┬──┘└──┬──┘└──┬──┘└──┬──┘└──┬──┘
             │      └──────┴──────┴──────┴──────┘
             │                   │
             ▼                   ▼
      ┌────────────┐     ┌────────────┐
      │ /etc/hosts │     │  Traefik   │
      │*.srv.intern│     │   Routes   │
      └────────────┘     └────────────┘
                              │
                              ▼
                    ┌─────────────────┐
                    │ migrate-secrets │
                    │ → Vaultwarden   │
                    └─────────────────┘

DAY 2 — Operations

Nach erfolgreichem Bootstrap:

  • Secrets: Vaultwarden (Bitwarden-Lookup aktiv)
  • Monitoring: Prometheus + Grafana
  • Git: Forgejo (lokales Repo-Mirror)

URLs

Credentials

Alle Zugangsdaten in Vaultwarden:

  • Organisation: mxmlabs
  • Collection: Network Automation

Erstellt: 2026-02-07

infrastructure/bootstrap.1770645781.txt.gz · Last modified: by mxm