From 1cd4c7bb6600e1e86ab1225b54890d081c678e25 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Sat, 10 Jan 2026 22:26:52 +0000 Subject: [PATCH] Ensure copy from installed WP package files doesn't zap existing files. In particular, we were zapping plugins, uploads and themes. So the whole site went blank. --- pillar/secrets/restic.sls.sample | 3 +++ pillar/top.sls | 1 + states/backup/cloud_restic_cron.daily | 3 +++ states/backup/hedwig_restic_cron.daily | 1 + states/top.sls | 1 + states/villagehall_website/init.sls | 2 -- 6 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 states/backup/cloud_restic_cron.daily diff --git a/pillar/secrets/restic.sls.sample b/pillar/secrets/restic.sls.sample index 35f85d5..0e5d861 100644 --- a/pillar/secrets/restic.sls.sample +++ b/pillar/secrets/restic.sls.sample @@ -1,2 +1,5 @@ restic_password: social: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + scabbers: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + hedwig: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + cloud: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' diff --git a/pillar/top.sls b/pillar/top.sls index e8359a1..a17ab96 100644 --- a/pillar/top.sls +++ b/pillar/top.sls @@ -26,3 +26,4 @@ base: - secrets/mariadb - secrets/wordpress - nextcloud/cloud + - secrets/restic diff --git a/states/backup/cloud_restic_cron.daily b/states/backup/cloud_restic_cron.daily new file mode 100644 index 0000000..2e27b98 --- /dev/null +++ b/states/backup/cloud_restic_cron.daily @@ -0,0 +1,3 @@ +#!/bin/sh +mysqldump --all-databases > /root/mysql.sql +exec /usr/bin/restic --password-file /etc/restic.pass --repo /var/local/backup/restic backup /etc --exclude="*.o" /etc /root /home /var/mail /usr/local /var/lib/wordpress /srv diff --git a/states/backup/hedwig_restic_cron.daily b/states/backup/hedwig_restic_cron.daily index 5c5a23a..2e27b98 100644 --- a/states/backup/hedwig_restic_cron.daily +++ b/states/backup/hedwig_restic_cron.daily @@ -1,2 +1,3 @@ #!/bin/sh +mysqldump --all-databases > /root/mysql.sql exec /usr/bin/restic --password-file /etc/restic.pass --repo /var/local/backup/restic backup /etc --exclude="*.o" /etc /root /home /var/mail /usr/local /var/lib/wordpress /srv diff --git a/states/top.sls b/states/top.sls index b431c3b..62ac97c 100644 --- a/states/top.sls +++ b/states/top.sls @@ -58,6 +58,7 @@ base: - mariadb - apache - php_fpm/trixie + - backup/restic - cloud - villagehall_website diff --git a/states/villagehall_website/init.sls b/states/villagehall_website/init.sls index da331fd..b05f8f6 100644 --- a/states/villagehall_website/init.sls +++ b/states/villagehall_website/init.sls @@ -20,8 +20,6 @@ villagehall_framework_package_content: - name: /var/lib/wordpress/wp-content-villagehall - source: /var/lib/wordpress/wp-content - makedirs: True - - force: True - - preserve: True - user: www-data - group: www-data - dir_mode: 755