- Start a Sinatra server on port 4000
- GET / to that server triggers a
git pull
and mod_rails restart - Hit port 4000 locally after pushing
🏳️⚧️
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
## | |
# Returns the command that will check out +revision+ from the | |
# repository into directory +destination+. +revision+ can be any | |
# SHA1 or equivalent (e.g. branch, tag, etc...) | |
def checkout(revision, destination) | |
destination = File.join(destination, 'repo') | |
revision = 'HEAD' if revision =~ /head/i | |
[ "rm -rf #{destination}", |
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
set :normal_symlinks, %w( | |
config/solr.yml | |
config/memcached.yml | |
config/database.yml | |
config/mongrel_cluster.yml | |
) | |
set :weird_symlinks, { | |
'network_data_cache' => 'tmp/network_data_cache', | |
'impact_data_cache' => 'tmp/impact_data_cache', |
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
# basics | |
load 'config/deploy/sudo_everywhere' | |
load 'config/deploy/settings' | |
# daemons | |
load 'config/deploy/services' | |
load 'config/deploy/queue' | |
load 'config/deploy/import' | |
load 'config/deploy/gem_eval' |
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
desc "Shrink the js" | |
task :minimize_js, :roles => :app, :except => { :no_release => true } do | |
require 'lib/js_minimizer' | |
paths = [] | |
paths += Dir['public/javascripts/jquery.*.js'].sort | |
paths += Dir['public/javascripts/github.*.js'].sort | |
paths = paths.flatten | |
put JSMinimizer.minimize_files(*paths), "#{release_path}/public/javascripts/bundle.js" | |
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
desc "Shrink and bundle js and css" | |
task :bundle, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path}; RAILS_ROOT=#{current_path} rake bundle:all" | |
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
RAILS_ROOT ||= ENV["RAILS_ROOT"] | |
namespace :bundle do | |
task :all => [ :js, :gist_js, :css ] | |
task :js do | |
require 'lib/js_minimizer' | |
paths = [] | |
paths += Dir[RAILS_ROOT + '/public/javascripts/jquery.*.js'].sort | |
paths += Dir[RAILS_ROOT + '/public/javascripts/github.*.js'].sort |
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
# 9 workers and 1 master | |
worker_processes 9 | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true | |
# Restart any workers that haven't responded in 30 seconds | |
timeout 30 |
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
after_fork do |server, worker| | |
## | |
# Set the listening HTTP port for each of the workers dynamically | |
port = 5000 + worker.nr | |
begin | |
server.listen("127.0.0.1:#{port}") | |
rescue Errno::EADDRINUSE | |
# we couldn't grab the port we want so just keep |
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
# port 3000 is haproxy | |
upstream github { | |
server 127.0.0.1:3000; | |
} | |
# unicorn master opens a unix domain socket | |
upstream github { | |
server unix:/data/github/current/tmp/sockets/unicorn.sock; | |
} |