Capistrano recipe for deploying node.js apps
Capistrano recipe for deploying node.js apps.
cap deployfunctionality for your node app
yarn) during deploys, using a shared folder for speed
cap node:start) and stopping (
cap node:stop) your node app
First install the gem:
sudo gem install capistrano-node-deploy
or add it to your
Gemfileif you have one:
gem "capistrano-node-deploy"
Now add the following to your
Capfile
require "capistrano/node-deploy"
require "capistrano/node-deploy"set :application, "my-node-app-name" set :repository, "[email protected]:/loopj/my-node-app-name" set :user, "deploy" set :scm, :git set :deploy_to, "/var/apps/my-app-folder"
role :app, "myserver.com"
# Set app command to run (defaults to index.js, or your `main` file from `package.json`) set :app_command, "my_server.coffee"Set additional environment variables for the app
set :app_environment, "PORT=8080"
Set node binary to run (defaults to /usr/bin/node)
set :node_binary, "/usr/bin/coffee"
Set node environment (defaults to production)
set :node_env, "staging"
Set the user to run node as (defaults to deploy)
set :node_user, "james"
Set the name of the upstart command (defaults to #{application}-#{node_env})
set :upstart_job_name, "myserver"
Copyright (c) 2012 James Smith. See LICENSE.txt for further details.