Skip to content

Instantly share code, notes, and snippets.

Created August 16, 2013 11:35
Show Gist options
  • Save anonymous/6249142 to your computer and use it in GitHub Desktop.
Save anonymous/6249142 to your computer and use it in GitHub Desktop.
#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