diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a29b974..c7505c8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -158,7 +158,7 @@ jobs: # Se a conexão funcionou, continua com o deploy echo "=== Iniciando Deploy no Docker Swarm ===" - # Deploy via Docker Swarm (apenas no manager - servidor 1) + # Deploy via Docker Swarm (igual ao BCards) ssh -o StrictHostKeyChecking=no ubuntu@141.148.162.114 << 'EOF' # Puxa nova imagem docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest @@ -167,18 +167,27 @@ jobs: sudo mkdir -p /app/keys sudo chown -R 1000:1000 /app/keys + # Cria a rede overlay se não existir + docker network create --driver overlay --attachable qrrapido-network || echo "Rede já existe" + # Atualiza o service ou cria se não existir docker service update \ --image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ + --env-add Serilog__OpenSearchUrl="http://141.148.162.114:19201" \ + --env-add Serilog__OpenSearchFallback="http://129.146.116.218:19202" \ qrrapido-prod \ || \ docker service create \ --name qrrapido-prod \ --replicas 2 \ - --network host \ + --network qrrapido-network \ + --publish published=5001,target=8080 \ + --constraint "node.role==worker" \ --mount type=bind,source=/app/keys,target=/app/keys \ --env ASPNETCORE_ENVIRONMENT=Production \ - --env ASPNETCORE_URLS=http://+:5001 \ + --env ASPNETCORE_URLS=http://+:8080 \ + --env Serilog__OpenSearchUrl="http://141.148.162.114:19201" \ + --env Serilog__OpenSearchFallback="http://129.146.116.218:19202" \ --update-delay 30s \ --update-parallelism 1 \ --update-order start-first \ @@ -208,11 +217,11 @@ jobs: # Verifica se os serviços estão respondendo em ambos servidores echo "Verificando Servidor 1..." - ssh -o StrictHostKeyChecking=no ubuntu@141.148.162.114 'curl -f http://localhost:5001/health || echo "Servidor 1 pode não estar respondendo"' + ssh -o StrictHostKeyChecking=no ubuntu@141.148.162.114 'curl -f http://localhost:5001/health || echo "⚠️ Servidor 1 pode não estar respondendo"' echo "Verificando Servidor 2..." - ssh -o StrictHostKeyChecking=no ubuntu@129.146.116.218 'curl -f http://localhost:5001/health || echo "Servidor 2 pode não estar respondendo"' + ssh -o StrictHostKeyChecking=no ubuntu@129.146.116.218 'curl -f http://localhost:5001/health || echo "⚠️ Servidor 2 pode não estar respondendo"' # Testa o site principal echo "Testando site principal..." - curl -f https://qrrapido.site || echo "Site principal pode não estar respondendo" \ No newline at end of file + curl -f https://qrrapido.site || echo "⚠️ Site principal pode não estar respondendo" \ No newline at end of file