Document PM2 configuration and remove unnecessary ready signal
- Added PM2 configuration notes to README - Documented that wait_ready is false by default (no signals needed) - Provided advanced usage instructions for users who need wait_ready - Removed unnecessary process.send('ready') from simple-website example This ensures users understand the default PM2 behavior and know how to customize it if needed. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
17
README.md
17
README.md
@@ -146,6 +146,23 @@ app.listen(port, () => {
|
|||||||
|
|
||||||
The container automatically generates an ecosystem.config.js file from your package.json if you don't provide one.
|
The container automatically generates an ecosystem.config.js file from your package.json if you don't provide one.
|
||||||
|
|
||||||
|
#### PM2 Configuration Notes:
|
||||||
|
- The auto-generated PM2 config uses **fork mode** (not cluster mode) for simplicity and compatibility
|
||||||
|
- `wait_ready` is set to `false` by default - your app doesn't need to send any special signals to PM2
|
||||||
|
- If you need advanced PM2 features, you can provide your own `ecosystem.config.js` file
|
||||||
|
|
||||||
|
**Advanced Usage**: If you want to use PM2's `wait_ready` feature for health checking:
|
||||||
|
1. Create your own `ecosystem.config.js` with `wait_ready: true`
|
||||||
|
2. Add `process.send('ready')` in your app when it's ready to accept connections:
|
||||||
|
```javascript
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`Server running on port ${port}`);
|
||||||
|
if (process.send) {
|
||||||
|
process.send('ready');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
### Step 3: Example Applications
|
### Step 3: Example Applications
|
||||||
|
|
||||||
See the `examples/` directory for complete working examples:
|
See the `examples/` directory for complete working examples:
|
||||||
|
@@ -26,8 +26,4 @@ app.get('/ping', (req, res) => {
|
|||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Simple website running on port ${port}`);
|
console.log(`Simple website running on port ${port}`);
|
||||||
// Send ready signal to PM2
|
|
||||||
if (process.send) {
|
|
||||||
process.send('ready');
|
|
||||||
}
|
|
||||||
});
|
});
|
Reference in New Issue
Block a user