public
Last active

Rake tasks for easier Facebook development.

  • Download Gist
.htaccess
ApacheConf
1 2 3 4 5 6
RewriteEngine On
RewriteBase /
 
# Everything not found goes to Sinatra / Rack
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://127.0.0.1:4567%{REQUEST_URI} [L,P,QSA]
deploy-passenger.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#
# Taken from http://www.appelsiini.net/2010/rake-tasks-for-facebook
# For Passenger and Apache
#
set :application, "foo-bar"
set :repository, "git@github.com:username/#{application}.git"
set :user, "sinatra"
set :server, "#{application}.example.com"
set :domain, "#{user}@#{server}"
set :deploy_to, "/www/#{server}"
set :remote_port, 4567
set :local_port, 9393
 
require "vlad"
 
namespace :vlad do
desc "Deploy the code and restart the server"
task :deploy => [:update, :start_app]
end
 
namespace :dev do
task :start_shotgun do
system "shotgun --port=#{local_port} rackup.ru"
end
 
desc "Start ssh tunnel between #{server}:#{remote_port} and localhost:#{local_port}"
task :start_tunnel do
puts "Tunneling #{server}:#{remote_port} to localhost:#{local_port}"
system "autossh -M 48484 -nNT -g -R *:#{remote_port}:127.0.0.1:#{local_port} #{server}"
end
 
remote_task :symlink do
puts "Symlinking shared/htaccess to current/public/.htaccess"
run "rm #{current_release}/public/.htaccess"
run "ln -s #{shared_path}/htaccess #{current_release}/public/.htaccess"
end
 
desc "Switch to tunneled development mode."
multitask :start => [ "dev:symlink", "dev:start_shotgun", "dev:start_tunnel" ]
end
deploy.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#
# Taken from http://www.appelsiini.net/2010/rake-tasks-for-facebook
# For Thin and Apache
#
set :application, "foo-bar"
set :repository, "git@github.com:username/#{application}.git"
set :user, "sinatra"
set :server, "#{application}.example.com"
set :domain, "#{user}@#{server}"
set :deploy_to, "/www/#{server}"
set :thin_port, 8013
set :thin_socket, nil
set :thin_servers, 1
set :thin_rackup, "#{deploy_to}/current/rackup.ru"
set :local_port, 9393
 
require "vlad"
 
namespace :vlad do
desc "Deploy the code and restart the server"
task :deploy => [:update, :start_app]
end
 
namespace :dev do
task :start_shotgun do
system "shotgun --port=#{local_port} rackup.ru"
end
 
desc "Start ssh tunnel between #{server}:#{thin_port} and localhost:#{local_port}"
task :start_tunnel do
puts "Tunneling #{server}:#{thin_port} to localhost:#{local_port}"
system "autossh -M 48484 -nNT -g -R *:#{thin_port}:127.0.0.1:#{local_port} #{server}"
end
desc "Switch to tunneled development mode."
multitask :start => [ "vlad:stop_app", "dev:start_shotgun", "dev:start_tunnel" ]
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.