Skip to content

Instantly share code, notes, and snippets.

@garethr
garethr / Django Fabric File
Created September 6, 2009 10:44
Sample fabric build file for a Django project
config.project_name = 'sample'
config.repo_address = 'http://path/to/repo'
def server():
config.fab_hosts = ['{ip address}']
config.path = '/srv/sample'
config.fab_user = '{username}'
config.virtualhost_path = "configs/"
config.group = '{username}'
@garethr
garethr / gist:226208
Created November 4, 2009 16:54
Apache virtualhost for an asset server
<VirtualHost *:80>
ServerName assets
FileETag none
ExpiresActive On
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
@garethr
garethr / pre-receive
Created July 11, 2010 17:51
pre-receive git hook for integrity continuous integration server
#!/usr/bin/env ruby
require 'rubygems'
require 'grit'
require 'nokogiri'
require 'open-uri'
# This is a pre-receive git hook designed to be part of a continuous
# deployment workflow using the Integrity continuous integration server
@garethr
garethr / gist:471712
Created July 11, 2010 17:51
post-receive git hook for integrity continuous integration server
#!/usr/bin/env ruby
require 'net/http'
# This is a post-receive git hook designed to tirgger a build in the
# Integrity continuous integration server
INTEGRITY = 'http://localhost:9292'
PROJECT = 'site'
@garethr
garethr / amqpserver.feature
Created November 21, 2010 17:35
using cucumber for monitoring AMQP server
Feature: AMQP capacity
To make sure the rest of the system is in order
Our message queues must not be backed up
Scenario: Check queue status
Given I have a AMQP server on example.com
And I want to check on the fork queue
Then it should have less than 400 messages
Then it should have at least 5 consumers
Then it should have less than 50 messages per consumer
@garethr
garethr / mysql.feature
Created November 21, 2010 17:46
mysql monitoring example using cucumer
Feature: localhost
To make sure the rest of the system is in order
Our database server should not be overloaded
Scenario: check running processes count
Given I have a MySQL server on localhost
And I use the username root
Then it should have less than 10 processes
Scenario: check queries per second
@garethr
garethr / build.xml
Created March 20, 2011 15:07
Sample ant build file for running rsync and scp base flat file deployment
<project name="{{ name }}" default="help" basedir=".">
<property name="username" value="{{ username }}"/>
<property name="host" value="{{ host }}"/>
<property name="dir" value="/srv/{{ path }}/"/>
<tstamp>
<format property="TODAY_UK" pattern="yyyyMMddhhmmss" locale="en,UK"/>
</tstamp>
@garethr
garethr / gist:999215
Created May 30, 2011 17:47
Demo of dynamic django filter
kwargs = {'%s' % foo: 'bar'}
MyModel.objects.filter(**kwargs)
@garethr
garethr / Vagrantfile
Created August 8, 2011 14:38
Vagrantfile with a debugger in, a useful way of interacting with the context
Vagrant::Config.run do |config|
config.vm.define :web do |web_config|
require 'ruby-debug'
debugger
web_config.vm.box = "lucid32"
web_config.vm.forward_port("http", 80, 8080)
end
config.vm.define :db do |db_config|
db_config.vm.box = "lucid32"
@garethr
garethr / gmetad.conf
Created October 18, 2011 14:47
gmond and gmetad config files for unicast ganglia setup. Not yet working
data_source "garethr1" localhost