Nodejitsu

Save time managing and deploying your node.js app. Code faster with jitsu and npm

New nodejitsu features

About the author

Name
Location
Worldwide
nodejitsu nodejitsu

Recently, many things changed at nodejitsu, including the introduction of several long-awaited features. Here's a brief overview of what happened and how it affects you.

Zero downtime deploys!

I am thrilled to announce that your application no longer requires stopping in order to start running new code.

Essentially, that means two things:

  • no downtime during regular deployment
  • if deploy fails, your application stays up, running the last snapshot

This feature involves a semantic change to our API. POST /apps/:username/:appname/start first starts a new drone, then kills the old one. You will never again see a
"Cannot start running application" error while accessing this endpoint.

This is different from POST /apps/:username/:appname/restart, which tells our application server to restart the application (as in, kill your process and start it again). Because the restart endpoint affects the already-running instance, zero-downtime does not apply.

Fetching snapshots

Many of our users were asking about a way to fetch an existing snapshot from our cloud, and here it is! The API endpoint for downloading a snapshot is GET /apps/:username/:appname/snapshots/:id.tgz. The API will respond with a tarball.

var fs = require('fs'),
    request = require('request');

request('http://user:pass@api.nodejitsu.com/apps/user/app/snapshots/v0.0.1.tgz')
  .pipe(fs.createWriteStream('user-app-v0.0.1.tgz'));

We also introduced a new command in jitsu: jitsu snapshots fetch. This will download a tarball of your app to your current working directory.

jitsu hooks

Another feature which was requested quite often was pre- and post-deploy hooks for jitsu. Obviously, we implemented them!

In some cases, you might want to perform some action before or after deploying an application. That's where these hooks come in handy.

Example:

{
  "name": "test-app",
  "subdomain": "test-app",
  "scripts": {
    "predeploy": "echo This will be run before deploying the app",
    "postdeploy": "echo This will be run after deploying the app",
    "start": "app.js"
  },
  "engines": {
    "node": "0.6.x"
  },
  "version": "0.0.0"
}

Results in the following output from jitsu:

[maciej@pc08 test-app]$ jitsu deploy
info:    Welcome to Nodejitsu nodejitsu
info:    It worked if it ends with Nodejitsu ok
info:    Executing command deploy
info:    Analyzing your application dependencies in app.js
info:    Checking app availability test-app
info:    Creating app test-app
This will be run before deploying the app
info:    Creating snapshot 0.0.0
info:    Updating app test-app
info:    Activating snapshot 0.0.0 for test-app
info:    Starting app test-app
info:    App test-app is now started
info:    http://test-app.jit.su on Port 80
This will be run after deploying the app
info:    Nodejitsu ok

There are various use-cases, including build or compile steps, tagging releases, and so on.

That's it!

Thanks for all the feedback and support - and if there are other features you think would be awesome, let us know! We're always looking to make our platform even better than it already is.

If you have any questions, feel free to reach out to us at #nodejitsu on
Freenode IRC.