Giter VIP home page Giter VIP logo

shipit-deploy's Introduction

shipit-deploy

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

Build Status Dependency Status devDependency Status

Set of deployment tasks for Shipit based on git and rsync commands.

Features:

  • Deploy tag, branch or commit
  • Add additional behaviour using hooks
  • Build your project locally or remotely
  • Easy rollback

Install

npm install shipit-deploy

Usage

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,
      deleteOnRollback: false,
      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

Options

workspace

Type: String

Define a path to an empty directory where Shipit builds it's syncing source. Beware to not set this path to the root of your repository as shipit-deploy cleans the directory at the given path as a first step.

dirToCopy

Type: String Default: same as workspace

Define directory within the workspace which should be deployed.

deployTo

Type: String

Define the remote path where the project will be deployed. A directory releases is automatically created. A symlink current is linked to the current release.

repositoryUrl

Type: String

Git URL of the project repository.

branch

Type: String

Tag, branch or commit to deploy.

ignores

Type: Array<String>

An array of paths that match ignored files. These paths are used in the rsync command.

deleteOnRollback

Type: Boolean

Whether or not to delete the old release when rolling back to a previous release.

keepReleases

Type: Number

Number of releases to keep on the remote server.

shallowClone

Type: Boolean

Perform a shallow clone. Default: false.

gitLogFormat

Type: String

Log format to pass to git log. Used to display revision diffs in pending task. Default: %h: %s - %an.

Variables

Several variables are attached during the deploy and the rollback process:

shipit.config.*

All options describe in the config sections are avalaible in the shipit.config object.

shipit.repository

Attached during deploy:fetch task.

You can manipulate the repository using git command, the API is describe in gift.

shipit.releaseDirname

Attached during deploy:update and rollback:init task.

The current release dirname of the project, the format used is "YYYYMMDDHHmmss" (moment format).

shipit.releasesPath

Attached during deploy:init, rollback:init, and pending:log tasks.

The remote releases path.

shipit.releasePath

Attached during deploy:update and rollback:init task.

The complete release path : path.join(shipit.releasesPath, shipit.releaseDirname).

shipit.currentPath

Attached during deploy:init, rollback:init, and pending:log tasks.

The current symlink path : path.join(shipit.config.deployTo, 'current').

Workflow tasks

  • deploy
    • deploy:init
      • Emit event "deploy".
    • deploy:fetch
      • Create workspace.
      • Initialize repository.
      • Add remote.
      • Fetch repository.
      • Checkout commit-ish.
      • Merge remote branch in local branch.
      • Emit event "fetched".
    • deploy:update
      • Create and define release path.
      • Remote copy project.
      • Emit event "updated".
    • deploy:publish
      • Update symlink.
      • Emit event "published".
    • deploy:clean
      • Remove old releases.
      • Emit event "cleaned".
  • rollback
    • rollback:init
      • Define release path.
      • Emit event "rollback".
    • deploy:publish
      • Update symlink.
      • Emit event "published".
    • deploy:clean
      • Remove old releases.
      • Emit event "cleaned".
    • rollback:finish
      • Emit event "rollbacked".
  • pending
    • pending:log
      • Log pending commits (diff between HEAD and currently deployed revision) to console.

Dependencies

Local

  • git 1.7.8+
  • rsync 3+
  • OpenSSH 5+

Remote

  • GNU coreutils 5+

License

MIT

shipit-deploy's People

Contributors

antjanus avatar brycefisher avatar emvu avatar etiennecharignon avatar gregberge avatar halfdan avatar jokero avatar ryantemple avatar stephank avatar turbobeast avatar

Watchers

 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.