-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to backup production DB
- Loading branch information
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Backup production database | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 4 * * *" # 04:00 UTC | ||
push: | ||
branches: | ||
- backup-db | ||
|
||
jobs: | ||
backup: | ||
name: Backup database | ||
runs-on: ubuntu-latest | ||
|
||
environment: production | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_version: 1.5.0 | ||
terraform_wrapper: false | ||
|
||
- uses: DFE-Digital/github-actions/set-arm-environment-variables@master | ||
with: | ||
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
||
- name: Get Azure backup storage details | ||
id: azure-backup-storage | ||
run: | | ||
set -e | ||
#make ci production_aks terraform-init | ||
make ci production_aks | ||
terraform -chdir=terraform/aks init -backend-config workspace_variables/production.backend.tfvars -reconfigure -input=false | ||
echo "account-name=$(terraform -chdir=terraform/aks output -raw postgres_azure_backup_storage_account_name)" >> $GITHUB_OUTPUT | ||
echo "container-name=$(terraform -chdir=terraform/aks output -raw postgres_azure_backup_storage_container_name)" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "postgres_azure_backup_storage_account_name" { | ||
value = module.postgres.azure_backup_storage_account_name | ||
} | ||
|
||
output "postgres_azure_backup_storage_container_name" { | ||
value = module.postgres.azure_backup_storage_container_name | ||
} |