lib/capistrano/node-deploy.rb in capistrano-node-deploy-1.2.13 vs lib/capistrano/node-deploy.rb in capistrano-node-deploy-1.2.14

- old
+ new

@@ -36,13 +36,13 @@ set :application, package_json["name"] unless defined? application set :app_command, package_json["main"] || "index.js" unless defined? app_command set :app_environment, "" unless defined? app_environment set :node_binary, "/usr/bin/node" unless defined? node_binary - set :npm_binary, "/usr/bin/npm" unless defined? npm_binary set :node_env, "production" unless defined? node_env set :node_user, "deploy" unless defined? node_user + set :kill_timeout, 5 unless defined? kill_timeout set :stdout_log_path, lambda { "#{shared_path}/log/#{node_env}.out.log" } set :stderr_log_path, lambda { "#{shared_path}/log/#{node_env}.err.log" } set :upstart_job_name, lambda { "#{application}-#{node_env}" } unless defined? upstart_job_name @@ -56,10 +56,11 @@ start on runlevel [2345] stop on shutdown respawn respawn limit 99 5 +kill timeout #{kill_timeout} script cd #{current_path} && exec sudo -u #{node_user} NODE_ENV=#{node_env} #{app_environment} #{node_binary} #{current_path}/#{app_command} 2>> #{stderr_log_path} 1>> #{stdout_log_path} end script EOD @@ -67,14 +68,11 @@ namespace :node do desc "Check required packages and install if packages are not installed" task :install_packages do - run "mkdir -p #{shared_path}/node_modules" - run "cp #{release_path}/package.json #{shared_path}" - run "cp #{release_path}/npm-shrinkwrap.json #{shared_path}" if remote_file_exists?("#{release_path}/npm-shrinkwrap.json") - run "cd #{shared_path} && #{npm_binary} install --loglevel warn" - run "ln -s #{shared_path}/node_modules #{release_path}/node_modules" + run "mkdir -p #{previous_release}/node_modules ; cp -r #{previous_release}/node_modules #{release_path}" if previous_release + run "cd #{release_path} && npm install --loglevel warn" end task :check_upstart_config do create_upstart_config if remote_file_differs?(upstart_file_path, upstart_file_contents) end