From 29d5a3bf602b62a94d001d092bc984e97e251c7e Mon Sep 17 00:00:00 2001 From: euanmillar Date: Tue, 20 Feb 2024 11:44:00 +0000 Subject: [PATCH] remove restore-backup-encryption-passphrase --- .github/workflows/provision.yml | 1 - infrastructure/server-setup/staging.yml | 1 - .../server-setup/tasks/backups/crontab.yml | 12 ++++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/provision.yml b/.github/workflows/provision.yml index 888dd6c9c..e9da7ad77 100644 --- a/.github/workflows/provision.yml +++ b/.github/workflows/provision.yml @@ -74,7 +74,6 @@ jobs: mongodb_admin_username: ${{ secrets.MONGODB_ADMIN_USER }} mongodb_admin_password: ${{ secrets.MONGODB_ADMIN_PASSWORD }} backup_encryption_passphrase: ${{ secrets.BACKUP_ENCRYPTION_PASSPHRASE }} - restore_backup_encryption_passphrase: ${{ secrets.RESTORE_BACKUP_ENCRYPTION_PASSPHRASE }} elasticsearch_superuser_password: ${{ secrets.ELASTICSEARCH_SUPERUSER_PASSWORD }} external_backup_server_ssh_port: 22 external_backup_server_ip: ${{ secrets.BACKUP_HOST }} diff --git a/infrastructure/server-setup/staging.yml b/infrastructure/server-setup/staging.yml index ab7590dd5..1d34f18ec 100644 --- a/infrastructure/server-setup/staging.yml +++ b/infrastructure/server-setup/staging.yml @@ -15,7 +15,6 @@ all: - 165.22.110.53 enable_backups: false periodic_restore_from_backup: true - # restore_backup_encryption_passphrase: Defined in --extra-vars by the provisioning pipeline # external_backup_server_ssh_port: Defined in --extra-vars by the provisioning pipeline # external_backup_server_ip: Defined in --extra-vars by the provisioning pipeline users: diff --git a/infrastructure/server-setup/tasks/backups/crontab.yml b/infrastructure/server-setup/tasks/backups/crontab.yml index f20fe5e51..7527efea2 100644 --- a/infrastructure/server-setup/tasks/backups/crontab.yml +++ b/infrastructure/server-setup/tasks/backups/crontab.yml @@ -16,10 +16,10 @@ periodic_restore_from_backup: false when: periodic_restore_from_backup is not defined -- name: Throw an error if periodic_restore_from_backup is true but restore_backup_encryption_passphrase is not defined +- name: Throw an error if periodic_restore_from_backup is true but backup_encryption_passphrase is not defined fail: - msg: 'Error: restore_backup_encryption_passphrase is not defined. It usually means you have not set RESTORE_BACKUP_ENCRYPTION_PASSPHRASE in your staging environments secrets' - when: periodic_restore_from_backup and restore_backup_encryption_passphrase is not defined + msg: 'Error: backup_encryption_passphrase is not defined. It usually means you have not set backup_encryption_passphrase in your staging environments secrets' + when: periodic_restore_from_backup and backup_encryption_passphrase is not defined - name: 'Setup crontab to download a backup periodically the opencrvs data' cron: @@ -27,8 +27,8 @@ name: 'download opencrvs backup' minute: '30' hour: '0' - job: 'cd / && bash /opt/opencrvs/infrastructure/backups/download.sh --passphrase={{ restore_backup_encryption_passphrase }} --ssh_user={{ external_backup_server_user }} --ssh_host={{ external_backup_server_ip }} --ssh_port={{ external_backup_server_ssh_port }} --remote_dir={{ external_backup_server_remote_directory }} >> /var/log/opencrvs-restore.log 2>&1' - state: "{{ 'present' if (external_backup_server_ip is defined and restore_backup_encryption_passphrase and periodic_restore_from_backup) else 'absent' }}" + job: 'cd / && bash /opt/opencrvs/infrastructure/backups/download.sh --passphrase={{ backup_encryption_passphrase }} --ssh_user={{ external_backup_server_user }} --ssh_host={{ external_backup_server_ip }} --ssh_port={{ external_backup_server_ssh_port }} --remote_dir={{ external_backup_server_remote_directory }} >> /var/log/opencrvs-restore.log 2>&1' + state: "{{ 'present' if (external_backup_server_ip is defined and backup_encryption_passphrase and periodic_restore_from_backup) else 'absent' }}" - name: 'Setup crontab to restore the opencrvs data' cron: @@ -37,4 +37,4 @@ minute: '0' hour: '1' job: 'cd / && bash /opt/opencrvs/infrastructure/backups/restore.sh --replicas=1 >> /var/log/opencrvs-restore.log 2>&1' - state: "{{ 'present' if (external_backup_server_ip is defined and restore_backup_encryption_passphrase and periodic_restore_from_backup) else 'absent' }}" + state: "{{ 'present' if (external_backup_server_ip is defined and backup_encryption_passphrase and periodic_restore_from_backup) else 'absent' }}"