-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathshipitfile.js
47 lines (43 loc) · 1.03 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
const config = {
default: {
workspace: './tmp',
deployTo: '/websites/poker-server',
repositoryUrl: '[email protected]:IFS49F/poker-server.git',
keepReleases: 2,
deleteOnRollback: false,
shallowClone: true,
rsync: ['--delete'],
branch: 'master',
ignores: [
'.gitkeep',
'.git',
'.gitignore',
'README.md',
'shipitfile.js',
'node_modules',
'tmp'
]
},
production: {
servers: [{
user: 'deploy',
host: 'poker4.fun',
port: process.env.SSH_PORT || 22
}]
}
};
module.exports = shipit => {
require('shipit-deploy')(shipit);
shipit.initConfig(config);
shipit.on('deployed', () => {
shipit.remoteCopy('./pm2.json', `${shipit.config.deployTo}/current`).then(() => shipit.start('restart'));
});
shipit.task('restart', () => {
const pm2Json = 'pm2.json';
shipit.remote(`
cd ${shipit.config.deployTo}/current;
yarn install --production;
pm2 startOrGracefulReload ${pm2Json} --env ${shipit.environment}`
);
});
};