Skip to content

Commit

Permalink
Backup and store in GCS
Browse files Browse the repository at this point in the history
  • Loading branch information
john-craft committed Oct 20, 2023
1 parent ff39f1e commit 1d867f9
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/snapshot-data.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Anonymize production data to staging database
name: Deploy app to Cloud Run
on:
pull_request:
branches: [ main ]
Expand All @@ -21,15 +21,34 @@ jobs:
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true

- name: Build and Push Docker Image
- name: Build and push database image
run: |
cd ./db
docker build -t destination-db .
gcloud auth configure-docker
docker tag destination-db:latest gcr.io/database-migration-anonymized/destination-db
docker push gcr.io/database-migration-anonymized/destination-db
- name: Deploy to CloudRun # Cloud Run service must already exist
- name: Deploy to Cloud Run # service must already exist
run: |
gcloud run deploy destination-database --image=gcr.io/database-migration-anonymized/destination-db --platform managed --allow-unauthenticated --region us-west1
gcloud run deploy destination-database \
--image=gcr.io/database-migration-anonymized/destination-db \
--platform managed \
--allow-unauthenticated \
--region us-west1
- name: Backup database
run: |
pg_dump -h db \
-U postgres \
-d postgres \
-F t \
-f db_backup.tar
- name: Copy backup to storage
run: |
gsutil cp db_backup.tar gs://anonymize-db-backups

0 comments on commit 1d867f9

Please sign in to comment.