Skip to content
Snippets Groups Projects
Verified Commit 0da7342f authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

remove subPath, fix comments, remove tmp directory after using it

parent 30024e2d
No related branches found
No related tags found
1 merge request!2rsync backups to remote storage
Pipeline #4720 passed with stage
in 50 seconds
......@@ -9,8 +9,8 @@ helm delete $releaseName
## Delete remaining PVCs:
kubectl delete pvc \
data-$releaseName-database-master-0 \
data-$releaseName-database-slave-0 \
redis-data-$releaseName-redis-master-0
redis-data-$releaseName-redis-slave-0
data-$releaseName-database-master-0 \
data-$releaseName-database-slave-0 \
redis-data-$releaseName-redis-master-0 \
redis-data-$releaseName-redis-slave-0 \
redis-data-$releaseName-redis-slave-1
......@@ -173,7 +173,6 @@ spec:
mountPath: /var/local/ssh-private-key
- name: ssh-known-hosts
mountPath: /etc/ssh/ssh_known_hosts
subPath: ssh_known_hosts
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
......
......@@ -141,8 +141,8 @@ redis:
# -----BEGIN OPENSSH PRIVATE KEY-----
# ...
# -----END OPENSSH PRIVATE KEY-----
# # Mounted to /etc/ssh/known_hosts. Required when `backup.target` is reached
# # via SSH
# # Mounted to /etc/ssh/ssh_known_hosts. Required when `sshPrivateKey` is
# # provided, ignored otherwise
# sshKnownHosts: |
# hostname keytype key
# # The interval at which backups occur. Defaults to 86400 seconds (24 hours)
......
......@@ -10,9 +10,7 @@ ENV ANSIBLE_CONFIG /var/local/ansible/ansible.cfg
# be writable for ssh to work.
RUN mkdir -p /etc/X11/fs && chown -R 33:33 /etc/X11/fs
# SSH Identity file location for backup playbook. It's in /etc/X11/fs which is
# the default home directory for the user with ID 33, which is the UID of the
# www-data user in the Debian container that runs the site...
# SSH Identity file location for backup playbook
RUN mkdir -p /etc/ssh/ && echo "IdentityFile /var/local/ssh-private-key/ssh-private-key" > /etc/ssh/ssh_config
# Chown the files to the Debian www-data user, because that's the only WP
......
......@@ -7,19 +7,20 @@
changed_when: false
- block:
- name: Create temporary backups directory
tempfile:
state: directory
suffix: backup
register: backup_dir
- name: Export WordPress database to file
shell:
wp {{ cli_args }} db export "{{ backup_dir.path }}/{{ backup_filename }}"
# Never overwrite an existing file.
args:
creates: "{{ backup_dir.path }}/{{ backup_filename }}"
- name: Copy export to backup location
shell:
rsync -a "{{ backup_dir.path }}/{{ backup_filename }}" "{{ BACKUP_TARGET }}"
- name: Create temporary backups directory
tempfile:
state: directory
suffix: backup
register: backup_dir
- name: Export WordPress database to file
shell:
wp {{ cli_args }} db export "{{ backup_dir.path }}/{{ backup_filename }}"
- name: Copy export to backup location
shell:
rsync -a "{{ backup_dir.path }}/{{ backup_filename }}" "{{ BACKUP_TARGET }}"
- name: Remove temporary backups directory
file:
state: absent
path: "{{ backup_dir.path }}/"
vars:
backup_filename: "wp-db-{{ BACKUP_NAME }}-{{ date.stdout }}.sql"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment