Skip to content

Commit

Permalink
chore(pm2): add ecosystem config in bundle mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed May 27, 2023
1 parent 543c799 commit ef87a5a
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
run: |
npm run build
npm run bundle
cp ecosystem.bundle.config.js out/ecosystem.bundle.config.js
zip -r mog-core-bundle-${{ runner.os }}.zip out/
- name: Upload
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
run: |
npm run build
npm run bundle
cp ecosystem.bundle.config.js out/ecosystem.bundle.config.js
zip -r mog-core-bundle-${{ runner.os }}.zip out/
- name: Upload
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
- name: Build project
run: |
pnpm run bundle
cp ecosystem.bundle.config.js out/ecosystem.bundle.config.js
zip -r release.zip out/
- name: Test Bundle Server
Expand Down
58 changes: 58 additions & 0 deletions ecosystem.bundle.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const { execSync } = require('child_process')
const nodePath = execSync(`npm root --quiet -g`, { encoding: 'utf-8' }).split(
'\n',
)[0]
const args = {
autorestart: true,
watch: false,
max_memory_restart: '230M',
env: {
NODE_ENV: 'production',
NODE_PATH: nodePath,
},
}

module.exports = {
apps: [
{
name: 'Mog Gateway',
script: './core/index.js',
...args,
},
{
name: 'Mog Friends',
script: './friends-service/index.js',
...args,
},
{
name: 'Mog User',
script: './user-service/index.js',
...args,
},
{
name: 'Mog Pages',
script: './page-service/index.js',
...args,
},
{
name: 'Mog Notifications',
script: './notification-service/index.js',
...args,
},
{
name: 'Mog Comments',
script: './comments-service/index.js',
...args,
},
{
name: 'Mog Themes',
script: './themes-service/index.js',
...args,
},
{
name: 'Mog Store',
script: './store-service/index.js',
...args,
}
],
}

0 comments on commit ef87a5a

Please sign in to comment.