name: Deploy Nginx # Единственный публичный вход (443/80) на прод VPS (backend+лендинг вместе, # см. deploy-nginx.yml у netrunner-backend — тот же сервер, свой домен). # Только ручной запуск. # # Порядок первого запуска: # 1. Запустить эту джобу (поднимет http-конфиг). # 2. Один раз руками на сервере: # sudo apt-get install -y certbot # sudo certbot certonly --webroot -w /var/www/certbot \ # -d netrunner-vpn.com # 3. Запустить эту джобу ещё раз — включит HTTPS. on: workflow_dispatch: jobs: deploy: name: Deploy nginx config for netrunner-vpn.com runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Sync nginx configs to VPS uses: appleboy/scp-action@v0.1.7 with: host: ${{ vars.VPS_IP }} username: root key: ${{ secrets.SSH_PRIVATE_KEY }} source: "nginx/landing-http.conf,nginx/landing-ssl.conf" target: "/root/netrunner-frontend" strip_components: 0 - name: Install/enable nginx via SSH uses: appleboy/ssh-action@v1 with: host: ${{ vars.VPS_IP }} username: root key: ${{ secrets.SSH_PRIVATE_KEY }} script: | set -e if ! command -v nginx >/dev/null 2>&1; then apt-get update apt-get install -y nginx fi mkdir -p /var/www/certbot rm -f /etc/nginx/sites-enabled/default cp /root/netrunner-frontend/nginx/landing-http.conf /etc/nginx/sites-available/landing-http.conf cp /root/netrunner-frontend/nginx/landing-ssl.conf /etc/nginx/sites-available/landing-ssl.conf ln -sf /etc/nginx/sites-available/landing-http.conf /etc/nginx/sites-enabled/landing-http.conf CERT=/etc/letsencrypt/live/netrunner-vpn.com/fullchain.pem if [ -f "$CERT" ]; then ln -sf /etc/nginx/sites-available/landing-ssl.conf /etc/nginx/sites-enabled/landing-ssl.conf echo "🔒 Сертификат найден — HTTPS-конфиг включён." else rm -f /etc/nginx/sites-enabled/landing-ssl.conf echo "⚠️ Сертификата ещё нет ($CERT) — HTTPS-конфиг НЕ включён." fi nginx -t systemctl enable --now nginx systemctl reload nginx echo "✅ nginx (netrunner-vpn.com) synchronized."