Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
puppet: Update setup-disks to be idempotent.
Alex Vandiver1dc2de50268c
diff --git a/puppet/zulip_ops/files/postgresql/setup_disks.sh b/puppet/zulip_ops/files/postgresql/setup_disks.shindex 7415fbf54a3..c7739ab9493 100755--- a/puppet/zulip_ops/files/postgresql/setup_disks.sh+++ b/puppet/zulip_ops/files/postgresql/setup_disks.sh@@ -1,14 +1,28 @@#!/bin/sh+set -x+set -eLOCALDISK=/dev/nvme0n1-mkfs.xfs $LOCALDISK+if ! grep -q $LOCALDISK /etc/fstab; then+ echo "$LOCALDISK /srv xfs nofail,noatime 1 1" >> /etc/fstab+fi-echo "$LOCALDISK /srv xfs nofail,noatime 1 1" >> /etc/fstab-mount /srv+if ! mountpoint -q /srv; then+ mkfs.xfs $LOCALDISK+ mount /srv+fi-service postgresql stop-mv /var/lib/postgresql /srv-ln -s /srv/postgresql/ /var/lib+if [ ! -L /var/lib/postgresql ]; then+ service postgresql stop+ if [ -e /var/lib/postgresql ]; then+ mv /var/lib/postgresql "/root/postgres-data-$(date +'%m-%d-%Y-%T')"+ fi+ ln -s /srv/postgresql/ /var/lib+fi-service postgresql start+if [ ! -e "/srv/postgresql" ]; then+ service postgresql stop+ mkdir "/srv/postgresql"+ chown postgres:postgres /srv/postgresql+fi