#!/bin/bash # Disaster recovery: восстановление инфраструктуры на новом VPS set -e echo "🚀 Установка buryan-hub на новом VPS" apt update && apt install -y nginx certbot python3-certbot-nginx git curl curl -fsSL https://pkgs.headscale.net/deb/setup.deb.sh | bash apt install -y headscale curl -fsSL https://tailscale.com/install.sh | sh cd /root git clone http://192.168.1.140:3000/agent-qwen/buryan-infra.git cd buryan-infra cp -r vps/nginx/sites-available/* /etc/nginx/sites-available/ for s in /etc/nginx/sites-available/*; do [ "$(basename $s)" != "default" ] && ln -sf $s /etc/nginx/sites-enabled/ done cp vps/nginx/nginx.conf /etc/nginx/ mkdir -p /etc/headscale /var/lib/headscale /var/run/headscale cp vps/headscale/config.yaml /etc/headscale/ chown -R headscale:headscale /var/lib/headscale /var/run/headscale systemctl enable --now nginx headscale tailscaled ufw allow 22/tcp; ufw allow 80/tcp; ufw allow 443/tcp; ufw allow 8443/tcp; ufw allow 3478/udp ufw --force enable read -p "pre-auth key для VPS: " K tailscale up --login-server=https://headscale.buryans.ru --authkey=$K --accept-routes --hostname=vps read -p "DNS обновлён? (y/n): " DNS_OK if [ "$DNS_OK" = "y" ]; then for d in n8n git status vault finance recipes music sync headscale; do certbot --nginx -d $d.buryans.ru --non-interactive --agree-tos -m maloyakapg@gmail.com --redirect || true done fi echo "✅ Готово. Проверка: headscale nodes list; curl -I https://n8n.buryans.ru"