Guest User

Untitled

a guest
Mar 12th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. set :application, "myapp"
  2. set :keep_releases, 5
  3.  
  4. # git options
  5. set :scm, "git"
  6. set :repository, "git://github.com/weldyss/app.git"
  7. set :branch, "master"
  8. set :deploy_via, :remote_cache
  9.  
  10. # deploy credentials
  11. set :user, "deploy"
  12. set :deploy_to, "/home/#{user}/#{application}"
  13. set :use_sudo, false
  14.  
  15. # server definitions
  16. set :servers, "example.com"
  17. role :app, servers
  18. role :web, servers
  19. role :db, servers, :primary => true
  20.  
  21. default_run_options[:pty] = true
  22.  
  23. # working with Passenger
  24. namespace :deploy do
  25. desc "Restarting mod_rails with restart.txt"
  26. task :restart, :roles => :app, :except => { :no_release => true } do
  27. run "touch #{current_path}/tmp/restart.txt"
  28. end
  29.  
  30. [:start, :stop].each do |t|
  31. desc "don't need #{t} task with mod_rails"
  32. task t, :roles => :app do
  33. run "touch #{current_path}/tmp/restart.txt"
  34. end
  35. end
  36. end
  37.  
  38. desc "Link in the production database.yml"
  39. task :after_update_code do
  40. run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml"
  41. end
  42.  
  43. # Only runs this task after deploy:setup
  44. # Used to create a new config/database.yml which differs from the repository
  45. namespace :init do
  46. desc "Create production-only database.yml"
  47. task :production_database_yml do
  48. database_configuration =<<-EOF
  49. production:
  50. adapter: mysql
  51. encoding: utf8
  52. reconnect: false
  53. database: #{application}_production
  54. pool: 5
  55. username: root
  56. password:
  57. socket: /var/run/mysqld/mysqld.sock
  58. EOF
  59.  
  60. run "mkdir -p #{shared_path}/config"
  61. put database_configuration, "#{shared_path}/config/database.yml"
  62. end
  63. end
  64.  
  65. after "deploy:setup", "init:production_database_yml"
Add Comment
Please, Sign In to add comment