-
Notifications
You must be signed in to change notification settings - Fork 1
/
ecosystem.config.js
61 lines (58 loc) · 1.41 KB
/
ecosystem.config.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
const fs = require('fs');
let secrets = {
user: '',
host: '',
path: '',
}
if (fs.existsSync("secrets.json")) {
secrets = JSON.parse(fs.readFileSync("secrets.json", "utf-8"));
}
module.exports = {
apps: [
{
name: 'API',
script: 'dist/index.js',
cwd: 'backend',
instances: 1,
exec_mode: 'fork',
autorestart: true,
watch: false,
max_memory_restart: '200M',
env: {
PORT: 6060
}
},
{
name: 'Disposer',
script: 'dist/disposer.js',
cwd: 'backend',
instances: 1,
exec_mode: 'fork',
autorestart: true,
watch: false,
max_memory_restart: '200M',
},
],
deploy : {
production : {
user: secrets.user,
host: secrets.host,
ref: 'origin/master',
repo: 'git@github.com:RobinTail/incaseofmydeath.git',
path: secrets.path,
'pre-deploy-local': [
'yarn --cwd ./backend install',
'yarn --cwd ./backend build',
`rsync -a -v --delete secrets.json ${secrets.user}@${secrets.host}:${secrets.path}/source/`,
`rsync -a -v --delete backend/*.txt backend/*.pem backend/dist ${secrets.user}@${secrets.host}:${secrets.path}/source/backend/`,
].join(' && '),
'post-deploy' : [
'source ~/.zshrc',
'cd backend',
'yarn install',
'cd ..',
'pm2 reload ecosystem.config.js'
].join(' && ')
}
}
};