Skip to content

Instantly share code, notes, and snippets.

@kesor
Last active January 22, 2019 17:40
Show Gist options
  • Save kesor/6595040 to your computer and use it in GitHub Desktop.
Save kesor/6595040 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e -x
[ `id -u` != '0' ] && { echo "usage: sudo $0"; exit 1; }
graphite_version='0.9.12'
graphite_root=/opt/graphite
statsd_root=/opt/statsd
venv_root=$graphite_root/venv
pip_cache=/var/cache/pip
##
# cache system apt packages
#
apt-get update
apt-get install python-software-properties -y
[ ! -f /etc/apt/sources.list.d/nginx-stable-raring.list ] && \
add-apt-repository ppa:nginx/stable -y
[ ! -f /etc/apt/sources.list.d/chris-lea-node_js-raring.list ] && \
add-apt-repository ppa:chris-lea/node.js -y
apt-get update
apt-get install collectd python-virtualenv python-dev libcairo2-dev libffi-dev nginx nodejs git -y
##
# cache graphite python packages
#
mkdir -p $graphite_root
virtualenv --clear --distribute --setuptools $venv_root
source $venv_root/bin/activate
export PATH=$venv_root/bin:$PATH
export PIP_LOG=$venv_root/pip.log
export PIP_USE_MIRRORS=true
export PIP_TIMEOUT=300 PIP_DEFAULT_TIMEOUT=300
export PIP_DOWNLOAD_CACHE=$pip_cache
mkdir -p $pip_cache
pip install -U distribute setuptools pip
cat <<-EOF > $venv_root/requirements.txt
Django==1.5.4
Twisted==13.1.0
argparse==1.2.1
distribute==0.7.3
django-tagging==0.3.1
gunicorn==18.0
cairocffi==0.5.1
setproctitle==1.1.7
txAMQP==0.6.2
wsgiref==0.1.2
zope.interface==4.0.5
carbon==$graphite_version
whisper==$graphite_version
graphite-web==$graphite_version
EOF
pip install --upgrade --allow-all-external -r $venv_root/requirements.txt
##
# remove installed packages!
# (leaving them in cache)
#
apt-get autoremove --purge collectd python-virtualenv python-dev libcairo2-dev nginx nodejs git -y
rm -rf $graphite_root
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'etc'
Vagrant.configure('2') do |config|
config.vm.box = "raring"
config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box'
config.vm.define :testbox do |v|
v.vm.host_name = "testbox-#{Etc.getlogin}"
v.vm.network :private_network, ip: '192.168.99.99'
end
config.vm.provider :virtualbox do |vb|
vb.name = "testbox-#{Etc.getlogin}-vbox"
vb.customize ['modifyvm', :id, '--memory', 1024]
vb.customize ['modifyvm', :id, '--cpus', 2]
vb.customize ["setextradata", :id, "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled", "1"] # don't mess with guest clock!
end
end
@lightpriest
Copy link

Perhaps it's better to change boxes names to something related to devopsdays? Just so it would be a more related reference than "testbox-.."

@kesor
Copy link
Author

kesor commented Sep 19, 2013

  1. Eventually we will need to change the box itself to not be "raring", but "raring-customized-by-us-for-devopsdays".
  2. In case the same person is involved in all 3 workshops, we would probably want to have unique IP addresses and vbox names for each of our 3 vagranfiles.

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