Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
@mrrooijen
mrrooijen / gist:913056
Created April 11, 2011 04:27
My Heroku Asset Packager setup
# Gemfile
gem 'jammit-s3', :git => 'git://github.com/meskyanichi/jammit-s3.git'
# config/assets.yml
s3_bucket: mybucket
s3_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
s3_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
s3_permission: public_read
embed_assets: on
@mrrooijen
mrrooijen / sendgrid-smtp.rb
Created May 12, 2011 23:55
SMTP Settings for SendGrid
# This is what people apparently use:
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => 25,
:domain => 'mysite.com',
:authentication => :plain,
:user_name => '[email protected]',
:password => 'sendgrid_password'
}
@mrrooijen
mrrooijen / unicorn.pill
Created May 16, 2011 16:35
Bluepill Process Monitoring configuration for Unicorn Ruby App Server.
#! /usr/bin/env ruby
Bluepill.application("app_name-production") do |app|
app.process("unicorn") do |process|
process.pid_file = File.join(RAILS_ROOT, 'tmp', 'pids', 'unicorn.pid')
process.working_dir = RAILS_ROOT
process.start_command = "/usr/bin/env UNICORN_SERVERS=#{ENV['UNICORN_SERVERS']} #{UNICORN_PATH} -D -c config/unicorn.rb -E production"
process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}"
@mrrooijen
mrrooijen / unicorn.rb
Created May 16, 2011 18:09
Unicorn sample configuration file
# encoding: utf-8
# Spawn 3 workers
worker_processes ENV['UNICORN_SERVERS'].nil? ? 3 : ENV['UNICORN_SERVERS'].to_i
# Restart any workers that haven't responded in 30 seconds
timeout 30
# Listen on a Unix data socket
listen File.join(ENV['HOME'], 'tmp', 'sockets', 'rails', 'unicorn.sock'), :backlog => 2048
@mrrooijen
mrrooijen / deploy.rb
Created May 16, 2011 18:12
Unicorn + Bluepill + Capistrano with RVM
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :application, "my_app"
set :repository, "[email protected]:myuser/myapp.git"
set :branch, "production"
set :rvm_ruby_string, "1.9.2"
set :deploy_to, "/var/applications/"
set :user, "username"
@mrrooijen
mrrooijen / nginx.conf
Created May 23, 2011 01:21
Faye + PrivatePub + HTTPS (SSL) Protocol
location /faye {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
root /var/applications/current/faye;
proxy_pass http://127.0.0.1:4001; # im running faye on port 4001
break;
}
@mrrooijen
mrrooijen / Gemfile
Created June 9, 2011 16:20
Compass with Rails 3.1
gem 'compass', :git => 'https://github.com/chriseppstein/compass.git', :branch => 'rails31'
@mrrooijen
mrrooijen / force-ssl.rb
Created June 20, 2011 03:41
Secure with SSL (Subdomain and Protocol) in Rails 3.1
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :secure_with_ssl
private
def secure_with_ssl
if request.subdomain != 'secure' or request.protocol != 'https'
redirect_to :subdomain => 'secure', :protocol => 'https'
@mrrooijen
mrrooijen / Gemfile
Created June 23, 2011 03:05
Heroku CoffeeScript, Compass, Sprockets in Rails 3.1.rc4
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc4'
gem 'sprockets', '!= 2.0.0.beta.11'
gem 'haml-rails'
gem 'sass-rails'
gem 'compass', :git => 'https://github.com/chriseppstein/compass.git', :branch => 'rails31'
gem 'coffee-script'
gem 'uglifier'
gem 'therubyracer'
@mrrooijen
mrrooijen / deploy.rb
Created June 26, 2011 02:37
Capistrano with Foreman Capfile
# encoding: utf-8
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :application, "hirefireapp"
set :repository, "[email protected]:meskyanichi/myapp.git"
set :branch, "develop"
set :rvm_ruby_string, "1.9.2"