Browse Source

new: [host] minimal host backup config

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
backup
Valentin Lab 4 years ago
parent
commit
7c83ad0b97
  1. 1
      precise/host/hooks/install.d/70-0k.sh
  2. 70
      precise/host/hooks/install.d/96-backup-lxc.sh

1
precise/host/hooks/install.d/70-0k.sh

@ -225,7 +225,6 @@ rm -rf /var/cache/compose
cat <<EOF > /etc/default/datastore cat <<EOF > /etc/default/datastore
DATASTORE=/srv/datastore DATASTORE=/srv/datastore
SNAPSHOT_BACKUP=/var/backups/snapshot
EOF EOF
cat <<EOF > /etc/default/compose cat <<EOF > /etc/default/compose

70
precise/host/hooks/install.d/96-backup-lxc.sh

@ -8,3 +8,73 @@
ln -sf /opt/apps/lxc-scripts/etc/cron.hourly/* /etc/cron.hourly/ ln -sf /opt/apps/lxc-scripts/etc/cron.hourly/* /etc/cron.hourly/
ln -sf /opt/apps/lxc-scripts/etc/cron.daily/* /etc/cron.daily/ ln -sf /opt/apps/lxc-scripts/etc/cron.daily/* /etc/cron.daily/
if ! grep ^BACKUP_LXC_PATH= /etc/default/lxc >/dev/null 2>&1; then
echo "BACKUP_LXC_PATH=/var/backups/lxc" >> /etc/default/lxc
fi
if ! grep ^BACKUP_SNAPSHOT_PATH= /etc/default/datastore >/dev/null 2>&1; then
echo "BACKUP_SNAPSHOT_PATH=/var/backups/snapshot" >> /etc/default/datastore
fi
##
## Mirror dir's logrotate and rsyslog's entry
##
mkdir -p /etc/mirror-dir
cat <<EOF > /etc/mirror-dir/config.yml
default:
sources:
- /etc
- /opt
- /root
- /var/log
- /var/lib/lxc
- /home
- /boot
- /srv
- /var/backups/lxc/latest
/var/lib/lxc:
exclude:
- /*/rootfs
EOF
cat <<EOF > /etc/rsyslog.d/mirror-dir.conf
if \$programname == 'mirror-dir' then {
action(type="omfile" file="/var/log/mirror-dir.log")
stop
}
EOF
service rsyslog restart
cat <<EOF > /etc/logrotate.d/mirror-dir.log
/var/log/mirror-dir.log
{
weekly
missingok
dateext
dateyesterday
dateformat _%Y-%m-%d
extension .log
rotate 52
compress
delaycompress
notifempty
create 640 root root
sharedscripts
postrotate
reload rsyslog >/dev/null 2>&1 || true
endscript
}
EOF
Loading…
Cancel
Save