From 52de1b2bfef2916486d4da62350b16f4dec2d53b Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Sat, 23 Dec 2017 23:22:51 -0800 Subject: [PATCH] Initial gcloud setup.sh, not yet tested as metadata --- etc/gcloud/setup.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 etc/gcloud/setup.sh diff --git a/etc/gcloud/setup.sh b/etc/gcloud/setup.sh new file mode 100644 index 0000000..52fa23b --- /dev/null +++ b/etc/gcloud/setup.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# setup.sh +# description: Install Inbucket on Google Cloud debian9 instance + +release="inbucket_1.2.0-rc2_linux_amd64" +url="https://dl.bintray.com/content/jhillyerd/golang/${release}.tar.gz?direct" + +set -eo pipefail +[ $TRACE ] && set -x + +# Prerequisites +apt-get --yes update +apt-get --yes install curl libcap2-bin +id inbucket &>/dev/null || useradd -r -m inbucket + +# Extract +cd /opt +curl --location "$url" | tar xzvf - +ln -s "$release/" inbucket + +# Install +cd /opt/inbucket/etc/ubuntu +install -o inbucket -g inbucket -m 775 -d /var/opt/inbucket +touch /var/log/inbucket.log +chown inbucket: /var/log/inbucket.log +install -o root -g root -m 644 inbucket.logrotate /etc/logrotate.d/inbucket +install -o root -g root -m 644 inbucket.service /lib/systemd/system/inbucket.service +install -o root -g root -m 644 ../unix-sample.conf /etc/opt/inbucket.conf + +# Setup +setcap 'cap_net_bind_service=+ep' /opt/inbucket/inbucket +systemctl enable inbucket.service +systemctl start inbucket