Skip to content

Instantly share code, notes, and snippets.

View unicornrainbow's full-sized avatar
💖
🎈Sharing codes 🔫🛍🛁📐🎉💉🕳🚬💎💰💳

Rashiki Grace unicornrainbow

💖
🎈Sharing codes 🔫🛍🛁📐🎉💉🕳🚬💎💰💳
  • Newstime
  • Daytona Beach, FL
View GitHub Profile

Using Unicorn with Upstart

This configuration works with Upstart on Ubuntu 12.04 LTS

The reason why it needs to be done this way (i.e. with the pre-start and post-stop stanzas), is because Upstart is unable to track whever Unicorn master process re-execs itself on hot deploys. One can use it without hot-deploys and run Unicorn in foreground also, it then only needs one exec stanza.

This presumes you are not using RVM, so no voodoo dances.

#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
require "selenium"
require "test/unit"
class NewTest < Test::Unit::TestCase
def setup
@verification_errors = []
if $selenium
@selenium = $selenium
else
@selenium = Selenium::SeleniumDriver.new("localhost", 4444, "*chrome", "http://www.google.com/", 10000);
@unicornrainbow
unicornrainbow / gist:535717
Created August 18, 2010 18:27
Favorite Git Commands
# This is a list of my favorite git commands.
# Keep a clean history by rebasing when you pull.
git pull --rebase
# Short and sweet output for the most used git command.
git status -s
# One line output from git log is usually enough and gives you a better overall picture.
git log --oneline
# Function to start script server
s() {
if [[ $(rails -v) =~ 'Rails 2' ]]; then
script/server $*
else
rails server $*
fi
}
# Functions to start rails server, run generate open console
rails-server () {
if [ -e script/rails ]; then
rails server $*
elif [ -e script/server ]; then
./script/server $*
else
echo "Error: Not a rails app."
fi
}
rails () {
if [ -e script/server ]; then
script/"$@"
else
command rails "$@"
fi
}
@unicornrainbow
unicornrainbow / varnish-2.1.4-req.esis.patch
Created December 6, 2010 17:15
Add req.esis to vcl in varnish 2.1.4
diff --git a/bin/varnishd/cache_vrt.c b/bin/varnishd/cache_vrt.c
index dc855c9..48aa2ea 100644
--- a/bin/varnishd/cache_vrt.c
+++ b/bin/varnishd/cache_vrt.c
@@ -664,6 +664,15 @@ VRT_r_req_esi(struct sess *sp)
/*--------------------------------------------------------------------*/
int
+VRT_r_req_esis(const struct sess *sp)
+{
colorscheme delek
# Hide the toolbar.
if has("gui_running")
set guioptions=egmrt
endif
@unicornrainbow
unicornrainbow / Projects.thor
Created January 6, 2011 17:29
Archive and junk old entres littering your directory.
class Projects < Thor
desc 'archive', 'Archive and junk old entres littering your directory.'
def archive(move_to_dir = Time.now.year.to_s)
Dir.foreach(Dir.pwd) do |entry|
unless entry =~ /^\.|^[\d]{4}|#{move_to_dir}/
case ask "#{entry} (move/junk) or skip: "
when /^m(ove)?$/
FileUtils.mv entry, move_to_dir
when /^j(unk)?$/