Skip to content

Instantly share code, notes, and snippets.

@nicolasembleton
Forked from alkema/deploy.rb
Created June 16, 2013 12:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nicolasembleton/5791844 to your computer and use it in GitHub Desktop.
Save nicolasembleton/5791844 to your computer and use it in GitHub Desktop.
set :application, "appname"
set :deploy_to, "/var/www"
set :scm, :git
set :repository, "git@github.com: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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment