Implement auto-generation of ecosystem.config.js and improve container setup
Some checks failed
Cloud Node Container / Build-and-Push (18) (push) Failing after 38s
Cloud Node Container / Build-and-Push (20) (push) Failing after 33s
Cloud Node Container / Build-and-Push (22) (push) Failing after 33s

- Add automatic ecosystem.config.js generation from package.json
- Create app directory automatically if missing
- Copy simple-website example when app directory is empty
- Remove redundant default app files from configs/
- Add HAProxy support with proper real IP forwarding
- Configure nginx to trust proxy headers from private networks
- Simplify entrypoint logic - always use /home/$user/app

This makes the container more user-friendly by eliminating the need for
manual PM2 configuration and ensuring the server always has a working app.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-24 09:01:08 -07:00
parent f8edb2b407
commit 9f0aa4b8b1
10 changed files with 123 additions and 196 deletions

View File

@@ -81,7 +81,7 @@ Your Node.js application needs just two files to get started:
**Optional Files:**
- `public/` folder for static files (HTML, CSS, images)
- `ecosystem.config.js` for advanced PM2 configuration
- `ecosystem.config.js` for advanced PM2 configuration (auto-generated if not provided)
### Step 2: What Users Need to Do
@@ -134,10 +134,18 @@ app.listen(port, () => {
**That's it!** The container will:
- Install your dependencies automatically
- Generate PM2 configuration from your package.json
- Start your application with PM2
- Handle SSL and reverse proxy
- Provide health monitoring
#### Important package.json fields:
- **name**: Used as the PM2 process name (defaults to 'node-app')
- **main**: Entry point file (defaults to 'index.js')
- **scripts.start**: Alternative way to specify entry point (e.g., "node server.js")
The container automatically generates an ecosystem.config.js file from your package.json if you don't provide one.
### Step 3: Example Applications
See the `examples/` directory for complete working examples: