forked from danneu/guild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshipitfile.js
37 lines (31 loc) · 845 Bytes
/
shipitfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module.exports = function (shipit) {
require('shipit-deploy')(shipit)
const deployTo = '~/guild'
shipit.initConfig({
default: {
workspace: '/tmp/guild',
deployTo,
keepReleases: 2,
ignores: ['.git', 'node_modules'],
//rsync: ['--del'],
deleteOnRollback: false,
shallowClone: true,
repositoryUrl: process.cwd() + '/.git',
branch: 'production'
},
production: {
}
})
shipit.blTask('install', () => {
return shipit.remote(`cd ${deployTo}/current && nvm use && npm install`)
})
shipit.blTask('start', () => {
return shipit.remote(`cd ${deployTo} && pm2 startOrRestart current/ecosystem.json`)
})
shipit.blTask('stop', () => {
return shipit.remote('pm2 stop all')
})
shipit.on('deployed', () => {
shipit.start('install', 'start')
})
}