Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork195
Universal automation and deployment tool ⛵️
License
shipitjs/shipit
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Universal automation and deployment tool ⛵️
npm install --save-dev shipit-clinpm install --save-dev shipit-deploy
Shipit is an automation engine and a deployment tool.
Shipit provides a good alternative to Capistrano or other build tools. It is easy to deploy or to automate simple tasks on your remote servers.
Features:
- Write your task using JavaScript
- Task flow based onorchestrator
- Login and interactive SSH commands
- Easily extendable
- Create a
shipitfile.js
at the root of your project
// shipitfile.jsmodule.exports=shipit=>{// Load shipit-deploy tasksrequire('shipit-deploy')(shipit)shipit.initConfig({default:{deployTo:'/var/apps/super-project',repositoryUrl:'https://github.com/user/super-project.git',},staging:{servers:'deploy@staging.super-project.com',},})}
Run deploy command usingnpx:
npx shipit staging deploy
You can rollback using
npx shipit staging rollback
Add a custom task in yourshipitfile.js
and runcopyToRemote
.
// shipitfile.jsmodule.exports=shipit=>{/* ... */shipit.task('copyConfig',async()=>{awaitshipit.copyToRemote('config.json','/var/apps/super-project/config.json',)})}
You can add custom event and listen to events.
shipit.task('build',function(){// ...shipit.emit('built')})shipit.on('built',function(){shipit.start('start-server')})
Shipit emits theinit
event once initialized, before any tasks are run.
Instead of using ashipitfile.js
, useshipitfile.babel.js
:
// shipitfile.babel.jsexportdefaultshipit=>{shipit.initConfig({/* ... */})}
You can overwrite all default variables defined as part of thedefault
object:
module.exports=shipit=>{shipit.initConfig({default:{branch:'dev',},staging:{servers:'staging.myproject.com',workspace:'/home/vagrant/website'},production:{servers:[{host:'app1.myproject.com',user:'john',},{host:'app2.myproject.com',user:'rob',}],branch:'production',workspace:'/var/www/website'}}); ...shipit.task('pwd',function(){returnshipit.remote('pwd');}); ...};
If you can't callshipit.initConfig(...)
right away becauseyou need to get data asynchronously to do so, you can returna promise from the module:
module.exports=asyncshipit=>{constservers=awaitgetServers()shipit.initConfig({production:{servers:servers,// ...},})}
Usage: shipit <environment> <tasks...>Options: -V, --version output the version number --shipitfile <file> Specify a custom shipitfile to use --require <files...> Script required before launching Shipit --tasks List available tasks --environments List available environments -h, --help output usage information
Type:Array<String>
List of files excluded incopyFromRemote
orcopyToRemote
methods.
Type:String
Path to SSH key.
Type:String
orArray<String>
The server can use the shorthand syntax or an object:
user@host
: user and hostuser@host:4000
: user, host and port{ user, host, port, extraSshOptions }
: an object
Type:String
Allows you to ‘become’ another user, different from the user that logged into the machine (remote user).
Type:Boolean
, default tofalse
Delete release when a rollback is done.
Type:String
Directory where the code will be deployed on remote servers.
Type:Number
Number of releases kept on remote servers.
Type:String
Repository URL to clone, must be defined usinghttps
orgit+ssh
format.
Type:Boolean
, defaulttrue
Clone only the last commit of the repository.
Type:String
IfshallowClone
is set tofalse
, this directory will be used to clone the repository before deploying it.
Type:Number
, default0
SSH verbosity level to use when connecting to remote servers.0 (none),1 (-v),2 (-vv),3 (-vvv).
Create a new Shipit task. If a promise is returned task will wait for completion.
shipit.task('hello',async()=>{awaitshipit.remote('echo "hello on remote"')awaitshipit.local('echo "hello from local"')})
Create a new Shipit task that will block other tasks during its execution. If a promise is returned other task will wait before start.
shipit.blTask('hello',async()=>{awaitshipit.remote('echo "hello on remote"')awaitshipit.local('echo "hello from local"')})
Run Shipit tasks.
shipit.start('task')shipit.start('task1','task2')shipit.start(['task1','task2'])
Run a command locally and streams the result. Seessh-pool#exec.
shipit.local('ls -lah',{cwd:'/tmp/deploy/workspace',}).then(({ stdout})=>console.log(stdout)).catch(({ stderr})=>console.error(stderr))
Run a command remotely and streams the result. Seessh-pool#connection.run.
shipit.remote('ls -lah').then(([server1Result,server2Result])=>{console.log(server1Result.stdout)console.log(server2Result.stdout)}).catch(error=>{console.error(error.stderr)})
Make a remote copy from a local path to a remote path. Seessh-pool#connection.copyToRemote.
shipit.copyToRemote('/tmp/workspace','/opt/web/myapp')
Make a remote copy from a remote path to a local path. Seessh-pool#connection.copyFromRemote.
shipit.copyFromRemote('/opt/web/myapp','/tmp/workspace')
Log using Shipit, same API asconsole.log
.
shipit.log('hello %s','world')
- shipit-shared
- shipit-db
- shipit-assets
- shipit-ssh
- shipit-utils
- shipit-npm
- shipit-aws
- shipit-captain
- shipit-bower
- shipit-composer
- shipit-bastion
- shipit-yaml
- shipit-conditional
MIT
About
Universal automation and deployment tool ⛵️
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.