Created
January 25, 2013 10:13
-
-
Save JoeStanton/4633276 to your computer and use it in GitHub Desktop.
Example Capistrano Deployment file for Node.js Projects
This file contains hidden or 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, "SampleApp" | |
set :repository, "." | |
set :scm, :none | |
set :use_sudo, false | |
set :keep_releases, 5 | |
#Use the copy method which will compress and scp the files | |
set :deploy_via, :copy | |
set :main_js, "app.js" | |
desc "Setup the Staging Environment" | |
task :staging do | |
set :branch, 'develop' | |
set :domain, '1.1.1.1' | |
set :user, 'ubuntu' | |
set :applicationdir, "/RedBadger/#{application}" | |
set :deploy_to, applicationdir | |
ssh_options[:keys] = ["deployment/staging.pem"] | |
server '1.1.1.1', :app, :primary => true | |
end | |
namespace :deploy do | |
desc "START the servers" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "NODE_ENV=production forever start -m 20 #{applicationdir}/current/#{main_js}" | |
end | |
desc "STOP the servers" | |
task :stop, :roles => :app, :except => { :no_release => true } do | |
run "#{applicationdir} forever stop #{applicationdir}/current/#{main_js}" | |
end | |
desc "RESTART the servers" | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
run "#{applicationdir} forever restart #{applicationdir}/current/#{main_js}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment