-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathecosystem.config.js
46 lines (39 loc) · 1.37 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
/* eslint-disable @typescript-eslint/no-var-requires */
const dotenv = require('dotenv');
const path = require('path');
const os = require('os');
dotenv.config({ path: path.join(__dirname, '.env') });
let keyFile = process.env.DEPLOY_PRODUCTION_KEY_PATH || undefined;
if (keyFile) keyFile = keyFile.replace(/^~/g, os.homedir());
let keyOption = '';
if (keyOption) keyOption += '-i "' + keyFile + '"';
module.exports = {
apps: [
{
name: 'meiliNG',
cwd: '.',
script: './dist/index.js',
env: {
// You should configure it here.
NODE_ENV: 'production',
...process.env,
},
},
],
deploy: {
production: {
user: process.env.DEPLOY_PRODUCTION_USER,
host: process.env.DEPLOY_PRODUCTION_HOST,
ref: process.env.DEPLOY_PRODUCTION_REF || 'origin/main',
repo: 'https://github.com/meili-ng/meiliNG',
path: process.env.DEPLOY_PRODUCTION_PATH,
'pre-deploy-local': `node deploy-env.production.js`,
'post-deploy': `yarn && yarn build && yarn generate && yarn prisma migrate deploy && pm2 startOrRestart ecosystem.config.js`,
key: keyFile,
ssh_options: [
process.env.DEPLOY_PRODUCTION_BYPASS_KEY_CHECK ? 'StrictHostKeyChecking=no' : undefined,
process.env.DEPLOY_PRODUCTION_SUPPRESS_SSH_LOG ? 'LogLevel=QUIET' : undefined,
].filter((n) => n !== undefined),
},
},
};