--- /dev/null
+#!/bin/bash
+
+# Copyright (c) 2010, 2011, 2013, 2014 Peter Palfrader
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# Archive a postgresql file (WAL or BASE) to the archive server $backuphost
+# can be set in /etc/dsa/pg-backup-file.conf
+
+set -u
+
+backuphost=debbackup@storace
+myhost="`hostname`"
+self="`basename "$0"`[$$]"
+
+if [ "$#" != 3 ] ; then
+ echo >&2 "Usage: $self <cluster> <WAL|BASE> <file>"
+ exit 1
+fi
+
+ssh_options=""
+! [ -e /etc/dsa/pg-backup-file.conf ] || . /etc/dsa/pg-backup-file.conf
+
+cluster="$1"
+what="$2"
+file="$3"
+
+info() {
+ logger -p daemon.info -t "$self" "$1"
+}
+
+croak() {
+ logger -s -p daemon.warn -t "$self" "$1"
+ exit 1
+}
+
+if ! [ -e "$file" ] ; then
+ croak "file $file does not exist"
+fi
+
+size="`stat -c '%s' "$file"`"
+checksum=""
+bn="`basename "$file"`"
+targetname="$cluster.$what.$bn"
+logtuple_start="($myhost,$targetname,$size"
+failures=""
+
+for target in $backuphost; do
+ if [ "${target#/}" != "$target" ]; then
+ info "Archiving to $target: ($targetname,$size)"
+ cp "$file" "$target/$myhost-$targetname"
+ else
+ [ -n "$checksum" ] || checksum="`sha512sum "$file" | awk '{print $1}'`"
+ info "Archiving to $target: ($myhost,$targetname,$size,$checksum)"
+
+ ssh -C "$target" $ssh_options -o BatchMode=yes -o ServerAliveInterval=90 $myhost store-file pg "$targetname" "$size" "$checksum" < "$file"
+ if [ "$?" != 0 ]; then
+ failures="$failures $logtuple_start,$checksum,$target)"
+ fi
+ fi
+done
+if [ "$failures" != "" ]; then
+ croak "remote store for$failures failed."
+fi
class postgres::backup_source {
file { '/usr/local/bin/pg-backup-file':
mode => '0555',
- source => 'puppet:///modules/roles/postgresql_server/pg-backup-file',
+ source => 'puppet:///modules/postgres/backup_sources/pg-backup-file',
}
+ file { '/etc/dsa/pg-backup-file.conf':
+ content => template('postgres/backup_sources/pg-backup-file.conf.erb'),
+ }
+
file { '/usr/local/bin/pg-receive-file-from-backup':
mode => '0555',
source => 'puppet:///modules/roles/postgresql_server/pg-receive-file-from-backup',
}
- file { '/etc/dsa/pg-backup-file.conf':
- content => template('roles/postgresql_server/pg-backup-file.conf.erb'),
- }
ssh::keygen {'postgres': }
}
--- /dev/null
+<%- if @hostname == "sibelius" then -%>
+# use ipv4
+ssh_options="-oAddressFamily=inet"
+<%- end %>
+backuphost="debbackup@backuphost debbackup@storace"
+++ /dev/null
-#!/bin/bash
-
-# Copyright (c) 2010, 2011, 2013, 2014 Peter Palfrader
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-# Archive a postgresql file (WAL or BASE) to the archive server $backuphost
-# can be set in /etc/dsa/pg-backup-file.conf
-
-set -u
-
-backuphost=debbackup@storace
-myhost="`hostname`"
-self="`basename "$0"`[$$]"
-
-if [ "$#" != 3 ] ; then
- echo >&2 "Usage: $self <cluster> <WAL|BASE> <file>"
- exit 1
-fi
-
-ssh_options=""
-! [ -e /etc/dsa/pg-backup-file.conf ] || . /etc/dsa/pg-backup-file.conf
-
-cluster="$1"
-what="$2"
-file="$3"
-
-info() {
- logger -p daemon.info -t "$self" "$1"
-}
-
-croak() {
- logger -s -p daemon.warn -t "$self" "$1"
- exit 1
-}
-
-if ! [ -e "$file" ] ; then
- croak "file $file does not exist"
-fi
-
-size="`stat -c '%s' "$file"`"
-checksum=""
-bn="`basename "$file"`"
-targetname="$cluster.$what.$bn"
-logtuple_start="($myhost,$targetname,$size"
-failures=""
-
-for target in $backuphost; do
- if [ "${target#/}" != "$target" ]; then
- info "Archiving to $target: ($targetname,$size)"
- cp "$file" "$target/$myhost-$targetname"
- else
- [ -n "$checksum" ] || checksum="`sha512sum "$file" | awk '{print $1}'`"
- info "Archiving to $target: ($myhost,$targetname,$size,$checksum)"
-
- ssh -C "$target" $ssh_options -o BatchMode=yes -o ServerAliveInterval=90 $myhost store-file pg "$targetname" "$size" "$checksum" < "$file"
- if [ "$?" != 0 ]; then
- failures="$failures $logtuple_start,$checksum,$target)"
- fi
- fi
-done
-if [ "$failures" != "" ]; then
- croak "remote store for$failures failed."
-fi
+++ /dev/null
-<%- if @hostname == "sibelius" then -%>
-# use ipv4
-ssh_options="-oAddressFamily=inet"
-<%- end %>
-backuphost="debbackup@backuphost debbackup@storace"