gittyup

Gittyup is a small node.js application deployment library similar to n.

Gittyup is a small node.js application deployment library similar to n.

  • Command Line Interface.
  • Rollback support.
  • Script testing before using.
  • Start/Stop/Restart checked out apps.
  • Make a slug out of your app and easily move it quickly between servers.
gup checkout daisy --repo=https://github.com/crcn/daisy.git --branch=app-branch
gup use daisy r5 #use a particular checkout 
 help                                                                             
 rollback :name                                  Rollback a repositoriy           
 history :name                                   Repo history                     
 use :name :release                              Uses a repo                      
 checkout :name :repo OR checkout :name          checks out a repository

root directory by default is /etc/gittyup/

 
var gittyup = require('gittyup')('/etc/bonsai/garden/'),
app = gittyup.app('myApp');
 
 
app.checkout('myProjectSource', function(errresult)
{
 
    //something went wrong in the checkout phase - most likely in linking, rollback 
    if(err) return app.rollback();  
                 
    
    //test to make sure everythings good 
    app.test(function(errresult)
    {
        //something went wrong in the testing phase, rollback 
        if(err) return app.rollback();
 
 
        //start upp the application 
        app.process(function(errprocess)
        {
            process.start();
        });
    });
});
 
//... 
 

First argument can be either a string (app name), or object

  • name - The name of the application.
  • group - The group the application is in.
  • maxRecords - Maximum number of application records to keep locally.
  • opsOrSource - Options (object) or the repo source (string) for the app.
    • repository - repository of the project. Can be local directory, git repo, or .slug file

From a git repository:

 
gittyup.app('myApp').checkout('git@github.com:spiceapps/gittyup-test.git', function(errresult)
{
    //do stuff! 
});
 

From a generated slug:

 
gittyup.app('myApp').checkout('http://mydomain.com/someApp.slug', function(errresult)
{
});
 

From a local directory:

 
gittyup.app('myApp').checkout('/some/local/path', function(errresult)
{
    
});
 

Returns a runnable process of the current checked out item.

 
 
gittyup.app('myApp').process(function(errprocess)
{
 
    process.start(function(errresult)
    {
        //... 
    });
 
    process.stop(function(errresult)
    {
        //... 
    });
 
    process.restart(function(errresult)
    {
        //... 
    });
});
 
 
```
 
#### .app().test(callback)
 
Tests the most recent checked out item. Make sure to include "scripts:test" in your package.json. Something like:
 
```javascript
 
 
{
    "name": "myApp",
 
    "scripts": {
        "test": "./test"
    }
}

When exiting the test program, an exit code of 0 tells gittyup the test was successful, whereas 1 tells gittyup the test failed.

Makes a slug out of the current checkout. Use this method if you need to move the application around between servers. Once a slug is made, calling "makeSlug" on the same checkout will have no effect.

 
gittyup.app('myApp').makeSlug(function(erritem)
{
    console.log(item.slug); // /etc/gittyup/apps/myApp/16767565434/slug/753a644f4e7aaa7fc9132be92d000002.tar.gz 
 
});
 

If you're moving the slug around, install gittyup on the other end and have something ready like this:

 
gittyup.app('myApp').checkout('http://myServer.com/myApp.slug', function(errresult)
{
    //...do stuff with transported slug 
})
 

Returns Information about the current checked out item.

Returns checkout history of the given application.

Uses a previously used checkout item without removing the current one.

Removes a checked out item.

Destroys the application, and all the checked out items.