Skip to content

Instantly share code, notes, and snippets.

worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler
# Unicorn tasks
namespace :unicorn do
def pid_path
"#{shared_path}/pids/unicorn.pid"
end
def socket_path
"#{shared_path}/sockets/unicorn.sock"
end
@everaldo
everaldo / gist:6030414
Created July 18, 2013 15:45
upgrading Nginx Gracefully
Replace the old Nginx binary (by default, /usr/local/nginx/sbin/nginx) with the new one.
Find the pid of the Nginx master process, for example, with ps x | grep nginx | grep master or by looking at the value found in the pid file.
Send a USR2 (12) signal to the master process kill USR2 ***, replacing *** with the pid found in step 2. This will initiate the upgrade by renaming the old .pid file and running the new binary.
Send a WINCH (28) signal to the old master process kill WINCH ***, replacing *** with the pid found in step 2. This will engage a graceful shutdown of the old worker processes.
@everaldo
everaldo / .gitignore
Last active December 20, 2015 07:19
Unicorn Deploy with Capistrano
## other files ommited
config/deploy.rb
config/unicorn.rb
config/nginx.conf
config/unicorn_init.sh
# Put that on config/environments/production.rb
config.assets.precompile << lambda do |path|
if path =~ /\.(css|js)\z/
full_path = Rails.application.assets.resolve(path).to_path
app_assets_path = Rails.root.join('app', 'assets').to_path
return true if full_path.starts_with? app_assets_path
end
false
end
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
@everaldo
everaldo / gist:6306083
Created August 22, 2013 11:32
Desabilitar TouchPad Vostro
xinput list
xinput set-prop <ID DISPOSITIVO> "Device Enabled" 0
@everaldo
everaldo / ctags_hook.sh
Last active June 30, 2019 15:13
fugitive.vim (vim-fugitive): a git wrapper ctags: index and navegation of source files References: http://tbaggery.com/2011/08/08/effortless-ctags-with-git.html https://github.com/tpope/vim-fugitive
# Put the content of this file in: .git_template/hooks/ctags and give execution permission
#!/bin/sh
set -e
PATH="/usr/local/bin:$PATH"
trap "rm -f .git/tags.$$" EXIT
ctags --tag-relative -Rf.git/tags.$$ --exclude=.git --languages=-javascript,sql
mv .git/tags.$$ .git/tags
@everaldo
everaldo / installing_redis
Last active December 27, 2015 00:19
Installing Postgres and Redis
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server
@everaldo
everaldo / .profile
Created November 8, 2013 01:55
Mapping for Ctrl+S to save current buffer on Vim. Adapted from: http://vim.wikia.com/wiki/Map_Ctrl-S_to_save_current_or_new_files
vim()
{
local STTYOPTS="$(stty --save)"
stty stop '' -ixoff
command vim "$@"
stty "$STTYOPTS"
}