This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Api::BaseController < ActionController::Base | |
protect_from_forgery with: :null_session | |
before_action :unauthorized_if_signed_out | |
layout false | |
def current_user | |
@current_user ||= ( | |
authenticate_or_request_with_http_token do |token, options| | |
User.find_by(api_key: token) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ResqueStaleWorkerCleaner | |
SLOWEST_JOB = (ENV["SLOWEST_JOB"] || 30).to_i # minutes | |
def call | |
Resque.workers.each do |worker| | |
worker.unregister_worker if old_worker?(worker) | |
end | |
end | |
private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 1 > /proc/sys/vm/overcommit_memory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is what people apparently use: | |
ActionMailer::Base.smtp_settings = { | |
:address => 'smtp.sendgrid.net', | |
:port => 25, | |
:domain => 'mysite.com', | |
:authentication => :plain, | |
:user_name => 'sendgrd_username@mysite.com', | |
:password => 'sendgrid_password' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) | |
require "rvm/capistrano" | |
set :application, "my_app" | |
set :repository, "git@trunksapp.com:myuser/myapp.git" | |
set :branch, "production" | |
set :rvm_ruby_string, "1.9.2" | |
set :deploy_to, "/var/applications/" | |
set :user, "username" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'compass', :git => 'https://github.com/chriseppstein/compass.git', :branch => 'rails31' |
OlderNewer