From fcaa26422adbb73272f558c5e05758dc82e39be9 Mon Sep 17 00:00:00 2001 From: thorstenspille Date: Mon, 2 Oct 2023 00:18:34 +0200 Subject: [PATCH] Install checkzfs and zsync --- postinstall | 59 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/postinstall b/postinstall index 4ec20bd..ecda6b0 100755 --- a/postinstall +++ b/postinstall @@ -3,22 +3,23 @@ # This script configures basic settings and install standard tools on your Proxmox VE Server with ZFS storage # # Features: -# - Configure ZFS ARC Cache -# - Configure vm.swappiness -# - Install and configure zfs-auto-snapshot -# - Switch pve-enterprise/pve-no-subscription repo -# - Disable "No subscription message" in webinterface in no-subscription mode -# - Add pve-enterprise subscription key -# - Configure ceph repo -# - Update system to the latest version -# - Install common tools -# - Install Proxmox SDN Extensions -# - Configure automatic backup of /etc Folder -# - Configure locales -# - SSH server hardening +# + Configure ZFS ARC Cache +# + Configure vm.swappiness +# + Install and configure zfs-auto-snapshot +# + Switch pve-enterprise/pve-no-subscription/pvetest repo +# + Disable "No subscription message" in webinterface in no-subscription mode +# + Add pve-enterprise subscription key +# + Update system to the latest version +# + Install common tools +# + Install Proxmox SDN Extensions +# + Configure automatic backup of /etc Folder +# + Configure locales +# + SSH server hardening +# + Install checkzfs +# + Install bashclub-zsync +# - Create zfspool storage for swap disks if not exists # - Configure proxmox mail delivery with postfix # - Adjust default volblocksize for Proxmox zfspool storages -# - Create zfspool storage for swap disks if not exists # # # Author: (C) 2023 Thorsten Spille @@ -385,6 +386,34 @@ set_default_volblocksize(){ echo "" } +install_checkzfs(){ + wget -q --no-cache -O /usr/local/bin/checkzfs https://raw.githubusercontent.com/bashclub/check-zfs-replication/main/checkzfs.py + chmod +x /usr/local/bin/checkzfs + wget -q --no-cache -O /usr/local/bin/check-snapshot-age https://raw.githubusercontent.com/bashclub/check-zfs-replication/main/check-snapshot-age + chmod +x /usr/local/bin/check-snapshot-age +} + +install_zsync(){ + wget -q --no-cache -O /usr/bin/bashclub-zsync https://git.bashclub.org/bashclub/zsync/raw/branch/main/bashclub-zsync/usr/bin/bashclub-zsync + chmod +x /usr/bin/bashclub-zsync + bashclub-zsync + cat << EOF > /etc/logrotate.d/bashclub-zsync +/var/log/bashclub-zsync/*.log { + weekly + rotate 12 + compress + delaycompress + missingok + notifempty + create 644 root root +} +EOF + mkdir -p /var/log/bashclub-zsync-example + cat << EOF > /etc/cron.d/bashclub-zsync +#00 23 * * * root /usr/bin/bashclub-zsync -c /etc/bashclub/zsync.conf > /var/log/bashclub-zsync/zsync.log +EOF +} + installation_task(){ set_locales set_pve_repo @@ -397,6 +426,8 @@ installation_task(){ pve_conf_backup suppress_no_subscription_warning harden_ssh + install_checkzfs + install_zsync set_mail_delivery create_swap_pool set_default_volblocksize