-
-
Save zudochkin/4594930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) | |
require 'rvm/capistrano' | |
set :application, "hirefireapp" | |
set :repository, "[email protected]:meskyanichi/myapp.git" | |
set :branch, "develop" | |
set :rvm_ruby_string, "1.9.2" | |
set :deploy_to, "/var/applications/#{application}" | |
set :user, "deployer" | |
set :scm, :git | |
set :port, 1117 | |
set :use_sudo, false | |
default_run_options[:pty] = true | |
role :web, "xxx.xx.xx.xx" | |
role :app, "xxx.xx.xx.xx" | |
role :db, "xxx.xx.xx.xx", :primary => true | |
after 'deploy:update', 'bundle:install' | |
after 'deploy:update', 'foreman:export' | |
after 'deploy:update', 'foreman:restart' | |
namespace :bundle do | |
desc "Installs the application dependencies" | |
task :install, :roles => :app do | |
run "cd #{current_path} && bundle --without development test" | |
end | |
end | |
namespace :foreman do | |
desc "Export the Procfile to Ubuntu's upstart scripts" | |
task :export, :roles => :app do | |
run "cd #{release_path} && rvmsudo bundle exec foreman export upstart /etc/init " + | |
"-f ./Procfile.production -a #{application} -u #{user} -l #{shared_path}/log" | |
end | |
desc "Start the application services" | |
task :start, :roles => :app do | |
sudo "start #{application}" | |
end | |
desc "Stop the application services" | |
task :stop, :roles => :app do | |
sudo "stop #{application}" | |
end | |
desc "Restart the application services" | |
task :restart, :roles => :app do | |
run "sudo start #{application} || sudo restart #{application}" | |
end | |
desc "Display logs for a certain process - arg example: PROCESS=web-1" | |
task :logs, :roles => :app do | |
run "cd #{current_path}/log && cat #{ENV["PROCESS"]}.log" | |
end | |
end | |
# stub out deploy:restart | |
namespace :deploy do | |
task :restart do | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment