bs9 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -4
- package/bin/bs9 +1 -1
- package/dist/bs9-82zw8srm. +181 -0
- package/dist/bs9.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -484,16 +484,25 @@ BS9/
|
|
|
484
484
|
- **Disk**: 1GB for metrics storage
|
|
485
485
|
|
|
486
486
|
### Installation
|
|
487
|
+
#### One-Click Install (Recommended)
|
|
487
488
|
```bash
|
|
488
|
-
# One-click install
|
|
489
489
|
curl -fsSL https://raw.githubusercontent.com/xarhang/bs9/main/setup.sh | bash
|
|
490
|
+
```
|
|
490
491
|
|
|
491
|
-
|
|
492
|
+
#### Manual Install
|
|
493
|
+
```bash
|
|
494
|
+
# Clone the repository
|
|
492
495
|
git clone https://github.com/xarhang/bs9.git
|
|
493
496
|
cd bs9
|
|
497
|
+
|
|
498
|
+
# Install dependencies
|
|
494
499
|
bun install
|
|
495
|
-
|
|
496
|
-
|
|
500
|
+
|
|
501
|
+
# Install globally
|
|
502
|
+
npm install -g .
|
|
503
|
+
|
|
504
|
+
# Or install from npm directly
|
|
505
|
+
npm install -g bs9
|
|
497
506
|
```
|
|
498
507
|
|
|
499
508
|
### Production Setup
|
package/bin/bs9
CHANGED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { startCommand } from "../src/commands/start.js";
|
|
5
|
+
import { stopCommand } from "../src/commands/stop.js";
|
|
6
|
+
import { restartCommand } from "../src/commands/restart.js";
|
|
7
|
+
import { statusCommand } from "../src/commands/status.js";
|
|
8
|
+
import { logsCommand } from "../src/commands/logs.js";
|
|
9
|
+
import { monitCommand } from "../src/commands/monit.js";
|
|
10
|
+
import { webCommand } from "../src/commands/web.js";
|
|
11
|
+
import { alertCommand } from "../src/commands/alert.js";
|
|
12
|
+
import { exportCommand } from "../src/commands/export.js";
|
|
13
|
+
import { depsCommand } from "../src/commands/deps.js";
|
|
14
|
+
import { profileCommand } from "../src/commands/profile.js";
|
|
15
|
+
import { loadbalancerCommand } from "../src/loadbalancer/manager.js";
|
|
16
|
+
import { windowsCommand } from "../src/windows/service.js";
|
|
17
|
+
import { launchdCommand } from "../src/macos/launchd.js";
|
|
18
|
+
import { updateCommand } from "../src/commands/update.js";
|
|
19
|
+
import { dbpoolCommand } from "../src/database/pool.js";
|
|
20
|
+
import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
|
|
21
|
+
import { consulCommand } from "../src/discovery/consul.js";
|
|
22
|
+
|
|
23
|
+
const program = new Command();
|
|
24
|
+
|
|
25
|
+
program
|
|
26
|
+
.name("bs9")
|
|
27
|
+
.description("BS9 (Bun Sentinel 9) — Mission-critical process manager CLI")
|
|
28
|
+
.version("1.3.1");
|
|
29
|
+
|
|
30
|
+
program
|
|
31
|
+
.command("start")
|
|
32
|
+
.description("Start a process with hardened systemd unit")
|
|
33
|
+
.argument("<file>", "Application file to start")
|
|
34
|
+
.option("-n, --name <name>", "Service name")
|
|
35
|
+
.option("-p, --port <port>", "Port number", "3000")
|
|
36
|
+
.option("-h, --host <host>", "Host address", "localhost")
|
|
37
|
+
.option("--https", "Use HTTPS protocol")
|
|
38
|
+
.option("-e, --env <env>", "Environment variables (can be used multiple times)", (value, previous) => [...(previous || []), value])
|
|
39
|
+
.option("--otel", "Enable OpenTelemetry instrumentation", true)
|
|
40
|
+
.option("--prometheus", "Enable Prometheus metrics", true)
|
|
41
|
+
.option("--build", "Build TypeScript to JavaScript before starting")
|
|
42
|
+
.action(startCommand);
|
|
43
|
+
|
|
44
|
+
program
|
|
45
|
+
.command("stop")
|
|
46
|
+
.description("Stop a managed service")
|
|
47
|
+
.argument("<name>", "Service name")
|
|
48
|
+
.action(stopCommand);
|
|
49
|
+
|
|
50
|
+
program
|
|
51
|
+
.command("restart")
|
|
52
|
+
.description("Restart a managed service")
|
|
53
|
+
.argument("<name>", "Service name")
|
|
54
|
+
.action(restartCommand);
|
|
55
|
+
|
|
56
|
+
program
|
|
57
|
+
.command("status")
|
|
58
|
+
.description("Show status and SRE metrics for all services")
|
|
59
|
+
.option("-w, --watch", "Watch mode (refresh every 2s)")
|
|
60
|
+
.action(statusCommand);
|
|
61
|
+
|
|
62
|
+
program
|
|
63
|
+
.command("logs")
|
|
64
|
+
.description("Show logs for a service (via journalctl)")
|
|
65
|
+
.argument("<name>", "Service name")
|
|
66
|
+
.option("-f, --follow", "Follow logs")
|
|
67
|
+
.option("-n, --lines <number>", "Number of lines", "50")
|
|
68
|
+
.action(logsCommand);
|
|
69
|
+
|
|
70
|
+
program
|
|
71
|
+
.command("monit")
|
|
72
|
+
.description("Real-time terminal dashboard for all services")
|
|
73
|
+
.option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
|
|
74
|
+
.action(monitCommand);
|
|
75
|
+
|
|
76
|
+
program
|
|
77
|
+
.command("web")
|
|
78
|
+
.description("Start web-based monitoring dashboard")
|
|
79
|
+
.option("-p, --port <port>", "Port for web dashboard", "8080")
|
|
80
|
+
.option("-d, --detach", "Run in background")
|
|
81
|
+
.action(webCommand);
|
|
82
|
+
|
|
83
|
+
program
|
|
84
|
+
.command("alert")
|
|
85
|
+
.description("Configure alert thresholds and webhooks")
|
|
86
|
+
.option("--enable", "Enable alerts")
|
|
87
|
+
.option("--disable", "Disable alerts")
|
|
88
|
+
.option("--webhook <url>", "Set webhook URL for alerts")
|
|
89
|
+
.option("--cpu <percentage>", "CPU threshold percentage")
|
|
90
|
+
.option("--memory <percentage>", "Memory threshold percentage")
|
|
91
|
+
.option("--errorRate <percentage>", "Error rate threshold percentage")
|
|
92
|
+
.option("--uptime <percentage>", "Uptime threshold percentage")
|
|
93
|
+
.option("--cooldown <seconds>", "Alert cooldown period in seconds")
|
|
94
|
+
.option("--service <name>", "Configure alerts for specific service")
|
|
95
|
+
.option("--list", "List current alert configuration")
|
|
96
|
+
.option("--test", "Test webhook connectivity")
|
|
97
|
+
.action(alertCommand);
|
|
98
|
+
|
|
99
|
+
program
|
|
100
|
+
.command("export")
|
|
101
|
+
.description("Export historical metrics data")
|
|
102
|
+
.option("-f, --format <format>", "Export format (json|csv)", "json")
|
|
103
|
+
.option("-h, --hours <hours>", "Hours of data to export", "24")
|
|
104
|
+
.option("-o, --output <file>", "Output file path")
|
|
105
|
+
.option("-s, --service <name>", "Export specific service metrics")
|
|
106
|
+
.action(exportCommand);
|
|
107
|
+
|
|
108
|
+
program
|
|
109
|
+
.command("deps")
|
|
110
|
+
.description("Visualize service dependencies")
|
|
111
|
+
.option("-f, --format <format>", "Output format (text|dot|json)", "text")
|
|
112
|
+
.option("-o, --output <file>", "Output file path")
|
|
113
|
+
.action(depsCommand);
|
|
114
|
+
|
|
115
|
+
program
|
|
116
|
+
.command("profile")
|
|
117
|
+
.description("Performance profiling for services")
|
|
118
|
+
.option("-d, --duration <seconds>", "Profiling duration", "60")
|
|
119
|
+
.option("-i, --interval <ms>", "Sampling interval", "1000")
|
|
120
|
+
.option("-s, --service <name>", "Service name to profile")
|
|
121
|
+
.option("-o, --output <file>", "Output file path")
|
|
122
|
+
.action(profileCommand);
|
|
123
|
+
|
|
124
|
+
program
|
|
125
|
+
.command("loadbalancer")
|
|
126
|
+
.description("Load balancer management")
|
|
127
|
+
.argument("<action>", "Action to perform")
|
|
128
|
+
.option("-p, --port <port>", "Load balancer port", "8080")
|
|
129
|
+
.option("-a, --algorithm <type>", "Load balancing algorithm", "round-robin")
|
|
130
|
+
.option("-b, --backends <list>", "Backend servers (host:port,host:port)")
|
|
131
|
+
.option("--health-check", "Enable health checking", true)
|
|
132
|
+
.option("--health-path <path>", "Health check path", "/healthz")
|
|
133
|
+
.option("--health-interval <ms>", "Health check interval", "10000")
|
|
134
|
+
.action(loadbalancerCommand);
|
|
135
|
+
|
|
136
|
+
program
|
|
137
|
+
.command("dbpool")
|
|
138
|
+
.description("Database connection pool management")
|
|
139
|
+
.argument("<action>", "Action to perform")
|
|
140
|
+
.option("--host <host>", "Database host", "localhost")
|
|
141
|
+
.option("--port <port>", "Database port", "5432")
|
|
142
|
+
.option("--database <name>", "Database name", "testdb")
|
|
143
|
+
.option("--username <user>", "Database username", "user")
|
|
144
|
+
.option("--password <pass>", "Database password", "password")
|
|
145
|
+
.option("--max-connections <num>", "Maximum connections", "10")
|
|
146
|
+
.option("--min-connections <num>", "Minimum connections", "2")
|
|
147
|
+
.option("--concurrency <num>", "Test concurrency", "10")
|
|
148
|
+
.option("--iterations <num>", "Test iterations", "100")
|
|
149
|
+
.action(dbpoolCommand);
|
|
150
|
+
|
|
151
|
+
program
|
|
152
|
+
.command("update")
|
|
153
|
+
.description("Update BS9 to latest version")
|
|
154
|
+
.option("--check", "Check for updates without installing")
|
|
155
|
+
.option("--force", "Force update even if already latest")
|
|
156
|
+
.option("--rollback", "Rollback to previous version")
|
|
157
|
+
.option("--version <version>", "Update to specific version")
|
|
158
|
+
.action(updateCommand);
|
|
159
|
+
|
|
160
|
+
program
|
|
161
|
+
.command("advanced")
|
|
162
|
+
.description("Advanced monitoring dashboard")
|
|
163
|
+
.option("--port <port>", "Dashboard port", "8090")
|
|
164
|
+
.action(advancedMonitoringCommand);
|
|
165
|
+
|
|
166
|
+
program
|
|
167
|
+
.command("consul")
|
|
168
|
+
.description("Consul service discovery")
|
|
169
|
+
.argument("<action>", "Action to perform")
|
|
170
|
+
.option("--consul-url <url>", "Consul URL", "http://localhost:8500")
|
|
171
|
+
.option("--name <name>", "Service name")
|
|
172
|
+
.option("--id <id>", "Service ID")
|
|
173
|
+
.option("--address <address>", "Service address")
|
|
174
|
+
.option("--port <port>", "Service port")
|
|
175
|
+
.option("--tags <tags>", "Service tags (comma-separated)")
|
|
176
|
+
.option("--health-check <url>", "Health check URL")
|
|
177
|
+
.option("--meta <json>", "Service metadata (JSON)")
|
|
178
|
+
.option("--service <service>", "Service name for discovery")
|
|
179
|
+
.action(consulCommand);
|
|
180
|
+
|
|
181
|
+
program.parse();
|
package/dist/bs9.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var e="./bs9-
|
|
2
|
+
var e="./bs9-82zw8srm.";export{e as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bs9",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Bun Sentinel 9 - High-performance, non-root process manager for Bun",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"author": "xarhang",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@opentelemetry/api": "^1.
|
|
32
|
+
"@opentelemetry/api": "^1.8.0",
|
|
33
33
|
"@opentelemetry/auto-instrumentations-node": "^0.50.0",
|
|
34
34
|
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
|
|
35
35
|
"@opentelemetry/resources": "^1.23.0",
|