From 9e704f5845eccb942f0aad8ffffdd045c9aec349 Mon Sep 17 00:00:00 2001 From: RMcVelia Date: Wed, 30 Oct 2024 09:53:23 +0000 Subject: [PATCH] backup workflow testing --- .github/workflows/database-backup.yml | 54 +++++++++++++-------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/database-backup.yml b/.github/workflows/database-backup.yml index a92d2dde0..23b0f7e34 100644 --- a/.github/workflows/database-backup.yml +++ b/.github/workflows/database-backup.yml @@ -67,18 +67,18 @@ jobs: inlineScript: | az postgres flexible-server firewall-rule create --name ${{ env.POSTGRES_SERVER_NAME }} --resource-group ${{ env.RESOURCE_GROUP_NAME }} --rule-name Allow-GithubRunner-Postgres --start-ip-address ${{ env.RUNNER_IP }} --end-ip-address ${{ env.RUNNER_IP }} - - name: Add PG PASS - shell: bash - run: | - echo '${{ env.POSTGRES_SERVER_HOST_NAME }}:5432:${{ env.POSTGRES_DATABASE_NAME }}:${{ steps.get_infrastructure_secrets.outputs.POSTGRES_ADMIN_USERNAME }}:${{ steps.get_infrastructure_secrets.outputs.POSTGRES_ADMIN_PASSWORD }}' >> ~/.pgpass - chmod 600 ~/.pgpass + # - name: Add PG PASS + # shell: bash + # run: | + # echo '${{ env.POSTGRES_SERVER_HOST_NAME }}:5432:${{ env.POSTGRES_DATABASE_NAME }}:${{ steps.get_infrastructure_secrets.outputs.POSTGRES_ADMIN_USERNAME }}:${{ steps.get_infrastructure_secrets.outputs.POSTGRES_ADMIN_PASSWORD }}' >> ~/.pgpass + # chmod 600 ~/.pgpass - - name: Run PG Dump - shell: bash - run: | - export PGSSLMODE=require - pg_dump -Fc -v --host=${{ env.POSTGRES_SERVER_HOST_NAME }} --port=5432 --username=${{ steps.get_infrastructure_secrets.outputs.POSTGRES_ADMIN_USERNAME }} --dbname=${{ env.POSTGRES_DATABASE_NAME }} > ${{ env.BACKUP_FILE_NAME }}.sql - zip -r ${{ env.BACKUP_FILE_NAME }}.sql.zip ${{ env.BACKUP_FILE_NAME }}.sql + # - name: Run PG Dump + # shell: bash + # run: | + # export PGSSLMODE=require + # pg_dump -Fc -v --host=${{ env.POSTGRES_SERVER_HOST_NAME }} --port=5432 --username=${{ steps.get_infrastructure_secrets.outputs.POSTGRES_ADMIN_USERNAME }} --dbname=${{ env.POSTGRES_DATABASE_NAME }} > ${{ env.BACKUP_FILE_NAME }}.sql + # zip -r ${{ env.BACKUP_FILE_NAME }}.sql.zip ${{ env.BACKUP_FILE_NAME }}.sql - name: Delete firewall rule if: always() @@ -88,20 +88,20 @@ jobs: inlineScript: | az postgres flexible-server firewall-rule delete --name ${{ env.POSTGRES_SERVER_NAME }} --resource-group ${{ env.RESOURCE_GROUP_NAME }} --rule-name Allow-GithubRunner-Postgres --yes - - name: Upload Backup to Azure Storage - run: | - az storage blob upload --container-name get-an-identity \ - --file ${BACKUP_FILE_NAME}.sql.zip --name ${BACKUP_FILE_NAME}.sql.zip \ - --connection-string '${{ steps.get_storage_secret.outputs.BACKUP-STORAGE-CONNECTION-STRING }}' \ - --overwrite true + # - name: Upload Backup to Azure Storage + # run: | + # az storage blob upload --container-name get-an-identity \ + # --file ${BACKUP_FILE_NAME}.sql.zip --name ${BACKUP_FILE_NAME}.sql.zip \ + # --connection-string '${{ steps.get_storage_secret.outputs.BACKUP-STORAGE-CONNECTION-STRING }}' \ + # --overwrite true - - name: Notify Slack channel on job failure - if: failure() - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_USERNAME: CI Deployment - SLACK_TITLE: Database backup failure - SLACK_MESSAGE: Production database backup job failed. Also check the azure postgres server firewall rules. - SLACK_WEBHOOK: ${{ steps.get_monitoring_secret.outputs.SLACK_WEBHOOK }} - SLACK_COLOR: failure - SLACK_FOOTER: Sent from backup job in database-backup workflow + # - name: Notify Slack channel on job failure + # if: failure() + # uses: rtCamp/action-slack-notify@v2 + # env: + # SLACK_USERNAME: CI Deployment + # SLACK_TITLE: Database backup failure + # SLACK_MESSAGE: Production database backup job failed. Also check the azure postgres server firewall rules. + # SLACK_WEBHOOK: ${{ steps.get_monitoring_secret.outputs.SLACK_WEBHOOK }} + # SLACK_COLOR: failure + # SLACK_FOOTER: Sent from backup job in database-backup workflow