group "chefrepo"
mode 0750
end
+
+template "/etc/cron.daily/chef-repository-backup" do
+ source "repository-backup.cron.erb"
+ owner "root"
+ group "root"
+ mode 0755
+end
apache_site "chef.openstreetmap.org" do
template "apache.erb"
end
+
+template "/etc/cron.daily/chef-server-backup" do
+ source "server-backup.cron.erb"
+ owner "root"
+ group "root"
+ mode 0755
+end
--- /dev/null
+#!/bin/sh
+
+T=$(mktemp -d -t -p /var/tmp chef-repository.XXXXXXXXXX)
+D=$(date +%Y-%m-%d)
+B=chef-repository-$D.tar.gz
+
+ln -s /var/lib/git/chef.git $T/chef-repository-$D
+
+export GZIP="--rsyncable -9"
+
+nice tar --create --gzip --dereference --directory=$T --file=$T/$B chef-repository-$D
+nice rsync $T/$B backup::backup
+
+rm -rf $T
--- /dev/null
+#!/bin/sh
+
+T=$(mktemp -d -t -p /var/tmp chef-server.XXXXXXXXXX)
+D=$(date +%Y-%m-%d)
+B=chef-server-$D.tar.gz
+
+mkdir $T/chef-server-$D
+chgrp opscode-pgsql $T $T/chef-server-$D
+chmod g+rwx $T $T/chef-server-$D
+sudo -u opscode-pgsql /opt/chef-server/embedded/bin/pg_dump --file=$T/chef-server-$D/chef.dmp --clean opscode_chef
+ln -s /var/opt/chef-server/bookshelf/data $T/chef-server-$D/bookshelf
+
+export GZIP="--rsyncable -9"
+
+nice tar --create --gzip --dereference --directory=$T --file=$T/$B chef-server-$D
+nice rsync $T/$B backup::backup
+
+rm -rf $T