-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ecosystem.config.cjs
60 lines (57 loc) · 1.52 KB
/
ecosystem.config.cjs
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
// eslint-disable-next-line @typescript-eslint/no-require-imports -- CJS
const fs = require("node: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: {
NODE_ENV: "production",
},
},
{
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: "[email protected]:RobinTail/incaseofmydeath.git",
path: secrets.path,
"pre-deploy-local": [
"yarn workspace backend install",
"yarn workspace 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",
"yarn workspace backend install --production --frozen-lockfile --verbose",
"pm2 reload ecosystem.config.cjs",
].join(" && "),
},
},
};