I have been messing around with Google Compute Engine lately. I have a  WordPress website (this one actually) that is now "highly available."

I am still new at this, so be gentle.

Here is the startup script in Google Docs format and below is the formatted code.

#!/bin/bash
 
export DEBIAN_FRONTEND="noninteractive"
 
debconf-set-selections <<< "postfix postfix/main_mailer_type select Satellite system"
debconf-set-selections <<< "postfix postfix/mailname string $HOSTNAME"
debconf-set-selections <<< "postfix postfix/relayhost string smtp.mailgun.org:2525"
 
apt-get update 
apt-get upgrade -yf
apt-get install apache2 unzip php5 php5-mysql postfix libsasl2-dev libsasl2-modules telnet mysql-client procmail -yf

#fail2ban debconf-utils
 
mkdir -p /var/www/example.com/
 
gsutil -m rsync -r -d gs://example-bucket/postfix/ /etc/postfix/
gsutil -m rsync -r -d gs://example-bucket/apache2/ /etc/apache2/sites-available/
gsutil -m rsync -r -d gs://example-bucket/example.com/ /var/www/example.com/
 
chown -r www-data:www-data /var/www/
chmod -R 755 /var/www/
 
mkdir -p /etc/ssl/example.com/
gsutil -m rsync -r -d gs://website-11june2017/ssl/kvchmurphy.com/ /etc/ssl/example.com/
 
postmap /etc/postfix/sasl_passwd

wget -O /root/cloud_sql_proxy https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64
chmod +x /root/cloud_sql_proxy
/root/cloud_sql_proxy -instances=example-sql-instance=tcp:3306 &
 
export DEBIAN_FRONTEND="text"
 
a2enmod rewrite
a2enmod ssl
a2ensite website
a2ensite ssl
 
service apache2 restart
service postfix restart
 
rm /var/www/html/index.html
echo "Complete" > /var/www/html/done.html
echo -e "Subject:MailGun-Script \n\nMailGun Script" | sendmail -v you@example.com