PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/config/deploy.rb

https://bitbucket.org/seseg/pug
Ruby | 48 lines | 37 code | 11 blank | 0 comment | 0 complexity | 9f753e3c59ab78dcd54d73b54a7b495e MD5 | raw file
  1. require 'capistrano/ext/multistage'
  2. require 'bundler/capistrano'
  3. set :stages, %w('production', 'homolog')
  4. set :default_stage, "homolog"
  5. set :application, 'PUG'
  6. set :scm, :git
  7. set :repository, 'git@bitbucket.org:seseg/pug.git'
  8. set :branch, "master"
  9. set :use_sudo, false
  10. set :user, 'applications'
  11. set :deploy_to, "/home/#{user}/apps/#{application}"
  12. set :unicorn_user, user
  13. set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
  14. set :unicorn_config, "#{shared_path}/config/unicorn.rb"
  15. set :unicorn_log, "#{shared_path}/log/unicorn.log"
  16. set :unicorn_workers, 2
  17. default_run_options[:pty] = true
  18. ssh_options[:forward_agent] = true
  19. namespace :deploy do
  20. %w[start stop restart].each do |command| # overrides start, stop and restart tasks
  21. desc "#{command} unicorn server"
  22. task command, roles: :app, except: {no_release: true} do
  23. run "/etc/init.d/unicorn_#{application} #{command}" # cap tasks are proxied to unicorn service
  24. end
  25. end
  26. task :setup_config, roles: :app do
  27. sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
  28. sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
  29. run "mkdir -p #{shared_path}/config"
  30. end
  31. after "deploy:setup", "deploy:setup_config"
  32. desc "Creating mongoid.yml file into latest release"
  33. task :config_database, roles: :app do
  34. run "cp #{release_path}/config/mongoid.example.yml #{release_path}/config/mongoid.yml"
  35. end
  36. before "deploy:finalize_update", "deploy:config_database"
  37. end