PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/config/deploy/study.rb

https://bitbucket.org/empower/empowerproject_test
Ruby | 81 lines | 44 code | 21 blank | 16 comment | 0 complexity | 4e0391bc5e969faf6acee366f4d68612 MD5 | raw file
  1. # This is a sample Capistrano config file for EC2 on Rails.
  2. # It should be edited and customized.
  3. set :rails_env, "study"
  4. set :application, "empowerproject_study"
  5. set :repository, "ssh://hg@bitbucket.org/empower/empowerproject_study"
  6. set :deploy_to, "/var/www/sites/#{application}"
  7. set :user, "deploy"
  8. set :password, "emp!dep2"
  9. set :use_sudo, false
  10. set :scm, "mercurial"
  11. set :keep_releases, 3
  12. # NOTE: for some reason Capistrano requires you to have both the public and
  13. # the private key in the same folder, the public key should have the
  14. # extension ".pub".
  15. ssh_options[:keys] = ["#{ENV['HOME']}/.ssh/id_rsa"]
  16. #ssh_options[:keys] = ["#{ENV['HOME']}/.ssh/your-ec2-key"]
  17. # Your EC2 instances. Use the ec2-xxx....amazonaws.com hostname, not
  18. # any other name (in case you have your own DNS alias) or it won't
  19. # be able to resolve to the internal IP address.
  20. role :web, "ec2-204-236-133-244.us-west-1.compute.amazonaws.com"
  21. role :app, "ec2-204-236-133-244.us-west-1.compute.amazonaws.com"
  22. role :db, "ec2-204-236-133-244.us-west-1.compute.amazonaws.com", :primary => true
  23. ## alternate syntax for one server
  24. #server "ec2-204-236-166-36.us-west-1.compute.amazonaws.com", :app, :web, :db, :primary => true
  25. #role :web, "ec2-12-xx-xx-xx.z-1.compute-1.amazonaws.com"
  26. #role :app, "ec2-34-xx-xx-xx.z-1.compute-1.amazonaws.com"
  27. #role :db, "ec2-56-xx-xx-xx.z-1.compute-1.amazonaws.com", :primary => true
  28. #role :memcache, "ec2-12-xx-xx-xx.z-1.compute-1.amazonaws.com"
  29. namespace :deploy do
  30. after "deploy:symlink", "custom:resourcelink"
  31. desc "Apache"
  32. task :restart, :roles => [:web] do
  33. default_run_options[:pty] = true
  34. run "sudo /etc/init.d/httpd restart" do |ch, steam, out|
  35. ch.send_data "#{password}\n" if out =~/password/
  36. end
  37. end
  38. end
  39. namespace(:custom) do
  40. task :resourcelink, :roles => [:web] do
  41. run "rm -rf #{release_path}/public/resource_store; ln -s #{shared_path}/resource_store #{release_path}/public/resource_store"
  42. end
  43. end
  44. desc "Schema Load"
  45. task :schemaload, :roles => [:web] do
  46. run "cd #{current_path}; rake RAILS_ENV=demo db:schema:load"
  47. end
  48. desc "DB Migrate"
  49. task :dbmigrate, :roles => [:web] do
  50. run "cd #{current_path}; rake RAILS_ENV=demo db:migrate"
  51. end
  52. desc "DB Create"
  53. task :dbcreate, :roles => [:web] do
  54. run "cd #{current_path}; rake RAILS_ENV=demo db:create"
  55. end
  56. desc "DB Migrate Reset"
  57. task :dbmigrate_reset, :roles => [:web] do
  58. run "cd #{current_path}; rake RAILS_ENV=demo db:migrate:reset"
  59. end
  60. #after "deploy", "dbmigrate_reset"