diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index c2c08cd..6e7aa99 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -11,13 +11,27 @@ jobs: - name: Kodu Cek uses: actions/checkout@v4 - - name: Docker Build + - name: Docker Build (Backend) run: docker build -t iddaai-be:latest . - - name: Eski Konteyneri Sil - run: docker rm -f iddaai-be || true + - name: Docker Build (AI Engine) + run: docker build -t iddaai-ai-engine:latest ./ai-engine - - name: Yeni Versiyonu Baslat + - name: Eski Konteynerleri Sil + run: | + docker rm -f iddaai-be || true + docker rm -f iddaai-ai-engine || true + + - name: AI Engine'i Baslat + run: | + docker run -d \ + --name iddaai-ai-engine \ + --restart unless-stopped \ + --network iddaai_iddaai-network \ + -e DATABASE_URL='${{ secrets.DATABASE_URL }}' \ + iddaai-ai-engine:latest + + - name: Backend'i Baslat run: | docker run -d \ --name iddaai-be \ @@ -34,13 +48,12 @@ jobs: -e JWT_ACCESS_EXPIRATION='1d' \ iddaai-be:latest /bin/sh -c "npx prisma migrate deploy && node dist/src/main.js" - - name: AI Engine Network Alias Garantile + - name: Saglik Kontrolu run: | - AI_CONTAINER=$(docker ps --format '{{.Names}}' | grep iddaai-ai-engine | head -1) - if [ -n "$AI_CONTAINER" ]; then - docker network disconnect iddaai_iddaai-network $AI_CONTAINER 2>/dev/null || true - docker network connect --alias iddaai-ai-engine iddaai_iddaai-network $AI_CONTAINER - echo "AI engine alias eklendi: $AI_CONTAINER" - else - echo "AI engine container bulunamadi, alias atlanamadi" - fi + sleep 10 + echo "=== AI Engine logs ===" + docker logs --tail 30 iddaai-ai-engine || true + echo "=== Backend logs ===" + docker logs --tail 30 iddaai-be || true + echo "=== AI Engine health ===" + docker exec iddaai-ai-engine python -c "import urllib.request; print(urllib.request.urlopen('http://127.0.0.1:8000/health').read().decode())" || echo "AI engine health check failed" \ No newline at end of file