diff --git a/.github/workflows/rollback.yml b/.github/workflows/rollback.yml index 6c70416..88fa04c 100644 --- a/.github/workflows/rollback.yml +++ b/.github/workflows/rollback.yml @@ -19,8 +19,16 @@ jobs: contents: write packages: read pull-requests: write + id-token: write steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + token: ${{ secrets.GH_PAT }} + - name: Determine rollback version run: | if [ -n "${{ github.event.inputs.version }}" ]; then @@ -119,16 +127,22 @@ jobs: start_period: 60s EOF - - name: Sync rollback compose to VPS + - name: Create temporary .env file run: | - rsync -avz \ - docker-compose.rollback.yaml \ + echo "DD_API_KEY=${{ secrets.DATADOG_API_KEY }}" > .env + + - name: Sync rollback compose and env to VPS + run: | + rsync -avz --delete \ + docker-compose.rollback.yaml .env \ ${{ secrets.VPS_SSH_USER }}@${{ secrets.VPS_SSH_HOST }}:/home/ubuntu/app/site/ - name: Deploy rollback version on VPS run: | ssh ${{ secrets.VPS_SSH_USER }}@${{ secrets.VPS_SSH_HOST }} << 'EOF' cd /home/ubuntu/app/site + rm -f .env + echo "DD_API_KEY=${{ secrets.DATADOG_API_KEY }}" >> .env docker compose -f docker-compose.rollback.yaml pull docker compose -f docker-compose.rollback.yaml up -d --remove-orphans docker system prune -f @@ -149,11 +163,6 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Create rollback PR run: | ROLLBACK_TAG="v${ROLLBACK_VERSION}" @@ -181,25 +190,12 @@ jobs: --base main \ --head ${PR_BRANCH} \ --title "Rollback: Revert to v${ROLLBACK_VERSION}" \ - --body "🚨 **Automatic Rollback PR** - -This PR reverts the codebase to version \`v${ROLLBACK_VERSION}\` to match the environment rollback. - -**What changed:** -- Environment was rolled back to version \`v${ROLLBACK_VERSION}\` -- This PR synchronizes the source code to match - -**Instructions:** -1. Review the changes carefully -2. Merge this PR to update main with the previous stable version - ---- -*This PR was automatically created by the Rollback workflow*" + --body "Automatic Rollback PR - This PR reverts the codebase to v${ROLLBACK_VERSION} to match the environment rollback. Review the changes carefully and merge to update main with the previous stable version. This PR was automatically created by the Rollback workflow." else echo "PR #${EXISTING_PR} already exists for this rollback" fi env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GH_PAT }} environment: name: Production diff --git a/backend/src/infrastructure/adapters/outbound_postgres_adapter.py b/backend/src/infrastructure/adapters/outbound_postgres_adapter.py index 7038340..f940702 100644 --- a/backend/src/infrastructure/adapters/outbound_postgres_adapter.py +++ b/backend/src/infrastructure/adapters/outbound_postgres_adapter.py @@ -38,11 +38,12 @@ def build_connection_string(self) -> str: def build_engine(self, retry_interval: int = 5): attempt = 0 - + logger.info(f"Conectando ao banco de dados: {self._obfuscated_connection_string()}") + while True: attempt += 1 try: - engine = create_engine(self.connection_string, + engine = create_engine(self.connection_string, echo=False, pool_size=5, max_overflow=10,