Skip to content

Commit

Permalink
remove restore-backup-encryption-passphrase
Browse files Browse the repository at this point in the history
  • Loading branch information
euanmillar committed Feb 20, 2024
1 parent 8959de7 commit 29d5a3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 0 additions & 1 deletion infrastructure/server-setup/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions infrastructure/server-setup/tasks/backups/crontab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
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:
user: '{{ crontab_user }}'
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:
Expand All @@ -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' }}"

0 comments on commit 29d5a3b

Please sign in to comment.