forked from hqwuzhaoyi/gpt-subtitle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecosystem.config.js
86 lines (83 loc) · 1.67 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require("dotenv").config();
const {
OPENAI_API_KEY,
GOOGLE_TRANSLATE_API_KEY,
BASE_URL,
WEB_PORT,
SERVER_PORT,
NEXT_PUBLIC_SERVER_PORT,
LANGUAGE,
OUTPUT_SRT_THEN_TRANSLATE,
REDIS_PORT,
REDIS_HOST,
MYSQL_HOST,
MYSQL_PORT,
MYSQL_USER,
MYSQL_PASSWORD,
MYSQL_DATABASE,
} = process.env;
const serverEnv = {
OPENAI_API_KEY,
GOOGLE_TRANSLATE_API_KEY,
BASE_URL,
WEB_PORT,
SERVER_PORT,
NEXT_PUBLIC_SERVER_PORT,
LANGUAGE,
OUTPUT_SRT_THEN_TRANSLATE,
REDIS_PORT,
REDIS_HOST,
MYSQL_HOST,
MYSQL_PORT,
MYSQL_USER,
MYSQL_PASSWORD,
MYSQL_DATABASE,
};
// ecosystem.config.js
module.exports = {
apps: [
{
name: "GptSubtitleWeb",
exec_mode: "cluster",
instances: "max", // Or a number of instances
script: "apps/web/node_modules/next/dist/bin/next",
args: "start",
env_local: {
APP_ENV: "local", // APP_ENV=local
PORT: WEB_PORT,
...serverEnv,
},
env_development: {
APP_ENV: "dev", // APP_ENV=dev
PORT: WEB_PORT,
...serverEnv,
},
env_production: {
APP_ENV: "prod", // APP_ENV=prod
PORT: WEB_PORT,
...serverEnv,
},
cwd: "apps/web", // 设置当前工作目录
},
{
name: "GptSubtitleServer",
instances: 1,
script: "apps/server/dist/main.js",
autorestart: true,
watch: false,
max_memory_restart: "1G",
env_local: {
NODE_ENV: "development",
...serverEnv,
},
env_development: {
NODE_ENV: "development",
...serverEnv,
},
env_production: {
NODE_ENV: "production",
...serverEnv,
},
},
],
};