mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 03:41:58 +00:00
puppet: Add script to configure Postgres master disks
(imported from commit 61004aa839df8f3fa82ba0c4ea9e2a01ae43464c)
This commit is contained in:
14
servers/puppet/modules/humbug/files/postgresql/setup_disks.sh
Executable file
14
servers/puppet/modules/humbug/files/postgresql/setup_disks.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
umount /mnt
|
||||||
|
yes | mdadm --create /dev/md0 --raid-devices=2 --level=1 /dev/xvdb /dev/xvdc
|
||||||
|
blockdev --setra 4096 /dev/xvdb
|
||||||
|
blockdev --setra 4096 /dev/xvdc
|
||||||
|
blockdev --setra 4096 /dev/md0
|
||||||
|
mkfs.xfs /dev/md0
|
||||||
|
echo "/dev/md0 /srv xfs noatime,barrier 1 1" >> /etc/fstab
|
||||||
|
mount /srv
|
||||||
|
|
||||||
|
pg_ctlcluster 9.1 main stop
|
||||||
|
mv /var/lib/postgresql /srv
|
||||||
|
ln -s /srv/postgresql/ /var/lib
|
||||||
|
pg_ctlcluster 9.1 main start
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
class humbug::postgres-master {
|
class humbug::postgres-master {
|
||||||
class { 'humbug::postgres-common': }
|
class { 'humbug::postgres-common': }
|
||||||
|
|
||||||
|
$master_packages = [ "xfsprogs", "mdadm", ]
|
||||||
|
package { $master_packages: ensure => "installed" }
|
||||||
|
|
||||||
file { '/etc/sysctl.d/30-postgresql-shm.conf':
|
file { '/etc/sysctl.d/30-postgresql-shm.conf':
|
||||||
ensure => file,
|
ensure => file,
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
@@ -17,4 +20,18 @@ class humbug::postgres-master {
|
|||||||
mode => 644,
|
mode => 644,
|
||||||
source => "puppet:///modules/humbug/postgresql/postgresql.conf.master",
|
source => "puppet:///modules/humbug/postgresql/postgresql.conf.master",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { "/root/setup_disks.sh":
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => 744,
|
||||||
|
source => 'puppet:///modules/humbug/postgresql/setup_disks.sh',
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { "setup_disks":
|
||||||
|
command => "/root/setup_disks.sh",
|
||||||
|
require => Package["postgresql-9.1", "xfsprogs", "mdadm"],
|
||||||
|
creates => "/dev/md0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user