-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathecosystem.config.js
64 lines (62 loc) · 2.12 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
62
63
64
const dotenv = require("dotenv");
const result = dotenv.config();
if (result.error) {
throw result.error;
}
// console.log("[PM2] Parsing dotenv config : ", result.parsed);
module.exports = {
apps: [
{
script: "./src/index.js",
interpreter: "./node_modules/@babel/node/bin/babel-node.js",
output: "./log/lorawan-transport.out.log",
error: "./log/lorawan-transport.error.log",
max_memory_restart: "1G",
restart_delay: 500,
wait_ready: true,
listen_timeout: 3000,
env: {
NODE_ENV: "development",
name: `${result.parsed.NODE_NAME}`,
},
env_staging: {
NODE_ENV: "staging",
name: `${result.parsed.NODE_NAME}`,
},
env_production: {
NODE_ENV: "production",
name: `${result.parsed.NODE_NAME}`,
},
},
],
deploy: {
staging: {
key: "~/.ssh/id_rsa",
user: `${result.parsed.VPS_STAGE_USER}`,
host: [result.parsed.VPS_STAGE_HOST],
ssh_options: ["Port=22", "StrictHostKeyChecking=yes"],
ref: `origin/staging`,
repo: result.parsed.GIT_REPO_SSH_URL,
path: `/home/${result.parsed.VPS_STAGE_USER}/${result.parsed.NODE_NAME}`,
"pre-setup": "",
"pre-deploy-local": `scp -P 22 deploy/.env_staging ${result.parsed.VPS_STAGE_USER}@${
result.parsed.VPS_STAGE_HOST
}:/home/${result.parsed.VPS_STAGE_USER}/${result.parsed.NODE_NAME}/source/.env`,
"post-deploy": "npm install && npm run deploy:stage",
},
production: {
key: "~/.ssh/server5",
user: `${result.parsed.VPS_PROD_USER}`,
host: [result.parsed.VPS_PROD_HOST],
ssh_options: ["Port=22", "StrictHostKeyChecking=yes"],
ref: `origin/master`,
repo: result.parsed.GIT_REPO_SSH_URL,
path: `/home/${result.parsed.VPS_PROD_USER}/${result.parsed.NODE_NAME}`,
"pre-setup": "",
"pre-deploy-local": `scp -P 22 deploy/.env_production ${result.parsed.VPS_PROD_USER}@${
result.parsed.VPS_PROD_HOST
}:/home/${result.parsed.VPS_PROD_USER}/${result.parsed.NODE_NAME}/source/.env`,
"post-deploy": "npm install && npm run deploy:prod",
},
},
};