Skip to content

Commit

Permalink
ci: script to run using pm2
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-lg committed Nov 8, 2023
1 parent 64226eb commit c261317
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,17 @@ npm run start
1. [Install Docker](https://docs.docker.com/get-docker/) on your machine.
2. Build the container: `docker build -t er-docker .`.
3. Run the container: `docker run -p 3000:3000 er-docker`.

### With pm2
#### Install pm2
```bash
npm install pm2 -g
```
#### Build the Next.js app
```bash
npm run build:next
```
#### Start the node.js server with pm2
```
pm2 start pm2.config.js
```
3 changes: 2 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ const withNextra = require("nextra")({
});

module.exports = withNextra({
output: "standalone",
// if using Docker, need to use standalone
// output: "standalone",
});
14 changes: 14 additions & 0 deletions pm2.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
apps: [

Check failure on line 2 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Delete `··`
{

Check failure on line 3 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Delete `····`
name: 'erdoc playground',

Check failure on line 4 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Replace `············name:·'erdoc·playground'` with `······name:·"erdoc·playground"`
script: 'npm',

Check failure on line 5 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Replace `············script:·'npm'` with `······script:·"npm"`
args: 'start',

Check failure on line 6 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Replace `············args:·'start'` with `······args:·"start"`
instances: 2,

Check failure on line 7 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Delete `······`
exec_mode: 'cluster',

Check failure on line 8 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Replace `······exec_mode:·'cluster'` with `exec_mode:·"cluster"`
env: {

Check failure on line 9 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Replace `············` with `······`
PORT: 3000

Check failure on line 10 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Replace `················PORT:·3000` with `········PORT:·3000,`
}

Check failure on line 11 in pm2.config.js

View workflow job for this annotation

GitHub Actions / build and run tests

Replace `············}` with `······},`
}
]
}

0 comments on commit c261317

Please sign in to comment.