Skip to content

Instantly share code, notes, and snippets.

View rrrodrigo's full-sized avatar

Marcin Bajer rrrodrigo

View GitHub Profile
@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
# 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 {

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.

#!/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
@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
@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