mirror of https://github.com/zulip/zulip.git
kandra: Move PostgreSQL data mountpoint to /srv/data.
We store a lot of other things in `/srv` now, and moving them mid-puppet confuses things significantly.
This commit is contained in:
parent
93c6fd4746
commit
e4883cc2dc
|
@ -17,17 +17,16 @@ if [ -z "$LOCALDISK" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "$LOCALDISK" /etc/fstab; then
|
if ! grep -q "$LOCALDISK" /etc/fstab; then
|
||||||
echo "$LOCALDISK /srv xfs nofail,noatime 1 1" >>/etc/fstab
|
echo "$LOCALDISK /srv/data xfs nofail,noatime 1 1" >>/etc/fstab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! mountpoint -q /srv; then
|
if [ ! -d /srv/data ]; then
|
||||||
|
mkdir /srv/data
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! mountpoint -q /srv/data; then
|
||||||
mkfs.xfs "$LOCALDISK"
|
mkfs.xfs "$LOCALDISK"
|
||||||
# Move any existing files/directories out of the way
|
mount /srv/data
|
||||||
TMPDIR=$(mktemp -d)
|
|
||||||
mv /srv/* "$TMPDIR"
|
|
||||||
mount /srv
|
|
||||||
mv "$TMPDIR/"* /srv
|
|
||||||
rmdir "$TMPDIR"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -L /var/lib/postgresql ]; then
|
if [ ! -L /var/lib/postgresql ]; then
|
||||||
|
@ -35,11 +34,11 @@ if [ ! -L /var/lib/postgresql ]; then
|
||||||
if [ -e /var/lib/postgresql ]; then
|
if [ -e /var/lib/postgresql ]; then
|
||||||
mv /var/lib/postgresql "/root/postgresql-data-$(date +'%m-%d-%Y-%T')"
|
mv /var/lib/postgresql "/root/postgresql-data-$(date +'%m-%d-%Y-%T')"
|
||||||
fi
|
fi
|
||||||
ln -s /srv/postgresql/ /var/lib
|
ln -s /srv/data/postgresql/ /var/lib
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "/srv/postgresql" ]; then
|
if [ ! -e "/srv/data/postgresql" ]; then
|
||||||
service postgresql stop
|
service postgresql stop
|
||||||
mkdir "/srv/postgresql"
|
mkdir "/srv/data/postgresql"
|
||||||
chown postgres:postgres /srv/postgresql
|
chown postgres:postgres /srv/data/postgresql
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -27,7 +27,7 @@ class kandra::profile::postgresql inherits kandra::profile::base {
|
||||||
exec { 'setup_disks':
|
exec { 'setup_disks':
|
||||||
command => '/root/setup_disks.sh',
|
command => '/root/setup_disks.sh',
|
||||||
require => Package["postgresql-${zulip::postgresql_common::version}", 'xfsprogs', 'nvme-cli'],
|
require => Package["postgresql-${zulip::postgresql_common::version}", 'xfsprogs', 'nvme-cli'],
|
||||||
unless => 'test /var/lib/postgresql/ -ef /srv/postgresql/',
|
unless => 'test /var/lib/postgresql/ -ef /srv/data/postgresql/',
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "${zulip::postgresql_base::postgresql_confdir}/pg_hba.conf":
|
file { "${zulip::postgresql_base::postgresql_confdir}/pg_hba.conf":
|
||||||
|
|
Loading…
Reference in New Issue