Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
kandra: Pull instance storage device from nvme information.
Alex Vandiver93c6fd47463a
diff --git a/puppet/kandra/files/postgresql/setup_disks.sh b/puppet/kandra/files/postgresql/setup_disks.shindex 2eb6583856e..6e4d42fd31b 100755--- a/puppet/kandra/files/postgresql/setup_disks.sh+++ b/puppet/kandra/files/postgresql/setup_disks.sh@@ -1,12 +1,21 @@-#!/bin/sh+#!/bin/bashset -xset -e-# This file only exists on the server, ignore its non-existence locally-# shellcheck disable=SC1091-. "/sys/dev/block/259:0/uevent"+set -o pipefail++LOCALDISK=$(+ nvme list -o json \+ | jq -r '.Devices[] | select(.ModelNumber | contains("Instance Storage")) | .DevicePath' \+ | head -n1+)++if [ -z "$LOCALDISK" ]; then+ echo "No instance storage found!"+ nvme list+ exit 1+fi-LOCALDISK="/dev/$DEVNAME"if ! grep -q "$LOCALDISK" /etc/fstab; thenecho "$LOCALDISK /srv xfs nofail,noatime 1 1" >>/etc/fstabfidiff --git a/puppet/kandra/manifests/profile/postgresql.pp b/puppet/kandra/manifests/profile/postgresql.ppindex 2a7b1cfdf01..d3f73b99a08 100644--- a/puppet/kandra/manifests/profile/postgresql.pp+++ b/puppet/kandra/manifests/profile/postgresql.pp@@ -4,8 +4,7 @@ class kandra::profile::postgresql inherits kandra::profile::base {include kandra::teleport::dbinclude kandra::prometheus::postgresql- $common_packages = ['xfsprogs']- package { $common_packages: ensure => installed }+ package { ['xfsprogs', 'nvme-cli']: ensure => installed }kandra::firewall_allow{ 'postgresql': }@@ -27,7 +26,7 @@ class kandra::profile::postgresql inherits kandra::profile::base {}exec { 'setup_disks':command => '/root/setup_disks.sh',- require => Package["postgresql-${zulip::postgresql_common::version}", 'xfsprogs'],+ require => Package["postgresql-${zulip::postgresql_common::version}", 'xfsprogs', 'nvme-cli'],unless => 'test /var/lib/postgresql/ -ef /srv/postgresql/',}