Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Deploy app to remote server via ssh, inspired by capistrano

branch: master

Merge pull request #7 from waffleio/master Badge
latest commit fc92f7f7ab
Anatoliy Chakkaev authored February 05, 2014
Octocat-spinner-32 bin Print version January 13, 2014
Octocat-spinner-32 cockout Fix typos January 03, 2014
Octocat-spinner-32 lib Fix typos January 03, 2014
Octocat-spinner-32 test Fix tests October 15, 2012
Octocat-spinner-32 .gitignore Removed travis node 0.4 April 30, 2012
Octocat-spinner-32 .travis.yml Update travis config January 23, 2014
Octocat-spinner-32 add badge February 05, 2014
Octocat-spinner-32 package.json 0.0.9 January 13, 2014

Stories in Ready


Command line tool allows you to execute commands on remote server(s) or locally. Useful for deployment, monitoring and other tasks.


npm install roco -g


roco deploy:setup   # prepare deploy (create directories)
roco deploy         # update code and restart server


Use one of three ways for configuring your app: package.json, or ENV vars


roco looking for package.json in working directory and set these variables:

  • as application
  • as repository
  • pkg.repository.type as scm

roco looking for file in /etc/, ~/, ./, ./config/ paths

This files can extend behavior of roco and configure variables. Checkout examples to learn how to use it

ENV vars

  • HOSTS - comma separated list of hosts
  • APP - name of application


my ~/ file

namespace 'deploy', ->
    # show status of running application
    task 'status', ->
        run "sudo status #{roco.application}"

namespace 'git', ->
    # setup remote private repo
    task 'remote', ->
        app = roco.application
        run """
        mkdir #{app}.git;
        cd #{app}.git;
        git --bare init;
        """, (res) ->
            localRun """
            git remote add origin #{res[0].host}:#{app}.git;
            git push -u origin master

# some tasks for monitoring server state
namespace 'i', ->
    task 'disk', (done) -> run 'df -h', done
    task 'top',  (done) -> run 'top -b -n 1 | head -n 12', done
    task 'who',  (done) -> run 'who', done
    task 'node', (done) -> run 'ps -eo args | grep node | grep -v grep', done
    task 'free', (done) -> run 'free', done

    task 'all', (done) ->
        sequence 'top', 'free', 'disk', 'node', done

    # display last 100 lines of application log
    task 'log', ->
        run "tail -n 100 #{roco.sharedPath}/log/#{roco.env}.log"


Current deploy script allows you deploy upstart-controlled applications out of box, just run

roco deploy:setup:upstart

to setup upstart script and create dirs, if you use another solution for node daemon management feel free to rewrite start/stop/restart scripts:

namespace 'deploy', ->
    task 'start', (done) -> run "cd #{roco.currentPath}; forever start server.js"
    task 'stop', (done) -> run "cd #{roco.currentPath}; forever stop"

Another snippets

Update nodejs on server(s)


set 'nodever', '0.8.10'
namespace 'node', ->
  task 'update', (done) -> sequence 'download', 'unpack', 'compile', 'install', done
  task 'rebuild', (done) -> sequence 'unpack', 'compile', 'install', done
  task 'download', (done) ->
    run "cd /tmp && wget{roco.nodever}/node-v#{roco.nodever}.tar.gz", done
  task 'unpack', (done) ->
    run "cd /tmp && tar xfv node-v#{roco.nodever}.tar.gz", done
  task 'compile', (done) ->
    run "cd /tmp/node-v#{roco.nodever} && ./configure && make", done
  task 'install', (done) ->
    run "cd /tmp/node-v#{roco.nodever} && sudo make install", done

Example: update nodejs on localhost and hosts

HOSTS=localhost, roco node:update



Something went wrong with that request. Please try again.