diff --git a/etc/gcloud/create-demo-instance.sh b/etc/gcloud/create-demo-instance.sh new file mode 100755 index 0000000..039be6f --- /dev/null +++ b/etc/gcloud/create-demo-instance.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# create-demo-instance.sh + +set -x +gcloud compute instances create inbucket-1 --machine-type=f1-micro \ + --image-project=debian-cloud --image-family=debian-9 \ + --metadata-from-file=startup-script=debian-startup.sh,greeting=demo-greeting.html \ + --tags=http-server --address=inbucket-demo diff --git a/etc/gcloud/setup.sh b/etc/gcloud/debian-startup.sh old mode 100644 new mode 100755 similarity index 53% rename from etc/gcloud/setup.sh rename to etc/gcloud/debian-startup.sh index 52fa23b..a5989e7 --- a/etc/gcloud/setup.sh +++ b/etc/gcloud/debian-startup.sh @@ -2,8 +2,13 @@ # 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" +inbucket_rel="1.2.0-rc2" +inbucket_pkg="inbucket_${inbucket_rel}_linux_amd64" +inbucket_url="https://dl.bintray.com/content/jhillyerd/golang/${inbucket_pkg}.tar.gz?direct" + +fauxmailer_rel="0.1" +fauxmailer_pkg="fauxmailer_${fauxmailer_rel}_linux_amd64" +fauxmailer_url="https://github.com/jhillyerd/fauxmailer/releases/download/0.1/${fauxmailer_pkg}.tar.gz" set -eo pipefail [ $TRACE ] && set -x @@ -15,8 +20,8 @@ id inbucket &>/dev/null || useradd -r -m inbucket # Extract cd /opt -curl --location "$url" | tar xzvf - -ln -s "$release/" inbucket +curl --location "$inbucket_url" | tar xzvf - +ln -s "$inbucket_pkg/" inbucket # Install cd /opt/inbucket/etc/ubuntu @@ -29,5 +34,11 @@ install -o root -g root -m 644 ../unix-sample.conf /etc/opt/inbucket.conf # Setup setcap 'cap_net_bind_service=+ep' /opt/inbucket/inbucket +curl -sL -o /opt/inbucket/themes/greeting.html "http://metadata.google.internal/computeMetadata/v1/instance/attributes/greeting" -H "Metadata-Flavor: Google" systemctl enable inbucket.service systemctl start inbucket + +# Fauxmailer +cd /opt +curl --location "$fauxmailer_url" | tar xzvf - +ln -s "$fauxmailer_pkg/" fauxmailer diff --git a/etc/gcloud/demo-greeting.html b/etc/gcloud/demo-greeting.html new file mode 100644 index 0000000..6a4e85b --- /dev/null +++ b/etc/gcloud/demo-greeting.html @@ -0,0 +1,15 @@ +

Welcome to the Inbucket demonstration instance

+ +

tl;dr - click Monitor above to get started.

+ +

Inbucket is an email testing service; it will accept email for any email +address and make it available to view without a password.

+ +

This instance is running on Google Compute Engine, and utilizes +fauxmailer to generate +a stream of fake email. Feel free to poke around, delete mails, or try out +the REST API.

+ +

To protect our visitors, this instance does not accept external mail. You +will need to install your own copy of Inbucket to use it in your +environment.