#!/bin/bash # Получение SSL сертификатов Let's Encrypt set -e EMAIL="admin@hotelsync.ru" DOMAINS="hotelsync.ru,www.hotelsync.ru,app.hotelsync.ru,api.hotelsync.ru,git.hotelsync.ru" echo "→ Получение SSL сертификатов..." # Временный nginx для certbot challenge docker run --rm -p 80:80 -v /opt/hotelsync/certbot/www:/var/www/certbot nginx:alpine & NGINX_PID=$! sleep 2 for domain in hotelsync.ru app.hotelsync.ru api.hotelsync.ru git.hotelsync.ru; do docker run --rm \ -v /opt/hotelsync/certbot/certs:/etc/letsencrypt \ -v /opt/hotelsync/certbot/www:/var/www/certbot \ certbot/certbot certonly \ --webroot \ --webroot-path=/var/www/certbot \ --email "$EMAIL" \ --agree-tos \ --no-eff-email \ -d "$domain" \ $([ "$domain" = "hotelsync.ru" ] && echo "-d www.hotelsync.ru" || echo "") echo "✓ SSL для $domain получен" done kill $NGINX_PID 2>/dev/null || true echo "✅ Все SSL сертификаты получены"