Skip to content

Instantly share code, notes, and snippets.

View rrrodrigo's full-sized avatar

Marcin Bajer rrrodrigo

View GitHub Profile
@rrrodrigo
rrrodrigo / unicorn.config
Created November 18, 2009 10:27
My Unicorn config file for a Rails app deployment
worker_processes 6
working_directory "/web/project/current"
listen '/tmp/unicorn_glass.sock', :backlog => 1
# listen 9292, :tcp_nopush => true
timeout 120
@rrrodrigo
rrrodrigo / Capfile for unicorn deployment
Created November 18, 2009 10:29
Capfile used for a unicorn-based deployment of a Rails app
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
namespace :deploy do
desc "Restart the master unicorn process"
task :restart do
run "kill -USR2 `cat #{deploy_to}/shared/pids/unicorn.pid`"
end
#!/bin/bash
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null

Copy this script to ".git/hooks/post-checkout" in your repository and make it executable:

chmod +x .git/hooks/post-checkout

Tweak it at will. I'm refreshing the bundle and restarting the app server because the Gemfile is different on my "hosted" branch than on other branches.

# Nginx config for Hudson CI behind a virtual host with SSL.
# Replace hudson.example.com with your domain name.
# Upstream Hudson server, e.g.: on port 3001
upstream hudson {
server localhost:3001
}
# Redirect all HTTP requests to HTTPS.
server {
@rrrodrigo
rrrodrigo / rails-app
Created September 23, 2010 13:51
Rails production.log rolling using the standard Linux logrotate mechanism
# put this into /etc/logrotate.d/app-production
# to have a Rails app running on unicorns rotating/rolling its logs monthly
# check with logrotate -f /etc/logrotate.d/app-production
/web/app/production/shared/log/*.log {
monthly
missingok
rotate 24
compress
delaycompress
@rrrodrigo
rrrodrigo / gist:602675
Created September 29, 2010 12:35
sample initscript for a Rails app, using Capistrano locally to start the services after a reboot
We couldn’t find that file to show.
@rrrodrigo
rrrodrigo / unicorn.sh
Created January 21, 2011 05:36
init.d script for starting multiple unicorn-based apps
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
@rrrodrigo
rrrodrigo / redis-server-for-init.d-startup
Created February 11, 2011 09:44 — forked from enaeseth/redis-server-for-init.d-startup
fork of eneaseth's init script adjusted for multiple redis-server instances, each with it's config, log, pid and port
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@rrrodrigo
rrrodrigo / start_node.sh
Created February 11, 2011 12:16
an unfinished attempt at creating a Node.js init script - in the end I went with https://github.com/indexzero/forever
#!/bin/bash
if [ -f node.pid ] ; then
rm node.pid
fi
node node_script.js &
PID=$!
sleep 1