Created
July 9, 2011 20:01
-
-
Save alkema/1073903 to your computer and use it in GitHub Desktop.
Capistrano task for a Node.js app with github Forever and NPM.
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
set :application, "appname" | |
set :deploy_to, "/var/www" | |
set :scm, :git | |
set :repository, "[email protected]:user/app.git" | |
default_run_options[:pty] = true | |
set :user, "www-data" | |
set :domain, "foo.tld" | |
set :normalize_asset_timestamps, false | |
role :app, domain | |
role :web, domain | |
role :db, domain, :primary => true | |
namespace :deploy do | |
desc "Stop Forever" | |
task :stop do | |
run "sudo forever stopall" | |
end | |
desc "Start Forever" | |
task :start do | |
run "cd #{current_path} && sudo forever start app.js 80" | |
end | |
desc "Restart Forever" | |
task :restart do | |
stop | |
sleep 5 | |
start | |
end | |
desc "Refresh shared node_modules symlink to current node_modules" | |
task :refresh_symlink do | |
run "rm -rf #{current_path}/node_modules && ln -s #{shared_path}/node_modules #{current_path}/node_modules" | |
end | |
desc "Install node modules non-globally" | |
task :npm_install do | |
run "cd #{current_path} && npm install" | |
end | |
end | |
after "deploy:update_code", "deploy:refresh_symlink", "deploy:npm_install" |
Capistrano 3 update would be really great
I posted a modified Capistrano 3 version here: https://gist.github.com/ryanray/7579912
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any update of this to Capistrano v3.x?