• Stars
    star
    106
  • Rank 325,871 (Top 7 %)
  • Language
    JavaScript
  • Created over 13 years ago
  • Updated almost 13 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Node.js deployment with jake and git

launch – app deployment for node.js

launch is an application deployment framework, essentially a lean set of jake tasks for deploying node apps.

Currently it is tiny, but very extensible.

Installation

launch is for use on projects that have a package.json file in the root to manage their dependencies.

Add launch as a devDependency to your package.json, eg:

"devDependencies" : {
  "launch" : ">=0"
}

And then do

cd /path/to/project && npm install

Since launch is built on top of jake, you will need that too. It's best to install jake globally, so that the binary is in your path, so:

npm install jake -g

The last thing to do is create a Jakefile in your project root. For now, just put the following:

var share = {},
  action = require('launch')(share).action;

To test that launch and jake are installed correctly, do:

jake -T

This should output a list the of namespaced launch tasks.

Usage

You should be familiar with jake

The default set of tasks require a little bit of project metadata. In your package.json, put the following info:

"launchconf" : {
  "remote" : "host-name",
  "remotepath" : "/path/to/apps"
}

Run jake launch:info to make sure you've got this right.

Now you're ready to create some of your own tasks for deployment. Here is an example Jakefile that I currently use:

var share = {}, // Shared info between the
                // Jakefile tasks and the launch tasks
  action = require('launch')(share).action; // Get the launch actions,
                                            // passing in the shared var


/*
 * Run with `jake deploylive`. Depends on `setenvlive` and `restart`
 * which are defined in this file, and `launch:installdeps` which is
 * provided by launch. The task itself is empty, the important things
 * are its dependencies being called in order.
 */
desc('Deploy the current branch to the live environment');
task('deploylive', ['setenvlive', 'launch:symlink', 'restart'], function () {
});

/*
 * Sets the optional enviroment on the shared object
 * to `live`, which is used by a launch task when operating
 * with the remote filesystem. This task depends on the
 * launch task `launch:info` to gather the remote info.
 */
desc('Sets the environment to live');
task('setenvlive', ['launch:info'], function () {
  share.env = 'live';
});


/*
 * A custom task of mine to restart the the site/app
 * (I use upstart). This shows how to execute an arbitrary
 * remote command with launch's `action`s.
 */
desc('Restarts the server given an `env`');
task('restart', function () {

  if (!share.env) {
    action.error('`env` is not set.');
    fail();
  }

  action.remote(share.info.remote,
    'sudo stop site.' + share.info.name + '-' + share.env + ' && '
    + 'sudo start site.' + share.info.name + '-' + share.env, function (exitcode) {
      if (exitcode === 0) {
        action.notice('The site service restarted.');
        action.notice('Check manually to verify that the site is running.')
      } else {
        action.error('Failed to restart site');
        fail();
      }
    });

}, true);

That's it! Enjoy. Oh and here's the obligatory screenshot:

launch running

License

(The MIT License)

Copyright (c) 2011 Ben Gourley <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

slugg

Make strings url safe
JavaScript
367
star
2

currency-symbol-map

A function to lookup the currency symbol for a given currency code
JavaScript
325
star
3

basic-express-site-2016

Simple example Node website using Express (2016 edition)
HTML
69
star
4

js-style-guide

JavaScript style guide
61
star
5

Node-Deployment

Legacy version of my Node.js Deployment process
JavaScript
46
star
6

placeholder

All placholder image services suck. Run your own!
JavaScript
36
star
7

anytime

A date/time picker
JavaScript
22
star
8

break

Know when breakpoints are entered/exited in your JavaScript
JavaScript
18
star
9

minj

Middleware for connect/express to minify client-side javascript files
JavaScript
16
star
10

choo-resume

choo-resume + hot-rld = hot app reload in choo
JavaScript
15
star
11

source-map-decoder

Parse a source map and output the data in a way that makes sense to humans
JavaScript
13
star
12

module.js

A skinny module system for the browser
JavaScript
12
star
13

modal.js

An async modal window for the browser
JavaScript
12
star
14

pebble-tennis

A Pebble Watchapp for keeping track of tennis scores
C
8
star
15

browjadify

Browserify transform. Injects compiled jade templates in place of compileJade() function calls.
JavaScript
7
star
16

hot-rld

Hot reload for js/css files.
JavaScript
6
star
17

darkroom-url-builder

A module that builds URLs for your darkroom resources.
JavaScript
4
star
18

Plugins

A collection of useful plugins
JavaScript
3
star
19

paged.js

A module for handling paged/tabbed content.
JavaScript
3
star
20

Preempt

Add pre-emptive searching to an input element.
JavaScript
3
star
21

clothing-style-guide

2
star
22

gin

An interaction framework for modern browsers
JavaScript
2
star
23

ticker

Cycle through some items in a news-ticker like fashion
JavaScript
2
star
24

Cap

A compile-to-JavaScript language.
JavaScript
2
star
25

find-nearest-file

Find the nearest file with a given name
JavaScript
1
star
26

cf-base-view

A base for frontend cf views to extend
JavaScript
1
star
27

gallery

Responsive JS gallery. Un-opinionated styles & skinnable
JavaScript
1
star
28

node-directory-copy

Copy the contents of one directory to another
JavaScript
1
star
29

logga

A really simple, slightly configurable logger for node.
JavaScript
1
star
30

crud-subservice

Nest crud-services within crud-services
JavaScript
1
star
31

slida

A slider module for the browser, with touch interaction
JavaScript
1
star
32

validity-unique-property

Validity style validator to ensure a property is unique within entities available in a given collection
JavaScript
1
star
33

node-stylus-renderer

Render batches of stylus files with custom config
JavaScript
1
star
34

iowmvc-guide

A guide to frontend MVC with vetnor, merstone and chale
1
star
35

validity-equal

Validity style validator to ensure a property is equal to some primitive value
JavaScript
1
star
36

ventnor

A View for the browser
JavaScript
1
star
37

search-facet-builder

Build a facet data structure for search results
JavaScript
1
star
38

save-memgo

Mock mongo memory engine for save
JavaScript
1
star