puppet: Install wal-g, not wal-e.

This commit is contained in:
Alex Vandiver
2020-06-11 14:52:04 -07:00
committed by Alex Vandiver
parent 6506447bf1
commit 4fe0444108
3 changed files with 31 additions and 18 deletions

View File

@@ -160,7 +160,7 @@ data includes:
* The postgres database. You can back it up like any postgres * The postgres database. You can back it up like any postgres
database. We have some example tooling for doing that incrementally database. We have some example tooling for doing that incrementally
into S3 using [wal-e](https://github.com/wal-e/wal-e) in into S3 using [wal-g](https://github.com/wal-g/wal-g) in
`puppet/zulip_ops/manifests/postgres_common.pp`. `puppet/zulip_ops/manifests/postgres_common.pp`.
In short, this requires: In short, this requires:
- Zulip 1.4 or newer release. - Zulip 1.4 or newer release.
@@ -207,7 +207,7 @@ To restore from a manual backup, the process is basically the reverse of the abo
* If you ran `initialize-database` anyway above, you'll want to run * If you ran `initialize-database` anyway above, you'll want to run
`scripts/setup/postgres-init-db` to drop the initial database first. `scripts/setup/postgres-init-db` to drop the initial database first.
* Restore your database from the backup using `wal-e`. * Restore your database from the backup.
* Reconfigure rabbitmq to use the password from `secrets.conf` * Reconfigure rabbitmq to use the password from `secrets.conf`
by running, as root, `scripts/setup/configure-rabbitmq`. by running, as root, `scripts/setup/configure-rabbitmq`.

View File

@@ -1,23 +1,16 @@
class zulip_ops::postgres_common { class zulip_ops::postgres_common {
include zulip::postgres_common include zulip::postgres_common
$internal_postgres_packages = [# dependencies for our wal-e backup system $wal_g_version = '0.2.15'
'lzop', $wal_g_hash = 'ea33c2341d7bfb203c6948590c29834c013ab06a28c7a2b236a73d906f785c84'
'pv', exec {'install-wal-g':
'python3-pip', command => "${::zulip_scripts_path}/setup/install-wal-g ${wal_g_version} ${wal_g_hash}",
'python-pip', creates => "/usr/local/bin/wal-g-${wal_g_version}",
'python3-gevent', }
'python-gevent',
]
package { $internal_postgres_packages: ensure => 'installed' }
exec {'pip_wal-e': file { '/usr/local/bin/wal-g':
# On trusty, there is no python3-boto or python3-gevent package, ensure => 'link',
# so we keep our `wal-e` explicitly on Python 2 for now. target => "/usr/local/bin/wal-g-${wal_g_version}",
command => '/usr/bin/pip2 install git+git://github.com/zbenjamin/wal-e.git#egg=wal-e',
creates => '/usr/local/bin/wal-e',
require => Package['python-pip', 'python-boto', 'python-gevent',
'lzop', 'pv'],
} }
cron { 'pg_backup_and_purge': cron { 'pg_backup_and_purge':

20
scripts/setup/install-wal-g.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
set -x
VERSION="$1"
HASH="$2"
cd /tmp
wget -qO "wal-g-$VERSION.tar.gz" \
"https://github.com/wal-g/wal-g/releases/download/v$VERSION/wal-g.linux-amd64.tar.gz"
# Check not against the arbitrary provided sha256 on Github, but
# against the (same) sha256 that we hardcode as "known good".
echo "$HASH wal-g-$VERSION.tar.gz" > "wal-g-$VERSION.tar.gz.sha256"
sha256sum -c "wal-g-$VERSION.tar.gz.sha256"
tar xzf "wal-g-$VERSION.tar.gz"
mv wal-g "/usr/local/bin/wal-g-$VERSION"
rm "wal-g-$VERSION.tar.gz" "wal-g-$VERSION.tar.gz.sha256"