Code Monkey home page Code Monkey logo

shipit's Introduction

Shipit

![Gitter](https://badges.gitter.im/Join Chat.svg)

Build Status Dependency Status devDependency Status

Shipit logo

Shipit is an automation engine and a deployment tool written for node / iojs.

Shipit was built to be a Capistrano alternative for people who don't know ruby, or who experienced some issues with it. If you want to write tasks in JavaScript and enjoy the node ecosystem, Shipit is also for you.

You can automate anything with Shipit but most of the time you will want to deploy your project using the Shipit deploy task.

Features:

Install

Globally

npm install --global shipit-cli

Locally

npm install --save-dev shipit-cli

Getting Started

Once shipit is installed, you must create a shipitfile.js.

If you are familiar with grunt or gulp, you will feel at home.

Create a shipitfile.js

module.exports = function (shipit) {
  shipit.initConfig({
    staging: {
      servers: 'myproject.com'
    }
  });

  shipit.task('pwd', function () {
    return shipit.remote('pwd');
  });
};

Launch command

shipit staging pwd

Deploy using Shipit

You can easily deploy a project using Shipit and its plugin shipit-deploy.

Example shipitfile.js

module.exports = function (shipit) {
  require('shipit-deploy')(shipit);

  shipit.initConfig({
    default: {
      workspace: '/tmp/github-monitor',
      deployTo: '/tmp/deploy_to',
      repositoryUrl: 'https://github.com/user/repo.git',
      ignores: ['.git', 'node_modules'],
      keepReleases: 2,
      key: '/path/to/key',
      shallowClone: true
    },
    staging: {
      servers: '[email protected]'
    }
  });
};

To deploy on staging, you must use the following command :

shipit staging deploy

You can rollback to the previous releases with the command :

shipit staging rollback

Usage

shipit <environment> <tasks ...>

Options

servers

Type: String or Array<String>

Servers on which the project will be deployed. Pattern must be [email protected] if user is not specified (myserver.com) the default user will be "deploy".

key

Type: String

Path to SSH key

Events

You can add custom event and listen to events.

shipit.task('build', function () {
  // ...
  shipit.emit('built');
});

shipit.on('built', function () {
  shipit.run('start-server');
});

Methods

shipit.task(name, [deps], fn)

Create a new Shipit task, if you are familiar with gulp, this is the same API. You can use a callback or a promise in your task.

For more documentation, please refer to orchestrator documentation.

shipit.task('pwd', function () {
  return shipit.remote('pwd');
});

shipit.blTask(name, [deps], fn)

Create a new Shipit task that will block other tasks during its execution (synchronous).

If you use these type of task, the flow will be exactly the same as if you use grunt.

shipit.blTask('pwd', function () {
  return shipit.remote('pwd');
});

shipit.start(tasks)

Run Shipit tasks.

For more documentation, please refer to orchestrator documentation.

shipit.start('task');
shipit.start('task1', 'task2');
shipit.start(['task1', 'task2']);

shipit.local(command, [options], [callback])

Run a command locally and streams the result. This command take a callback or return a promise.

shipit.local('ls -lah', {cwd: '/tmp/deploy/workspace'}).then(...);

shipit.remote(command, [options], [callback])

Run a command remotely and streams the result. This command take a callback or return a promise.

If you want to run a sudo command, the ssh connection will use the TTY mode automatically.

shipit.remote('ls -lah').then(...);

shipit.remoteCopy(src, dest, [options], [callback])

Make a remote copy from a local path to a dest path.

shipit.remoteCopy('/tmp/workspace', '/opt/web/myapp').then(...);

shipit.log()

Log using Shipit, same API as console.log.

shipit.log('hello %s', 'world');

Dependencies

Who use Shipit?

License

MIT

shipit's People

Contributors

gregberge avatar timkelty avatar vvo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.