Skip to content

Instantly share code, notes, and snippets.

@eadz
Created September 6, 2010 00:23
Show Gist options
  • Select an option

  • Save eadz/566478 to your computer and use it in GitHub Desktop.

Select an option

Save eadz/566478 to your computer and use it in GitHub Desktop.
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
desc "Link in the production database.yml"
task :after_update_code do
run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml"
run "ln -nfs #{deploy_to}/#{shared_dir}/config/amazon_s3.yml #{release_path}/config/amazon_s3.yml"
end
namespace :deploy do
desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "#{t} task is a no-op with mod_rails"
task t, :roles => :app do ; end
end
end
namespace :rake do
task :show_tasks do
run("cd #{deploy_to}/current; /usr/bin/rake -T")
end
task :stop_sphinx do
run("cd #{deploy_to}/current; export RAILS_ENV=production; /usr/bin/rake ultrasphinx:daemon:stop")
end
task :start_sphinx do
run("cd #{deploy_to}/current; export RAILS_ENV=production; /usr/bin/rake ultrasphinx:configure")
run("cd #{deploy_to}/current;export RAILS_ENV=production; /usr/bin/rake ultrasphinx:index")
run("cd #{deploy_to}/current; export RAILS_ENV=production; /usr/bin/rake ultrasphinx:daemon:start")
end
end
before "deploy", "rake:stop_sphinx"
after "deploy", "deploy:migrate"
after "deploy", "deploy:cleanup"
after "deploy", "rake:start_sphinx"
default_run_options[:pty] = true
set :application, "example.com"
set :repository, "git@github.com:eadz/example.git"
set :git_enable_submodules, true
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/home/example/domains/#{application}"
# If you aren't using Subversion to manage your source code, specify
# your SCM below:
set :scm, :git
#set :branch, "production"
set :deploy_via, :remote_cache
set :vps, "89.111.111.111"
set :user, "example_user"
set :use_sudo, false
role :app, vps
role :web, vps
role :db, vps , :primary => true
#sometimes paths dont work.
#set :rake, "/var/lib/gems/1.8/bin/rake"
#set :rake, "/opt/rubye/bin/rake"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment