bs9 1.4.2 ā 1.4.6
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 +37 -24
- package/bin/bs9 +22 -0
- package/dist/bs9-nfpea7ta. +269 -0
- package/dist/bs9-xf46r11y. +269 -0
- package/dist/bs9-zmxbnn8g. +255 -0
- package/dist/bs9.js +1 -1
- package/package.json +3 -3
- package/src/commands/deploy.ts +1 -7
- package/src/commands/doctor.ts +332 -0
- package/src/commands/inspect.ts +603 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { join, dirname } from "node:path";
|
|
6
|
+
|
|
7
|
+
// Read version from package.json
|
|
8
|
+
const packageJsonPath = join(dirname(import.meta.path), '..', 'package.json');
|
|
9
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
10
|
+
const version = packageJson.version;
|
|
11
|
+
|
|
12
|
+
import { startCommand } from "../src/commands/start.js";
|
|
13
|
+
import { stopCommand } from "../src/commands/stop.js";
|
|
14
|
+
import { restartCommand } from "../src/commands/restart.js";
|
|
15
|
+
import { statusCommand } from "../src/commands/status.js";
|
|
16
|
+
import { logsCommand } from "../src/commands/logs.js";
|
|
17
|
+
import { monitCommand } from "../src/commands/monit.js";
|
|
18
|
+
import { webCommand } from "../src/commands/web.js";
|
|
19
|
+
import { alertCommand } from "../src/commands/alert.js";
|
|
20
|
+
import { exportCommand } from "../src/commands/export.js";
|
|
21
|
+
import { depsCommand } from "../src/commands/deps.js";
|
|
22
|
+
import { profileCommand } from "../src/commands/profile.js";
|
|
23
|
+
import { deleteCommand } from "../src/commands/delete.js";
|
|
24
|
+
import { saveCommand } from "../src/commands/save.js";
|
|
25
|
+
import { resurrectCommand } from "../src/commands/resurrect.js";
|
|
26
|
+
import { deployCommand } from "../src/commands/deploy.js";
|
|
27
|
+
import { loadbalancerCommand } from "../src/loadbalancer/manager.js";
|
|
28
|
+
import { windowsCommand } from "../src/windows/service.js";
|
|
29
|
+
import { launchdCommand } from "../src/macos/launchd.js";
|
|
30
|
+
import { updateCommand } from "../src/commands/update.js";
|
|
31
|
+
import { dbpoolCommand } from "../src/database/pool.js";
|
|
32
|
+
import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
|
|
33
|
+
import { consulCommand } from "../src/discovery/consul.js";
|
|
34
|
+
import { doctorCommand } from "../src/commands/doctor.js";
|
|
35
|
+
import { inspectCommand } from "../src/commands/inspect.js";
|
|
36
|
+
|
|
37
|
+
const program = new Command();
|
|
38
|
+
|
|
39
|
+
program
|
|
40
|
+
.name("bs9")
|
|
41
|
+
.description("BS9 (Bun Sentinel 9) ā Mission-critical process manager CLI")
|
|
42
|
+
.version(version);
|
|
43
|
+
|
|
44
|
+
program
|
|
45
|
+
.command("start")
|
|
46
|
+
.description("Start a process with hardened systemd unit")
|
|
47
|
+
.argument("<file>", "Application file to start")
|
|
48
|
+
.option("-n, --name <name>", "Service name")
|
|
49
|
+
.option("-p, --port <port>", "Port number", "3000")
|
|
50
|
+
.option("-h, --host <host>", "Host address", "localhost")
|
|
51
|
+
.option("--https", "Use HTTPS protocol")
|
|
52
|
+
.option("-e, --env <env>", "Environment variables (can be used multiple times)", (value, previous) => [...(previous || []), value])
|
|
53
|
+
.option("--otel", "Enable OpenTelemetry instrumentation", true)
|
|
54
|
+
.option("--prometheus", "Enable Prometheus metrics", true)
|
|
55
|
+
.option("--build", "Build TypeScript to JavaScript before starting")
|
|
56
|
+
.action(startCommand);
|
|
57
|
+
|
|
58
|
+
program
|
|
59
|
+
.command("stop")
|
|
60
|
+
.description("Stop a managed service")
|
|
61
|
+
.argument("<name>", "Service name")
|
|
62
|
+
.action(stopCommand);
|
|
63
|
+
|
|
64
|
+
program
|
|
65
|
+
.command("restart")
|
|
66
|
+
.description("Restart a managed service")
|
|
67
|
+
.argument("<name>", "Service name")
|
|
68
|
+
.action(restartCommand);
|
|
69
|
+
|
|
70
|
+
program
|
|
71
|
+
.command("status")
|
|
72
|
+
.description("Show status and SRE metrics for all services")
|
|
73
|
+
.option("-w, --watch", "Watch mode (refresh every 2s)")
|
|
74
|
+
.action(statusCommand);
|
|
75
|
+
|
|
76
|
+
program
|
|
77
|
+
.command("logs")
|
|
78
|
+
.description("Show logs for a service (via journalctl)")
|
|
79
|
+
.argument("<name>", "Service name")
|
|
80
|
+
.option("-f, --follow", "Follow logs")
|
|
81
|
+
.option("-n, --lines <number>", "Number of lines", "50")
|
|
82
|
+
.action(logsCommand);
|
|
83
|
+
|
|
84
|
+
program
|
|
85
|
+
.command("monit")
|
|
86
|
+
.description("Real-time terminal dashboard for all services")
|
|
87
|
+
.option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
|
|
88
|
+
.action(monitCommand);
|
|
89
|
+
|
|
90
|
+
program
|
|
91
|
+
.command("web")
|
|
92
|
+
.description("Start web-based monitoring dashboard")
|
|
93
|
+
.option("-p, --port <port>", "Port for web dashboard", "8080")
|
|
94
|
+
.option("-d, --detach", "Run in background")
|
|
95
|
+
.action(webCommand);
|
|
96
|
+
|
|
97
|
+
program
|
|
98
|
+
.command("alert")
|
|
99
|
+
.description("Configure alert thresholds and webhooks")
|
|
100
|
+
.option("--enable", "Enable alerts")
|
|
101
|
+
.option("--disable", "Disable alerts")
|
|
102
|
+
.option("--webhook <url>", "Set webhook URL for alerts")
|
|
103
|
+
.option("--cpu <percentage>", "CPU threshold percentage")
|
|
104
|
+
.option("--memory <percentage>", "Memory threshold percentage")
|
|
105
|
+
.option("--errorRate <percentage>", "Error rate threshold percentage")
|
|
106
|
+
.option("--uptime <percentage>", "Uptime threshold percentage")
|
|
107
|
+
.option("--cooldown <seconds>", "Alert cooldown period in seconds")
|
|
108
|
+
.option("--service <name>", "Configure alerts for specific service")
|
|
109
|
+
.option("--list", "List current alert configuration")
|
|
110
|
+
.option("--test", "Test webhook connectivity")
|
|
111
|
+
.action(alertCommand);
|
|
112
|
+
|
|
113
|
+
program
|
|
114
|
+
.command("export")
|
|
115
|
+
.description("Export historical metrics data")
|
|
116
|
+
.option("-f, --format <format>", "Export format (json|csv)", "json")
|
|
117
|
+
.option("-h, --hours <hours>", "Hours of data to export", "24")
|
|
118
|
+
.option("-o, --output <file>", "Output file path")
|
|
119
|
+
.option("-s, --service <name>", "Export specific service metrics")
|
|
120
|
+
.action(exportCommand);
|
|
121
|
+
|
|
122
|
+
program
|
|
123
|
+
.command("deps")
|
|
124
|
+
.description("Visualize service dependencies")
|
|
125
|
+
.option("-f, --format <format>", "Output format (text|dot|json)", "text")
|
|
126
|
+
.option("-o, --output <file>", "Output file path")
|
|
127
|
+
.action(depsCommand);
|
|
128
|
+
|
|
129
|
+
program
|
|
130
|
+
.command("profile")
|
|
131
|
+
.description("Performance profiling for services")
|
|
132
|
+
.option("-d, --duration <seconds>", "Profiling duration", "60")
|
|
133
|
+
.option("-i, --interval <ms>", "Sampling interval", "1000")
|
|
134
|
+
.option("-s, --service <name>", "Service name to profile")
|
|
135
|
+
.option("--flamegraph", "Generate flame graph")
|
|
136
|
+
.option("--top <number>", "Show top N functions", "10")
|
|
137
|
+
.action(profileCommand);
|
|
138
|
+
|
|
139
|
+
program
|
|
140
|
+
.command("delete")
|
|
141
|
+
.description("Delete managed services")
|
|
142
|
+
.argument("[name]", "Service name (optional)")
|
|
143
|
+
.option("-a, --all", "Delete all services")
|
|
144
|
+
.option("-f, --force", "Force deletion without errors")
|
|
145
|
+
.option("-r, --remove", "Remove service configuration files")
|
|
146
|
+
.option("-t, --timeout <seconds>", "Timeout for graceful shutdown (default: 30)")
|
|
147
|
+
.action(deleteCommand);
|
|
148
|
+
|
|
149
|
+
program
|
|
150
|
+
.command("save")
|
|
151
|
+
.description("Save service configurations to backup")
|
|
152
|
+
.argument("[name]", "Service name (optional)")
|
|
153
|
+
.option("-a, --all", "Save all services")
|
|
154
|
+
.option("-f, --force", "Force save without errors")
|
|
155
|
+
.option("-b, --backup", "Create timestamped backup")
|
|
156
|
+
.action(saveCommand);
|
|
157
|
+
|
|
158
|
+
program
|
|
159
|
+
.command("resurrect")
|
|
160
|
+
.description("Resurrect services from backup")
|
|
161
|
+
.argument("[name]", "Service name (optional)")
|
|
162
|
+
.option("-a, --all", "Resurrect all services")
|
|
163
|
+
.option("-f, --force", "Force resurrection without errors")
|
|
164
|
+
.option("-c, --config <file>", "Configuration file to use")
|
|
165
|
+
.action(resurrectCommand);
|
|
166
|
+
|
|
167
|
+
program
|
|
168
|
+
.command("deploy")
|
|
169
|
+
.description("š Deploy applications with zero-config production setup")
|
|
170
|
+
.argument("<file>", "Application file to deploy")
|
|
171
|
+
.option("-n, --name <name>", "Service name")
|
|
172
|
+
.option("-p, --port <port>", "Port number", "3000")
|
|
173
|
+
.option("-h, --host <host>", "Host address", "localhost")
|
|
174
|
+
.option("-e, --env <env>", "Environment variables (multiple)", (value, previous) => [...(previous || []), value])
|
|
175
|
+
.option("-i, --instances <number>", "Number of instances")
|
|
176
|
+
.option("--memory <memory>", "Memory limit")
|
|
177
|
+
.option("--cpu <cpu>", "CPU limit")
|
|
178
|
+
.option("--log-level <level>", "Log level")
|
|
179
|
+
.option("--log-file <file>", "Log file path")
|
|
180
|
+
.option("--restart <policy>", "Restart policy")
|
|
181
|
+
.option("--no-health", "Skip health check")
|
|
182
|
+
.option("--no-metrics", "Disable metrics")
|
|
183
|
+
.option("--no-otel", "Disable OpenTelemetry")
|
|
184
|
+
.option("--no-prometheus", "Disable Prometheus")
|
|
185
|
+
.option("--https", "Enable HTTPS")
|
|
186
|
+
.option("--no-linger", "Don't enable linger")
|
|
187
|
+
.option("-f, --force", "Force deployment")
|
|
188
|
+
.option("--reload", "Reload existing service")
|
|
189
|
+
.option("--build", "Build TypeScript")
|
|
190
|
+
.action(deployCommand);
|
|
191
|
+
|
|
192
|
+
program
|
|
193
|
+
.command("loadbalancer")
|
|
194
|
+
.description("Load balancer management")
|
|
195
|
+
.argument("<action>", "Action to perform")
|
|
196
|
+
.option("-p, --port <port>", "Load balancer port", "8080")
|
|
197
|
+
.option("-a, --algorithm <type>", "Load balancing algorithm", "round-robin")
|
|
198
|
+
.option("-b, --backends <list>", "Backend servers (host:port,host:port)")
|
|
199
|
+
.option("--health-check", "Enable health checking", true)
|
|
200
|
+
.option("--health-path <path>", "Health check path", "/healthz")
|
|
201
|
+
.option("--health-interval <ms>", "Health check interval", "10000")
|
|
202
|
+
.action(loadbalancerCommand);
|
|
203
|
+
|
|
204
|
+
program
|
|
205
|
+
.command("dbpool")
|
|
206
|
+
.description("Database connection pool management")
|
|
207
|
+
.argument("<action>", "Action to perform")
|
|
208
|
+
.option("--host <host>", "Database host", "localhost")
|
|
209
|
+
.option("--port <port>", "Database port", "5432")
|
|
210
|
+
.option("--database <name>", "Database name", "testdb")
|
|
211
|
+
.option("--username <user>", "Database username", "user")
|
|
212
|
+
.option("--password <pass>", "Database password", "password")
|
|
213
|
+
.option("--max-connections <num>", "Maximum connections", "10")
|
|
214
|
+
.option("--min-connections <num>", "Minimum connections", "2")
|
|
215
|
+
.option("--concurrency <num>", "Test concurrency", "10")
|
|
216
|
+
.option("--iterations <num>", "Test iterations", "100")
|
|
217
|
+
.action(dbpoolCommand);
|
|
218
|
+
|
|
219
|
+
program
|
|
220
|
+
.command("update")
|
|
221
|
+
.description("Update BS9 to latest version")
|
|
222
|
+
.option("--check", "Check for updates without installing")
|
|
223
|
+
.option("--force", "Force update even if already latest")
|
|
224
|
+
.option("--rollback", "Rollback to previous version")
|
|
225
|
+
.option("--version <version>", "Update to specific version")
|
|
226
|
+
.action(updateCommand);
|
|
227
|
+
|
|
228
|
+
program
|
|
229
|
+
.command("advanced")
|
|
230
|
+
.description("Advanced monitoring dashboard")
|
|
231
|
+
.option("--port <port>", "Dashboard port", "8090")
|
|
232
|
+
.action(advancedMonitoringCommand);
|
|
233
|
+
|
|
234
|
+
program
|
|
235
|
+
.command("consul")
|
|
236
|
+
.description("Consul service discovery")
|
|
237
|
+
.argument("<action>", "Action to perform")
|
|
238
|
+
.option("--consul-url <url>", "Consul URL", "http://localhost:8500")
|
|
239
|
+
.option("--name <name>", "Service name")
|
|
240
|
+
.option("--id <id>", "Service ID")
|
|
241
|
+
.option("--address <address>", "Service address")
|
|
242
|
+
.option("--port <port>", "Service port")
|
|
243
|
+
.option("--tags <tags>", "Service tags (comma-separated)")
|
|
244
|
+
.option("--health-check <url>", "Health check URL")
|
|
245
|
+
.option("--meta <json>", "Service metadata (JSON)")
|
|
246
|
+
.option("--service <service>", "Service name for discovery")
|
|
247
|
+
.action(consulCommand);
|
|
248
|
+
|
|
249
|
+
program
|
|
250
|
+
.command("doctor")
|
|
251
|
+
.description("Perform comprehensive health check")
|
|
252
|
+
.option("--check <type>", "Specific check to run (dependencies|configuration|platform)")
|
|
253
|
+
.option("-v, --verbose", "Verbose output with system information")
|
|
254
|
+
.action(doctorCommand);
|
|
255
|
+
|
|
256
|
+
program
|
|
257
|
+
.command("inspect")
|
|
258
|
+
.description("Comprehensive system inspection and analysis")
|
|
259
|
+
.option("--security", "Security inspection only")
|
|
260
|
+
.option("--performance", "Performance inspection only")
|
|
261
|
+
.option("--configuration", "Configuration inspection only")
|
|
262
|
+
.option("--compliance", "Compliance inspection only")
|
|
263
|
+
.option("--full", "Complete enterprise inspection")
|
|
264
|
+
.option("--report <format>", "Export report (json|csv)")
|
|
265
|
+
.option("--deep", "Deep system analysis")
|
|
266
|
+
.option("-v, --verbose", "Verbose output with detailed analysis")
|
|
267
|
+
.action(inspectCommand);
|
|
268
|
+
|
|
269
|
+
program.parse();
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { join, dirname } from "node:path";
|
|
6
|
+
|
|
7
|
+
// Read version from package.json
|
|
8
|
+
const packageJsonPath = join(dirname(import.meta.path), '..', 'package.json');
|
|
9
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
10
|
+
const version = packageJson.version;
|
|
11
|
+
|
|
12
|
+
import { startCommand } from "../src/commands/start.js";
|
|
13
|
+
import { stopCommand } from "../src/commands/stop.js";
|
|
14
|
+
import { restartCommand } from "../src/commands/restart.js";
|
|
15
|
+
import { statusCommand } from "../src/commands/status.js";
|
|
16
|
+
import { logsCommand } from "../src/commands/logs.js";
|
|
17
|
+
import { monitCommand } from "../src/commands/monit.js";
|
|
18
|
+
import { webCommand } from "../src/commands/web.js";
|
|
19
|
+
import { alertCommand } from "../src/commands/alert.js";
|
|
20
|
+
import { exportCommand } from "../src/commands/export.js";
|
|
21
|
+
import { depsCommand } from "../src/commands/deps.js";
|
|
22
|
+
import { profileCommand } from "../src/commands/profile.js";
|
|
23
|
+
import { deleteCommand } from "../src/commands/delete.js";
|
|
24
|
+
import { saveCommand } from "../src/commands/save.js";
|
|
25
|
+
import { resurrectCommand } from "../src/commands/resurrect.js";
|
|
26
|
+
import { deployCommand } from "../src/commands/deploy.js";
|
|
27
|
+
import { loadbalancerCommand } from "../src/loadbalancer/manager.js";
|
|
28
|
+
import { windowsCommand } from "../src/windows/service.js";
|
|
29
|
+
import { launchdCommand } from "../src/macos/launchd.js";
|
|
30
|
+
import { updateCommand } from "../src/commands/update.js";
|
|
31
|
+
import { dbpoolCommand } from "../src/database/pool.js";
|
|
32
|
+
import { advancedMonitoringCommand } from "../src/monitoring/advanced.js";
|
|
33
|
+
import { consulCommand } from "../src/discovery/consul.js";
|
|
34
|
+
import { doctorCommand } from "../src/commands/doctor.js";
|
|
35
|
+
|
|
36
|
+
const program = new Command();
|
|
37
|
+
|
|
38
|
+
program
|
|
39
|
+
.name("bs9")
|
|
40
|
+
.description("BS9 (Bun Sentinel 9) ā Mission-critical process manager CLI")
|
|
41
|
+
.version(version);
|
|
42
|
+
|
|
43
|
+
program
|
|
44
|
+
.command("start")
|
|
45
|
+
.description("Start a process with hardened systemd unit")
|
|
46
|
+
.argument("<file>", "Application file to start")
|
|
47
|
+
.option("-n, --name <name>", "Service name")
|
|
48
|
+
.option("-p, --port <port>", "Port number", "3000")
|
|
49
|
+
.option("-h, --host <host>", "Host address", "localhost")
|
|
50
|
+
.option("--https", "Use HTTPS protocol")
|
|
51
|
+
.option("-e, --env <env>", "Environment variables (can be used multiple times)", (value, previous) => [...(previous || []), value])
|
|
52
|
+
.option("--otel", "Enable OpenTelemetry instrumentation", true)
|
|
53
|
+
.option("--prometheus", "Enable Prometheus metrics", true)
|
|
54
|
+
.option("--build", "Build TypeScript to JavaScript before starting")
|
|
55
|
+
.action(startCommand);
|
|
56
|
+
|
|
57
|
+
program
|
|
58
|
+
.command("stop")
|
|
59
|
+
.description("Stop a managed service")
|
|
60
|
+
.argument("<name>", "Service name")
|
|
61
|
+
.action(stopCommand);
|
|
62
|
+
|
|
63
|
+
program
|
|
64
|
+
.command("restart")
|
|
65
|
+
.description("Restart a managed service")
|
|
66
|
+
.argument("<name>", "Service name")
|
|
67
|
+
.action(restartCommand);
|
|
68
|
+
|
|
69
|
+
program
|
|
70
|
+
.command("status")
|
|
71
|
+
.description("Show status and SRE metrics for all services")
|
|
72
|
+
.option("-w, --watch", "Watch mode (refresh every 2s)")
|
|
73
|
+
.action(statusCommand);
|
|
74
|
+
|
|
75
|
+
program
|
|
76
|
+
.command("logs")
|
|
77
|
+
.description("Show logs for a service (via journalctl)")
|
|
78
|
+
.argument("<name>", "Service name")
|
|
79
|
+
.option("-f, --follow", "Follow logs")
|
|
80
|
+
.option("-n, --lines <number>", "Number of lines", "50")
|
|
81
|
+
.action(logsCommand);
|
|
82
|
+
|
|
83
|
+
program
|
|
84
|
+
.command("monit")
|
|
85
|
+
.description("Real-time terminal dashboard for all services")
|
|
86
|
+
.option("-r, --refresh <seconds>", "Refresh interval in seconds", "2")
|
|
87
|
+
.action(monitCommand);
|
|
88
|
+
|
|
89
|
+
program
|
|
90
|
+
.command("web")
|
|
91
|
+
.description("Start web-based monitoring dashboard")
|
|
92
|
+
.option("-p, --port <port>", "Port for web dashboard", "8080")
|
|
93
|
+
.option("-d, --detach", "Run in background")
|
|
94
|
+
.action(webCommand);
|
|
95
|
+
|
|
96
|
+
program
|
|
97
|
+
.command("alert")
|
|
98
|
+
.description("Configure alert thresholds and webhooks")
|
|
99
|
+
.option("--enable", "Enable alerts")
|
|
100
|
+
.option("--disable", "Disable alerts")
|
|
101
|
+
.option("--webhook <url>", "Set webhook URL for alerts")
|
|
102
|
+
.option("--cpu <percentage>", "CPU threshold percentage")
|
|
103
|
+
.option("--memory <percentage>", "Memory threshold percentage")
|
|
104
|
+
.option("--errorRate <percentage>", "Error rate threshold percentage")
|
|
105
|
+
.option("--uptime <percentage>", "Uptime threshold percentage")
|
|
106
|
+
.option("--cooldown <seconds>", "Alert cooldown period in seconds")
|
|
107
|
+
.option("--service <name>", "Configure alerts for specific service")
|
|
108
|
+
.option("--list", "List current alert configuration")
|
|
109
|
+
.option("--test", "Test webhook connectivity")
|
|
110
|
+
.action(alertCommand);
|
|
111
|
+
|
|
112
|
+
program
|
|
113
|
+
.command("export")
|
|
114
|
+
.description("Export historical metrics data")
|
|
115
|
+
.option("-f, --format <format>", "Export format (json|csv)", "json")
|
|
116
|
+
.option("-h, --hours <hours>", "Hours of data to export", "24")
|
|
117
|
+
.option("-o, --output <file>", "Output file path")
|
|
118
|
+
.option("-s, --service <name>", "Export specific service metrics")
|
|
119
|
+
.action(exportCommand);
|
|
120
|
+
|
|
121
|
+
program
|
|
122
|
+
.command("deps")
|
|
123
|
+
.description("Visualize service dependencies")
|
|
124
|
+
.option("-f, --format <format>", "Output format (text|dot|json)", "text")
|
|
125
|
+
.option("-o, --output <file>", "Output file path")
|
|
126
|
+
.action(depsCommand);
|
|
127
|
+
|
|
128
|
+
program
|
|
129
|
+
.command("profile")
|
|
130
|
+
.description("Performance profiling for services")
|
|
131
|
+
.option("-d, --duration <seconds>", "Profiling duration", "60")
|
|
132
|
+
.option("-i, --interval <ms>", "Sampling interval", "1000")
|
|
133
|
+
.option("-s, --service <name>", "Service name to profile")
|
|
134
|
+
.option("--flamegraph", "Generate flame graph")
|
|
135
|
+
.option("--top <number>", "Show top N functions", "10")
|
|
136
|
+
.action(profileCommand);
|
|
137
|
+
|
|
138
|
+
program
|
|
139
|
+
.command("delete")
|
|
140
|
+
.description("Delete managed services")
|
|
141
|
+
.argument("[name]", "Service name (optional)")
|
|
142
|
+
.option("-a, --all", "Delete all services")
|
|
143
|
+
.option("-f, --force", "Force deletion without errors")
|
|
144
|
+
.option("-r, --remove", "Remove service configuration files")
|
|
145
|
+
.option("-t, --timeout <seconds>", "Timeout for graceful shutdown (default: 30)")
|
|
146
|
+
.action(deleteCommand);
|
|
147
|
+
|
|
148
|
+
program
|
|
149
|
+
.command("save")
|
|
150
|
+
.description("Save service configurations to backup")
|
|
151
|
+
.argument("[name]", "Service name (optional)")
|
|
152
|
+
.option("-a, --all", "Save all services")
|
|
153
|
+
.option("-f, --force", "Force save without errors")
|
|
154
|
+
.option("-b, --backup", "Create timestamped backup")
|
|
155
|
+
.action(saveCommand);
|
|
156
|
+
|
|
157
|
+
program
|
|
158
|
+
.command("resurrect")
|
|
159
|
+
.description("Resurrect services from backup")
|
|
160
|
+
.argument("[name]", "Service name (optional)")
|
|
161
|
+
.option("-a, --all", "Resurrect all services")
|
|
162
|
+
.option("-f, --force", "Force resurrection without errors")
|
|
163
|
+
.option("-c, --config <file>", "Configuration file to use")
|
|
164
|
+
.action(resurrectCommand);
|
|
165
|
+
|
|
166
|
+
program
|
|
167
|
+
.command("deploy")
|
|
168
|
+
.description("š Deploy applications with zero-config production setup")
|
|
169
|
+
.argument("<file>", "Application file to deploy")
|
|
170
|
+
.option("-n, --name <name>", "Service name")
|
|
171
|
+
.option("-p, --port <port>", "Port number", "3000")
|
|
172
|
+
.option("-h, --host <host>", "Host address", "localhost")
|
|
173
|
+
.option("-e, --env <env>", "Environment variables (multiple)", (value, previous) => [...(previous || []), value])
|
|
174
|
+
.option("-i, --instances <number>", "Number of instances")
|
|
175
|
+
.option("--memory <memory>", "Memory limit")
|
|
176
|
+
.option("--cpu <cpu>", "CPU limit")
|
|
177
|
+
.option("--log-level <level>", "Log level")
|
|
178
|
+
.option("--log-file <file>", "Log file path")
|
|
179
|
+
.option("--restart <policy>", "Restart policy")
|
|
180
|
+
.option("--no-health", "Skip health check")
|
|
181
|
+
.option("--no-metrics", "Disable metrics")
|
|
182
|
+
.option("--no-otel", "Disable OpenTelemetry")
|
|
183
|
+
.option("--no-prometheus", "Disable Prometheus")
|
|
184
|
+
.option("--https", "Enable HTTPS")
|
|
185
|
+
.option("--no-linger", "Don't enable linger")
|
|
186
|
+
.option("-f, --force", "Force deployment")
|
|
187
|
+
.option("--reload", "Reload existing service")
|
|
188
|
+
.option("--build", "Build TypeScript")
|
|
189
|
+
.action(deployCommand);
|
|
190
|
+
|
|
191
|
+
program
|
|
192
|
+
.command("loadbalancer")
|
|
193
|
+
.description("Load balancer management")
|
|
194
|
+
.argument("<action>", "Action to perform")
|
|
195
|
+
.option("-p, --port <port>", "Load balancer port", "8080")
|
|
196
|
+
.option("-a, --algorithm <type>", "Load balancing algorithm", "round-robin")
|
|
197
|
+
.option("-b, --backends <list>", "Backend servers (host:port,host:port)")
|
|
198
|
+
.option("--health-check", "Enable health checking", true)
|
|
199
|
+
.option("--health-path <path>", "Health check path", "/healthz")
|
|
200
|
+
.option("--health-interval <ms>", "Health check interval", "10000")
|
|
201
|
+
.action(loadbalancerCommand);
|
|
202
|
+
|
|
203
|
+
program
|
|
204
|
+
.command("dbpool")
|
|
205
|
+
.description("Database connection pool management")
|
|
206
|
+
.argument("<action>", "Action to perform")
|
|
207
|
+
.option("--host <host>", "Database host", "localhost")
|
|
208
|
+
.option("--port <port>", "Database port", "5432")
|
|
209
|
+
.option("--database <name>", "Database name", "testdb")
|
|
210
|
+
.option("--username <user>", "Database username", "user")
|
|
211
|
+
.option("--password <pass>", "Database password", "password")
|
|
212
|
+
.option("--max-connections <num>", "Maximum connections", "10")
|
|
213
|
+
.option("--min-connections <num>", "Minimum connections", "2")
|
|
214
|
+
.option("--concurrency <num>", "Test concurrency", "10")
|
|
215
|
+
.option("--iterations <num>", "Test iterations", "100")
|
|
216
|
+
.action(dbpoolCommand);
|
|
217
|
+
|
|
218
|
+
program
|
|
219
|
+
.command("update")
|
|
220
|
+
.description("Update BS9 to latest version")
|
|
221
|
+
.option("--check", "Check for updates without installing")
|
|
222
|
+
.option("--force", "Force update even if already latest")
|
|
223
|
+
.option("--rollback", "Rollback to previous version")
|
|
224
|
+
.option("--version <version>", "Update to specific version")
|
|
225
|
+
.action(updateCommand);
|
|
226
|
+
|
|
227
|
+
program
|
|
228
|
+
.command("advanced")
|
|
229
|
+
.description("Advanced monitoring dashboard")
|
|
230
|
+
.option("--port <port>", "Dashboard port", "8090")
|
|
231
|
+
.action(advancedMonitoringCommand);
|
|
232
|
+
|
|
233
|
+
program
|
|
234
|
+
.command("consul")
|
|
235
|
+
.description("Consul service discovery")
|
|
236
|
+
.argument("<action>", "Action to perform")
|
|
237
|
+
.option("--consul-url <url>", "Consul URL", "http://localhost:8500")
|
|
238
|
+
.option("--name <name>", "Service name")
|
|
239
|
+
.option("--id <id>", "Service ID")
|
|
240
|
+
.option("--address <address>", "Service address")
|
|
241
|
+
.option("--port <port>", "Service port")
|
|
242
|
+
.option("--tags <tags>", "Service tags (comma-separated)")
|
|
243
|
+
.option("--health-check <url>", "Health check URL")
|
|
244
|
+
.option("--meta <json>", "Service metadata (JSON)")
|
|
245
|
+
.option("--service <service>", "Service name for discovery")
|
|
246
|
+
.action(consulCommand);
|
|
247
|
+
|
|
248
|
+
program
|
|
249
|
+
.command("doctor")
|
|
250
|
+
.description("Perform comprehensive health check")
|
|
251
|
+
.option("--check <type>", "Specific check to run (dependencies|configuration|platform)")
|
|
252
|
+
.option("-v, --verbose", "Verbose output with system information")
|
|
253
|
+
.action(doctorCommand);
|
|
254
|
+
|
|
255
|
+
program.parse();
|
package/dist/bs9.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bs9",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6",
|
|
4
4
|
"description": "Bun Sentinel 9 - High-performance, non-root process manager for Bun",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"@opentelemetry/sdk-node": "^0.50.0",
|
|
38
38
|
"@opentelemetry/semantic-conventions": "^1.23.0",
|
|
39
39
|
"commander": "^14.0.2",
|
|
40
|
-
"pg": "^8.12.0",
|
|
41
40
|
"pino": "^9.3.1",
|
|
42
41
|
"prom-client": "^15.1.2"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@types/node": "^22.10.0",
|
|
46
|
-
"bun-types": "^1.1.0"
|
|
45
|
+
"bun-types": "^1.1.0",
|
|
46
|
+
"pg": "^8.12.0"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/src/commands/deploy.ts
CHANGED
|
@@ -237,12 +237,6 @@ function showDeploymentSummary(serviceName: string, options: DeployOptions): voi
|
|
|
237
237
|
console.log(` bs9 delete ${serviceName}`);
|
|
238
238
|
console.log(` bs9 save ${serviceName}`);
|
|
239
239
|
|
|
240
|
-
|
|
241
|
-
console.log(" ā
Zero-config systemd setup");
|
|
242
|
-
console.log(" ā
Built-in health checks & restart policies");
|
|
243
|
-
console.log(" ā
Hot reload with environment updates");
|
|
244
|
-
console.log(" ā
Automatic metrics & observability");
|
|
245
|
-
console.log(" ā
One-command deployment");
|
|
246
|
-
|
|
240
|
+
|
|
247
241
|
console.log("\nš Your service is now running in production mode!");
|
|
248
242
|
}
|