codeharbor 0.1.6 → 0.1.7
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 +10 -3
- package/dist/cli.js +48 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,19 +67,25 @@ curl -fsSL https://raw.githubusercontent.com/biglone/CodeHarbor/main/scripts/ins
|
|
|
67
67
|
Install first, then enable systemd service with one command:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
sudo codeharbor service install
|
|
70
|
+
sudo "$(command -v codeharbor)" service install
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
Install + enable main and admin services:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
sudo codeharbor service install --with-admin
|
|
76
|
+
sudo "$(command -v codeharbor)" service install --with-admin
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Restart installed service(s):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
sudo "$(command -v codeharbor)" service restart --with-admin
|
|
77
83
|
```
|
|
78
84
|
|
|
79
85
|
Remove installed services:
|
|
80
86
|
|
|
81
87
|
```bash
|
|
82
|
-
sudo codeharbor service uninstall --with-admin
|
|
88
|
+
sudo "$(command -v codeharbor)" service uninstall --with-admin
|
|
83
89
|
```
|
|
84
90
|
|
|
85
91
|
Enable Admin service at install time:
|
|
@@ -248,6 +254,7 @@ It documents:
|
|
|
248
254
|
- `codeharbor doctor`: check `codex` and Matrix connectivity
|
|
249
255
|
- `codeharbor admin serve`: start admin UI + config API server
|
|
250
256
|
- `codeharbor service install`: install/enable systemd unit(s) after npm install (supports `--with-admin`)
|
|
257
|
+
- `codeharbor service restart`: restart installed systemd unit(s) (supports `--with-admin`)
|
|
251
258
|
- `codeharbor service uninstall`: remove installed systemd unit(s) (supports `--with-admin`)
|
|
252
259
|
- `codeharbor config export`: export current config snapshot as JSON
|
|
253
260
|
- `codeharbor config import <file>`: import config snapshot JSON (supports `--dry-run`)
|
package/dist/cli.js
CHANGED
|
@@ -5096,6 +5096,20 @@ function uninstallSystemdServices(options) {
|
|
|
5096
5096
|
}
|
|
5097
5097
|
output.write("Done.\n");
|
|
5098
5098
|
}
|
|
5099
|
+
function restartSystemdServices(options) {
|
|
5100
|
+
assertLinuxWithSystemd();
|
|
5101
|
+
assertRootPrivileges();
|
|
5102
|
+
const output = options.output ?? process.stdout;
|
|
5103
|
+
runSystemctl(["restart", MAIN_SERVICE_NAME]);
|
|
5104
|
+
output.write(`Restarted service: ${MAIN_SERVICE_NAME}
|
|
5105
|
+
`);
|
|
5106
|
+
if (options.restartAdmin) {
|
|
5107
|
+
runSystemctl(["restart", ADMIN_SERVICE_NAME]);
|
|
5108
|
+
output.write(`Restarted service: ${ADMIN_SERVICE_NAME}
|
|
5109
|
+
`);
|
|
5110
|
+
}
|
|
5111
|
+
output.write("Done.\n");
|
|
5112
|
+
}
|
|
5099
5113
|
function resolveUserHome(runUser) {
|
|
5100
5114
|
try {
|
|
5101
5115
|
const passwdRaw = import_node_fs10.default.readFileSync("/etc/passwd", "utf8");
|
|
@@ -5301,7 +5315,14 @@ serviceCommand.command("install").description("Install and enable codeharbor sys
|
|
|
5301
5315
|
} catch (error) {
|
|
5302
5316
|
process.stderr.write(`Service install failed: ${formatError3(error)}
|
|
5303
5317
|
`);
|
|
5304
|
-
process.stderr.write(
|
|
5318
|
+
process.stderr.write(
|
|
5319
|
+
[
|
|
5320
|
+
"Hint: run with sudo and absolute CLI path, for example:",
|
|
5321
|
+
' sudo "$(command -v codeharbor)" service install --with-admin',
|
|
5322
|
+
" (remove --with-admin if you only want the main service)",
|
|
5323
|
+
""
|
|
5324
|
+
].join("\n")
|
|
5325
|
+
);
|
|
5305
5326
|
process.exitCode = 1;
|
|
5306
5327
|
}
|
|
5307
5328
|
});
|
|
@@ -5313,7 +5334,32 @@ serviceCommand.command("uninstall").description("Remove codeharbor systemd servi
|
|
|
5313
5334
|
} catch (error) {
|
|
5314
5335
|
process.stderr.write(`Service uninstall failed: ${formatError3(error)}
|
|
5315
5336
|
`);
|
|
5316
|
-
process.stderr.write(
|
|
5337
|
+
process.stderr.write(
|
|
5338
|
+
[
|
|
5339
|
+
"Hint: run with sudo and absolute CLI path, for example:",
|
|
5340
|
+
' sudo "$(command -v codeharbor)" service uninstall --with-admin',
|
|
5341
|
+
""
|
|
5342
|
+
].join("\n")
|
|
5343
|
+
);
|
|
5344
|
+
process.exitCode = 1;
|
|
5345
|
+
}
|
|
5346
|
+
});
|
|
5347
|
+
serviceCommand.command("restart").description("Restart installed codeharbor systemd service (requires root)").option("--with-admin", "also restart codeharbor-admin.service").action((options) => {
|
|
5348
|
+
try {
|
|
5349
|
+
restartSystemdServices({
|
|
5350
|
+
restartAdmin: options.withAdmin ?? false
|
|
5351
|
+
});
|
|
5352
|
+
} catch (error) {
|
|
5353
|
+
process.stderr.write(`Service restart failed: ${formatError3(error)}
|
|
5354
|
+
`);
|
|
5355
|
+
process.stderr.write(
|
|
5356
|
+
[
|
|
5357
|
+
"Hint: run with sudo and absolute CLI path, for example:",
|
|
5358
|
+
' sudo "$(command -v codeharbor)" service restart --with-admin',
|
|
5359
|
+
" (remove --with-admin if you only want the main service)",
|
|
5360
|
+
""
|
|
5361
|
+
].join("\n")
|
|
5362
|
+
);
|
|
5317
5363
|
process.exitCode = 1;
|
|
5318
5364
|
}
|
|
5319
5365
|
});
|