Guest User

Untitled

a guest
Jun 22nd, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. set :runner, "aboutredlands"
  2. set :use_sudo, false
  3.  
  4. # =============================================================================
  5. # CUSTOM OPTIONS
  6. # =============================================================================
  7. set :user, "aboutredlands"
  8. set :application, "about_redlands2"
  9. set :domain
  10.  
  11. role :web, domain
  12. role :app, domain
  13. role :db, domain, :primary => true
  14.  
  15. # =============================================================================
  16. # DATABASE OPTIONS
  17. # =============================================================================
  18. set :rails_env, "production"
  19.  
  20. # =============================================================================
  21. # DEPLOY TO
  22. # =============================================================================
  23. set :deploy_to, "/home/#{user}/apps/#{application}"
  24.  
  25. # =============================================================================
  26. # REPOSITORY
  27. # =============================================================================
  28. set :scm, "git"
  29. set :repository, "/Users/ryan/Documents/RWLD/rails/#{application}"
  30. set :branch, "master"
  31. set :deploy_via, :copy
  32. set :copy_exclude, [".svn", ".git"]
  33.  
  34. # =============================================================================
  35. # SSH OPTIONS
  36. # =============================================================================
  37.  
  38. default_run_options[:pty] = true
  39. ssh_options[:paranoid] = false
  40. ssh_options[:keys] = %w(/Users/ryan/.ssh/id_rsa)
  41. ssh_options[:port] = 22
  42.  
  43.  
  44. # =============================================================================
  45. # RAKE TASKS & OTHER SERVER TASKS
  46. # =============================================================================
  47.  
  48. desc 'Fix attachment_fu'
  49. task :fix_attachment_fu, :roles => :app do
  50. %w{attachments banners features logos pdfs}.each do |share|
  51. run "rm -rf #{release_path}/public/#{share}"
  52. run "mkdir -p #{shared_path}/system/#{share}"
  53. run "ln -nfs #{shared_path}/system/#{share} #{release_path}/public/#{share}"
  54. end
  55. end
  56.  
  57.  
  58.  
  59. desc "Create symlink to public_html/#{domain}/public"
  60. task :symlinkify do
  61. run "rm -rf /home/#{user}/public_html; ln -s /home/#{user}/apps/#{application}/current/public /home/#{user}/public_html"
  62. end
  63.  
  64. # say release path
  65. desc "Say realease path"
  66. task :say_release_path do
  67. run "printf #{release_path} #{shared_path}"
  68. end
  69.  
  70. desc "Reload Pasenger"
  71. task :reload_passenger do
  72. run "touch #{release_path}/tmp/restart.txt"
  73. end
  74.  
  75. #build Assests
  76. desc "Build JS and CSS Assets"
  77. task :build_asset_packeges do
  78. run <<-EOF
  79. cd #{release_path} && rake asset:packager:build_all
  80. EOF
  81. end
  82.  
  83. #clear action cache
  84. desc "Clear Action Cache"
  85. task :clear_action_cache do
  86. run <<-EOF
  87. cd #{release_path} && rake tmp:cache:clear
  88. EOF
  89. end
  90. #desc "Reload Apache"
  91. #task :reload_apache do
  92. # sudo "/etc/init.d/apache2 reload"
  93. #end
  94.  
  95. # doesn't work yet, but would be good to add.
  96. # desc 'Install all gems'
  97. # task :rake_gems, :roles => :app do
  98. # run "cd #{release_path}"
  99. # run "rake gems:install"
  100. # end
  101.  
  102. after "deploy", "deploy:migrations"
  103. after "deploy:migrations", "deploy:cleanup"
  104. after "deploy:cleanup", "symlinkify"
  105. after "symlinkify", "fix_attachment_fu"
  106. after "fix_attachment_fu", "build_asset_packeges"
  107. after "build_asset_packeges", "clear_action_cache"
  108. after "clear_action_cache", "reload_passenger"
Add Comment
Please, Sign In to add comment