Skip to content

Instantly share code, notes, and snippets.

@darron
Created May 9, 2015 15:52
Show Gist options
  • Save darron/f30f9dec0c9273b7bdae to your computer and use it in GitHub Desktop.
Save darron/f30f9dec0c9273b7bdae to your computer and use it in GitHub Desktop.
Userdata for octohost with mod_pagespeed on Digitalocean
#!/bin/bash
export PRIVATE_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address)
export CONSUL_KEY=$(consul keygen)
service consul stop
rm -rf /var/cache/octohost/*
sudo cat > /etc/consul.d/default.json << EOL
{
"data_dir": "/var/cache/octohost",
"server": true,
"bootstrap": true,
"client_addr": "0.0.0.0",
"advertise_addr": "$PRIVATE_IPV4",
"datacenter": "nyc3",
"node_name": "octohost",
"enable_syslog": true,
"encrypt": "$CONSUL_KEY"
}
EOL
service consul start
sed -i '11s/.*/DOMAIN_SUFFIX=\"example\.org\"/' /etc/default/octohost
sed -i '31s/.*/EMAIL_NOTIFICATION=\"email@example\.org\"/' /etc/default/octohost
cd /etc/nginx/
wget https://gist.githubusercontent.com/darron/5604cefb982b8bfcc338/raw/acebe1e02986a3d8959856c1cddedf17b8a5ef9b/pagespeed.conf
wget https://gist.githubusercontent.com/darron/5604cefb982b8bfcc338/raw/c2c5e61205df51e9c55a79f868d25c7c351e3b8e/pagespeed_common.conf
rm proxy.conf
wget https://gist.githubusercontent.com/darron/5604cefb982b8bfcc338/raw/e95fdc120f67beba164e7c068c9d09cfb68a2419/proxy.conf
rm template.ctmpl
wget https://gist.githubusercontent.com/darron/5604cefb982b8bfcc338/raw/bfe0d66adff1724c082b524e8a6b47a5197c0c9b/template.ctmpl
service proxy stop
service proxy start
@darron
Copy link
Author

darron commented May 9, 2015

Still to setup - ssh key:

cat ~/.ssh/id_dsa.pub | ssh [email protected] "sudo gitreceive upload-key darron"

And ssl key and cert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment