BREAKING CHANGE(daemon): Refactor daemon and service management: remove IPC auto-spawn, add TspmServiceManager, tighten IPC/client/CLI behavior and tests
This commit is contained in:
28
readme.md
28
readme.md
@@ -64,9 +64,11 @@ tspm restart my-server
|
||||
### Process Management
|
||||
|
||||
#### `tspm start <script> [options]`
|
||||
|
||||
Start a new process with automatic monitoring and management.
|
||||
|
||||
**Options:**
|
||||
|
||||
- `--name <name>` - Custom name for the process (default: script name)
|
||||
- `--memory <size>` - Memory limit (e.g., "512MB", "2GB", default: 512MB)
|
||||
- `--cwd <path>` - Working directory (default: current directory)
|
||||
@@ -75,6 +77,7 @@ Start a new process with automatic monitoring and management.
|
||||
- `--autorestart` - Auto-restart on crash (default: true)
|
||||
|
||||
**Examples:**
|
||||
|
||||
```bash
|
||||
# Simple start
|
||||
tspm start server.js
|
||||
@@ -90,6 +93,7 @@ tspm start ../other-project/index.js --cwd ../other-project --name other
|
||||
```
|
||||
|
||||
#### `tspm stop <id>`
|
||||
|
||||
Gracefully stop a running process (SIGTERM → SIGKILL after timeout).
|
||||
|
||||
```bash
|
||||
@@ -97,6 +101,7 @@ tspm stop my-server
|
||||
```
|
||||
|
||||
#### `tspm restart <id>`
|
||||
|
||||
Stop and restart a process with the same configuration.
|
||||
|
||||
```bash
|
||||
@@ -104,6 +109,7 @@ tspm restart my-server
|
||||
```
|
||||
|
||||
#### `tspm delete <id>`
|
||||
|
||||
Stop and remove a process from TSPM management.
|
||||
|
||||
```bash
|
||||
@@ -113,6 +119,7 @@ tspm delete old-server
|
||||
### Monitoring & Information
|
||||
|
||||
#### `tspm list`
|
||||
|
||||
Display all managed processes in a beautiful table.
|
||||
|
||||
```bash
|
||||
@@ -128,6 +135,7 @@ tspm list
|
||||
```
|
||||
|
||||
#### `tspm describe <id>`
|
||||
|
||||
Get detailed information about a specific process.
|
||||
|
||||
```bash
|
||||
@@ -153,9 +161,11 @@ Watch Paths: src, config
|
||||
```
|
||||
|
||||
#### `tspm logs <id> [options]`
|
||||
|
||||
View process logs (stdout and stderr).
|
||||
|
||||
**Options:**
|
||||
|
||||
- `--lines <n>` - Number of lines to display (default: 50)
|
||||
|
||||
```bash
|
||||
@@ -165,6 +175,7 @@ tspm logs my-server --lines 100
|
||||
### Batch Operations
|
||||
|
||||
#### `tspm start-all`
|
||||
|
||||
Start all saved processes at once.
|
||||
|
||||
```bash
|
||||
@@ -172,6 +183,7 @@ tspm start-all
|
||||
```
|
||||
|
||||
#### `tspm stop-all`
|
||||
|
||||
Stop all running processes.
|
||||
|
||||
```bash
|
||||
@@ -179,6 +191,7 @@ tspm stop-all
|
||||
```
|
||||
|
||||
#### `tspm restart-all`
|
||||
|
||||
Restart all running processes.
|
||||
|
||||
```bash
|
||||
@@ -188,6 +201,7 @@ tspm restart-all
|
||||
### Daemon Management
|
||||
|
||||
#### `tspm daemon start`
|
||||
|
||||
Start the TSPM daemon (happens automatically on first command).
|
||||
|
||||
```bash
|
||||
@@ -195,6 +209,7 @@ tspm daemon start
|
||||
```
|
||||
|
||||
#### `tspm daemon stop`
|
||||
|
||||
Stop the TSPM daemon and all managed processes.
|
||||
|
||||
```bash
|
||||
@@ -202,6 +217,7 @@ tspm daemon stop
|
||||
```
|
||||
|
||||
#### `tspm daemon status`
|
||||
|
||||
Check daemon health and statistics.
|
||||
|
||||
```bash
|
||||
@@ -245,7 +261,7 @@ const processId = await manager.start({
|
||||
projectDir: process.cwd(),
|
||||
memoryLimitBytes: 512 * 1024 * 1024, // 512MB
|
||||
autorestart: true,
|
||||
watch: false
|
||||
watch: false,
|
||||
});
|
||||
|
||||
// Monitor process
|
||||
@@ -259,18 +275,23 @@ await manager.stop(processId);
|
||||
## 🔧 Advanced Features
|
||||
|
||||
### Memory Limit Enforcement
|
||||
|
||||
TSPM tracks memory usage including all child processes spawned by your application. When a process exceeds its memory limit, it's gracefully restarted.
|
||||
|
||||
### Process Group Tracking
|
||||
|
||||
Using `ps-tree`, TSPM monitors not just your main process but all child processes it spawns, ensuring complete cleanup on stop/restart.
|
||||
|
||||
### Intelligent Logging
|
||||
|
||||
Logs are buffered and managed efficiently, preventing memory issues from excessive output while ensuring you don't lose important information.
|
||||
|
||||
### Graceful Shutdown
|
||||
|
||||
Processes receive SIGTERM first, allowing them to clean up. After a timeout, SIGKILL ensures termination.
|
||||
|
||||
### Configuration Persistence
|
||||
|
||||
Process configurations are saved, allowing you to restart all processes after a system reboot with a single command.
|
||||
|
||||
## 🛠️ Development
|
||||
@@ -304,6 +325,7 @@ tspm list
|
||||
## 📊 Performance
|
||||
|
||||
TSPM is designed to be lightweight and efficient:
|
||||
|
||||
- Minimal CPU overhead (typically < 0.5%)
|
||||
- Small memory footprint (~30-50MB for the daemon)
|
||||
- Fast process startup and shutdown
|
||||
@@ -322,7 +344,7 @@ Unlike general-purpose process managers, TSPM is built specifically for the Type
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
@@ -337,4 +359,4 @@ Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
|
Reference in New Issue
Block a user