forked from vodkabears/another-one-fucking-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shipitfile.js
65 lines (58 loc) · 1.39 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'use strict';
let path = require('path');
module.exports = shipit => {
require('shipit-deploy')(shipit);
shipit.initConfig({
default: {
workspace: '/tmp/aofb',
deployTo: '/srv/aofb',
repositoryUrl: 'https://github.com/VodkaBears/another-one-fucking-boilerplate.git',
ignores: [
'.*',
'db',
'lib',
'test',
'client',
'server',
'config',
'LICENSE',
'README.md',
'*.config.js',
'shipitfile.js'
],
rsync: ['--del'],
keepReleases: 3,
deleteOnRollback: false,
shallowClone: true
},
production: {
servers: 'USER@YOUR_HOST_NAME'
}
});
shipit.blTask('deploy:build', () => {
return shipit.local(`cd ${shipit.config.workspace} && npm run prod:build`);
});
shipit.blTask('deploy:startup', () => {
return shipit.remote(
`cd ${shipit.currentPath} && npm run set-db;` +
`pm2 start ${path.join(shipit.currentPath, 'build', 'server.js')} -i 0 -l /var/log/node/ || pm2 reload all; pm2 save`
);
});
shipit.task('deploy', [
'deploy:init',
'deploy:fetch',
'deploy:build',
'deploy:update',
'deploy:publish',
'deploy:startup',
'deploy:clean',
'deploy:finish'
]);
shipit.task('rollback', [
'rollback:init',
'deploy:publish',
'deploy:startup',
'deploy:clean',
'rollback:finish'
]);
};