Created
February 17, 2012 16:21
-
-
Save gflarity/1854193 to your computer and use it in GitHub Desktop.
simple node.js based deployment tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//each task gets executed in parallel across each host defined, each phase is executed serially | |
//support for running individual phases+tasks should be easy | |
phase( 'web' ) | |
.host( 'a.domain.com' ) | |
.host( 'b.domain.com' ) | |
.config( 'foo', [ 1, 2, 3 ] ) | |
.task( 'checkout code', | |
function( c ) | |
{ | |
//access to info | |
var host = c.host; | |
var foo = c.config.foo; | |
//first we get the previous version | |
c.ssh( 'git show-ref --hash refs/heads/master', | |
function( stdout, stderr ) { c.stash.previous_version = stdout }, ); | |
//update the code | |
c.ssh( 'sudo git reset --hard origin/production' ); | |
//get new version | |
c.ssh( 'git show-refs --hash refs/heads/master', | |
function( stdout, stderr ) { c.stash.current_version = stdout } ); | |
} | |
) | |
.task( 'restart apache', function( c ) { | |
var on_complete = function ( stderr, stdout, exitcode ) { | |
//check that exit code | |
}; | |
c.ssh( 'sudo service apache restart', on_complete ); | |
}) | |
.task( 'email', function( c) { | |
//send out an email | |
} ); | |
phase( 'two' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment