From 80bbf749c2eedd7ff7f620fbeee1f199b2aca52a Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Fri, 15 Dec 2017 13:31:04 +0000 Subject: [PATCH 1/3] Change hashbangs to use env --- migrator.py | 2 +- postgresql-cluster-setup.sh | 2 +- tmux-session.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migrator.py b/migrator.py index 010f463..88fbfeb 100755 --- a/migrator.py +++ b/migrator.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 import datetime import os diff --git a/postgresql-cluster-setup.sh b/postgresql-cluster-setup.sh index 92bf15b..37dc3e5 100755 --- a/postgresql-cluster-setup.sh +++ b/postgresql-cluster-setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash PG01="172.28.33.11" PG02="172.28.33.12" diff --git a/tmux-session.sh b/tmux-session.sh index f5ca4ad..f46218f 100755 --- a/tmux-session.sh +++ b/tmux-session.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eu From 250d15dd46fe8b0b59b377a9085c6c5fef2130ba Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Fri, 5 Jan 2018 11:58:10 +0000 Subject: [PATCH 2/3] Make sure pacemaker starts on boot --- postgresql-cluster-setup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/postgresql-cluster-setup.sh b/postgresql-cluster-setup.sh index 37dc3e5..465dfd3 100755 --- a/postgresql-cluster-setup.sh +++ b/postgresql-cluster-setup.sh @@ -198,6 +198,9 @@ service { } EOF + # Make sure pacemaker starts on boot (Corosync's start priority is 19 so set pacemaker higher) + sudo update-rc.d pacemaker defaults 20 01 + # start corosync / pacemaker service corosync start # TODO: check output of corosync-cfgtool -s says "no faults" From 51a35381c16c2db928db726eff6edf285fe89f05 Mon Sep 17 00:00:00 2001 From: Dyson Simmons Date: Fri, 5 Jan 2018 11:59:22 +0000 Subject: [PATCH 3/3] Add check for vagrant box and install if needed --- tmux-session.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmux-session.sh b/tmux-session.sh index f46218f..41a0ca9 100755 --- a/tmux-session.sh +++ b/tmux-session.sh @@ -23,6 +23,10 @@ function setup-session() { } if [ "$ARG" == "start" ]; then + if ! vagrant box list | grep -q "^ubuntu/trusty64" ; then + echo "Installing ubuntu/trusty64 box..." + vagrant box add ubuntu/trusty64 + fi (tmux new-session -d -s pg -n cluster && setup-session) || tmux attach -t pg elif [ "$ARG" == "stop" ]; then echo "Stopping all VMs..."