Skip to content

Instantly share code, notes, and snippets.

View mguterl's full-sized avatar

Mike Guterl mguterl

View GitHub Profile
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:ryw/peoplebest.git master"
* executing "if [ -d /home/deploy/public_html/peoplebest/shared/cached-copy ]; then cd /home/deploy/public_html/peoplebest/shared/cached-copy && git fetch -q origin && git reset -q --hard e18b14000c60255f8a438bba465f25c11899a44c && git submodule -q init && for mod in `git submodule status | awk '{ print $2 }'`; do git config -f .git/config submodule.${mod}.url `git config -f .gitmodules --get submodule.${mod}.url` && echo Synced $mod; done && git submodule -q sync && git submodule -q update && git clean -q -d -x -f; else git clone -q git@github.com:ryw/peoplebest.git /home/deploy/public_html/peoplebest/shared/cached-copy && cd /home/deploy/public_html/peoplebest/shared/cached-copy && git checkout -q -b deploy e18b14000c60255f8a438bba465f25c11899a44c && git submodule -q ini
# backup redis databases to s3 on the engineyard platform
require 'zlib'
require 'rubygems'
require 'crack/json'
require 'aws/s3'
class Redis2S3
DATABASE = '/db/redis/redis_state.rdb'
require 'sunspot'
require 'sunspot/session_proxy/abstract_session_proxy'
require 'resque'
require 'resque-retry'
class SunspotResqueSessionProxy < Sunspot::SessionProxy::AbstractSessionProxy
attr_reader :session
delegate :config, :delete_dirty?, :dirty?,
:new_search, :search,
# Because Unicorn is such a brilliant piece of software, it wraps older,
# non-Rack versions of Rails in a Rack handler. That way Unicorn
# itself can target Rack and not have to worry about monkey patching
# Rails' dispatcher.
#
# This means we can do the same, and even more.
#
# Starting Rackhub locally:
#
# Thin:
#!/bin/bash
echo "Setting up chef..."
sudo apt-get -y update
sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert
cd /tmp
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.6.tgz
tar zxf rubygems-1.3.6.tgz
require 'webrick'
require 'webrick/httpproxy'
require 'fileutils'
require 'md5'
###
# FakeWebRecorder is an HTTP Proxy that records sessions as calls to FakeWeb.
# The code that FakeWebRecorder generates should be suitable for testing
# interaction with a particular website.
#
#!/bin/bash
echo "Setting up chef..."
sudo apt-get -y update
sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert
cd /tmp
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz
tar zxf rubygems-1.3.4.tgz
wr () { ruby script/server webrick ${1:+--port $1} ; }
mr () { if [ -e log/mongrel.pid ]; then
echo do not wait for 'mongrel_rails restart' >/dev/null
mrs $1 $2
fi
stubbornPID=$(sudo -p 'sudo password: ' lsof -n -P -t -i tcp:${1:-3000})
if [ -n "${stubbornPID}" ]; then
echo Try to kill stubborn process with PID ${stubbornPID}
kill -s INT ${stubbornPID}
fi
wr () { ruby script/server webrick ${1:+--port $1} ; }
mr () { if [ -e log/mongrel.pid ]; then
echo do not wait for 'mongrel_rails restart' >/dev/null
mrs $1 $2
fi
echo "== Starting Mongrel as daemon${1:+ for $1}${2:+ on port $2}" |
tee -a log/${1:-${RAILS_ENV:-development}}.log
mongrel_rails start --daemonize ${1:+-e $1} ${2:+-p $2} ;
i=1
while [ $i -le 15 -a ! -e log/mongrel.pid ]; do
# This is for voting for the budgetsketch project on http://cinciinnovates.com
# You can vote daily. This stupid simple mechanize script will simply submit
# your vote. You still have to confirm the vote from your email inbox. I
# figure a cron job to submit my vote keeps me from forgetting to vote daily
# and I (as a human) am still confirming; so not cheating. YMMV
require 'rubygems'
require 'mechanize'
require 'pp'