-
-
Save amite/e3c2269421296e857d51 to your computer and use it in GitHub Desktop.
nodejs app deployment with capistrano
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
#created by @nthgergo | |
set :application, "APPLICATION_NAME" | |
set :scm, :git | |
set :repository, "GIT_URL" | |
set :user, "ec2-user" | |
set :ssh_options, { :forward_agent => true } | |
default_run_options[:pty] = true | |
set :use_sudo, false | |
set :branch, "master" | |
role :app, "IP_ADDRESS" | |
set :deploy_to, "/home/ec2-user/DEPLOY_HERE" | |
set :default_environment, { | |
'PATH' => "/home/ec2-user/.nvm/v0.10.15/bin:$PATH", | |
'NODE_ENV' => 'production' | |
} | |
namespace :deploy do | |
desc "Stop Forever" | |
task :stop do | |
run "/home/ec2-user/.nvm/v0.10.15/bin/forever stopall; true" | |
end | |
desc "Start Forever" | |
task :start, :on_error => :continue do | |
run "cd #{current_path} && /home/ec2-user/.nvm/v0.10.15/bin/forever start app.js" | |
end | |
desc "Restart Forever" | |
task :restart do | |
stop | |
sleep 5 | |
start | |
end | |
desc "Check required packages and install if packages are not installed" | |
task :install_packages do | |
run "cd #{release_path} && bower install" | |
run "cd #{release_path} && /home/ec2-user/.nvm/v0.10.15/bin/npm install --production --loglevel warn" | |
end | |
end | |
after "deploy:update_code", "deploy:install_packages" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment