Skip to content

Commit

Permalink
Merge branch 'path-fix' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rikukissa committed Apr 29, 2024
2 parents 4bfbf20 + 22c6359 commit e12507f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion infrastructure/server-setup/backups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@

- name: Copy rotate_backups.sh file to external_backup_server_user's home directory
copy:
src: infrastructure/backups/rotate_backups.sh
src: ../backups/rotate_backups.sh
dest: '{{ external_backup_server_user_home }}/rotate_backups.sh'
owner: '{{ external_backup_server_user }}'
mode: 0755
Expand All @@ -155,3 +155,5 @@
hour: '0'
job: 'bash {{ external_backup_server_user_home }}/rotate_backups.sh --backup_dir={{ external_backup_server_remote_directory }} --amount_to_keep={{ amount_of_backups_to_keep }} >> /var/log/opencrvs-rotate-backups.log 2>&1'
state: "{{ 'present' if (amount_of_backups_to_keep) else 'absent' }}"
tags:
- backups
1 change: 0 additions & 1 deletion infrastructure/server-setup/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ ansible_python_interpreter: /usr/bin/python3
encrypt_data: False
swap_file_path: /swapfile
swap_file_size_mb: 8000
external_backup_server_remote_directory: /home/backup/backups
external_backup_server_user: 'backup'
5 changes: 2 additions & 3 deletions infrastructure/server-setup/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,5 @@ backups:
hosts:
farajaland-qa:
ansible_host: '165.22.110.53'
vars:
# @todo how many days to store backups for?
amount_of_backups_to_keep: 3
# @todo how many days to store backups for?
amount_of_backups_to_keep: 3
5 changes: 2 additions & 3 deletions infrastructure/server-setup/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ backups:
hosts:
farajaland-qa:
ansible_host: '165.22.110.53'
vars:
# @todo how many days to store backups for?
amount_of_backups_to_keep: 3
# @todo how many days to store backups for?
amount_of_backups_to_keep: 3
9 changes: 8 additions & 1 deletion infrastructure/server-setup/tasks/backups/crontab.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
- name: Copy backups.sh file to external_backup_server_user's home directory
copy:
src: ../backups/backup.sh
dest: '{{ crontab_user_home }}/backup.sh'
owner: 'root'
mode: 0755

- name: 'Setup crontab to backup the opencrvs data'
cron:
user: '{{ crontab_user }}'
name: 'backup opencrvs'
minute: '0'
hour: '0'
job: 'cd / && bash /opt/opencrvs/infrastructure/backups/backup.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 }} --replicas=1 >> /var/log/opencrvs-backup.log 2>&1'
job: 'bash {{ crontab_user_home }}/backup.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 }} --replicas=1 >> /var/log/opencrvs-backup.log 2>&1'
state: "{{ 'present' if (external_backup_server_ip is defined and backup_encryption_passphrase and (enable_backups | default(false))) else 'absent' }}"

##
Expand Down

0 comments on commit e12507f

Please sign in to comment.