openship 0.6.0 → 0.6.5

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.
Files changed (63) hide show
  1. package/README.md +7 -2
  2. package/dist/{bare-FSUAM5V5.js → bare-XQIPDO4R.js} +10 -9
  3. package/dist/{chunk-PSZSKEPA.js → chunk-3ZAGC5NT.js} +64 -17
  4. package/dist/{chunk-6ODUBKUB.js → chunk-5OUWIPOB.js} +69 -7
  5. package/dist/chunk-6HOA5JT7.js +124 -0
  6. package/dist/{chunk-TWJCLD4W.js → chunk-6JELW75A.js} +4 -4
  7. package/dist/{chunk-GUQ3QCJ7.js → chunk-7334NSJL.js} +399 -369
  8. package/dist/chunk-7S4USQYF.js +1753 -0
  9. package/dist/{chunk-3LDWWY7U.js → chunk-A7EWM2KA.js} +41 -7
  10. package/dist/chunk-ELGRMZOW.js +25 -0
  11. package/dist/chunk-EZPPTWJQ.js +292 -0
  12. package/dist/{chunk-IXM5245F.js → chunk-GRTXMUHA.js} +553 -538
  13. package/dist/chunk-HPXP6LXZ.js +428 -0
  14. package/dist/{chunk-OTLSJYAC.js → chunk-LEYSL46B.js} +2135 -85
  15. package/dist/{chunk-EMXI4UCU.js → chunk-LFCSC4IU.js} +29 -10
  16. package/dist/{chunk-JIMUYEKN.js → chunk-MSZUCNPV.js} +1 -1
  17. package/dist/{chunk-OGY63DGD.js → chunk-PZRRL5PC.js} +71 -28
  18. package/dist/{chunk-VE2YOK4I.js → chunk-QLX7NBEA.js} +1218 -588
  19. package/dist/chunk-RFWJE7ZN.js +68 -0
  20. package/dist/{chunk-VDDMADOF.js → chunk-TM2IQPYU.js} +16 -2
  21. package/dist/{chunk-3FYIXVX5.js → chunk-VDESJSG6.js} +451 -106
  22. package/dist/{chunk-B3CE2OMR.js → chunk-VHMOQL5Y.js} +276 -50
  23. package/dist/{chunk-QEH4QUBX.js → chunk-VLQ3UIVO.js} +393 -53
  24. package/dist/{chunk-VZ2ZHPS2.js → chunk-WE7BXW6L.js} +3 -9
  25. package/dist/chunk-WFRXYWK2.js +444 -0
  26. package/dist/chunk-XRNRT37W.js +316 -0
  27. package/dist/{chunk-EP2TNALB.js → chunk-XVOBL7BC.js} +31 -8
  28. package/dist/cloud-3DODOWTR.js +36 -0
  29. package/dist/{detect-ALF4GXRX.js → detect-P4CIQBRH.js} +3 -3
  30. package/dist/{docker-QECQJ5P4.js → docker-3K2NEBD6.js} +15 -8
  31. package/dist/{docker-edge-executor-62N64MGS.js → docker-edge-executor-YZZ6P7IC.js} +5 -5
  32. package/dist/{edge-import-CQWHN2Q3.js → edge-import-MCJNVTZ2.js} +26 -23
  33. package/dist/edge-preflight-ES6FH4JK.js +42 -0
  34. package/dist/{ensure-container-edge-MJVXJQG5.js → ensure-container-edge-YPITNH45.js} +9 -8
  35. package/dist/{executor-JELARVKC.js → executor-DZGX55K2.js} +12 -5
  36. package/dist/host-channel-preflight-MUXE3KZU.js +49 -0
  37. package/dist/index.js +3668 -4063
  38. package/dist/{nginx-AXGNWRKZ.js → nginx-NSAHWGJV.js} +11 -5
  39. package/dist/node-bootstrap.js +241 -0
  40. package/dist/node-entry.js +52 -1
  41. package/dist/{openresty-lua-IE4P5YQX.js → openresty-lua-DR4D3EZ6.js} +6 -2
  42. package/dist/privilege-YTVI4SKF.js +19 -0
  43. package/dist/server/engine/samples/fail2ban/jail.d/sshd.local +4 -1
  44. package/dist/server/index.js +21501 -13137
  45. package/dist/server/lua/geo_country.lua +4 -3
  46. package/dist/server/lua/pipe_stream.lua +52 -39
  47. package/dist/server/lua/site_logger.lua +22 -24
  48. package/dist/server/migrations/0098_instance_product_mode.sql +12 -0
  49. package/dist/server/migrations/0099_mail_webmail_project.sql +24 -0
  50. package/dist/server/migrations/0100_server_ssh_private_key.sql +11 -0
  51. package/dist/server/migrations/0101_mail_resume_step.sql +12 -0
  52. package/dist/server/migrations/0102_project_workload_axes.sql +19 -0
  53. package/dist/server/migrations/0103_dns_credential.sql +41 -0
  54. package/dist/server/migrations/0104_instance_host_control.sql +15 -0
  55. package/dist/server/migrations/meta/_journal.json +49 -0
  56. package/dist/{setup-FA4PW4NU.js → setup-WUUZURHS.js} +10 -9
  57. package/dist/up-XEO3SR6Z.js +58 -0
  58. package/package.json +4 -2
  59. package/dist/chunk-IW2UKBVF.js +0 -144
  60. package/dist/chunk-ZCFVHA25.js +0 -89
  61. package/dist/cloud-E5M6VMCG.js +0 -31
  62. package/dist/server/lua/pipe_log.lua +0 -77
  63. /package/dist/{dist-es-JGBPABJI.js → dist-es-ZP5QDSJ3.js} +0 -0
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env sh
2
+ ":" //# ; exec "$(command -v node || command -v bun)" "$0" "$@"
3
+ import { createRequire as __ospCreateRequire } from "node:module";
4
+ const require = __ospCreateRequire(import.meta.url);
5
+ import {
6
+ hostRefusal
7
+ } from "./chunk-EZPPTWJQ.js";
8
+ import {
9
+ elevatedExecutor,
10
+ resolveEnvironment
11
+ } from "./chunk-WFRXYWK2.js";
12
+ import {
13
+ answered,
14
+ refused
15
+ } from "./chunk-LEYSL46B.js";
16
+
17
+ // ../../packages/adapters/src/system/privilege.ts
18
+ function rootChecked(executor, why) {
19
+ void why;
20
+ return executor;
21
+ }
22
+ var REFUSES_HOST = {
23
+ refuse: true,
24
+ proceed: false
25
+ };
26
+ async function privilegedExecutor(executor, purpose, opts = {}) {
27
+ const profile = await resolveEnvironment(executor);
28
+ const refusal = hostRefusal(profile);
29
+ if (refusal && REFUSES_HOST[opts.onRefusedHost ?? "refuse"]) return refused(refusal);
30
+ const grant = (elevation, why, exec = executor) => answered({ executor: rootChecked(exec, why), profile, elevation });
31
+ if (profile.isRoot) return grant("root", "the login is root");
32
+ if (profile.canSudo) {
33
+ return grant("sudo", "non-root login with passwordless sudo", elevatedExecutor(executor));
34
+ }
35
+ if (refusal) return grant("none", "caller chose to proceed unprivileged on a refused host");
36
+ return refused(
37
+ `${purpose} needs root. Connect this server as root, or as a user with passwordless sudo.`
38
+ );
39
+ }
40
+ async function rootOrDegrade(executor, opts) {
41
+ const grant = await privilegedExecutor(executor, opts.purpose, {
42
+ // A host we won't PROVISION we can still write files on — none of this installs
43
+ // packages. Refusing here would take a working edge away from an openSUSE box.
44
+ onRefusedHost: "proceed"
45
+ }).catch((err) => {
46
+ opts.report(
47
+ `${opts.purpose}: could not check this host's privileges (${err instanceof Error ? err.message : String(err)}). ${opts.consequence}`
48
+ );
49
+ return null;
50
+ });
51
+ if (!grant) return rootChecked(executor, "host unmeasurable; reported and degraded");
52
+ if (!grant.supported) {
53
+ opts.report(`${grant.reason} ${opts.consequence}`);
54
+ return rootChecked(executor, "gate refused the host; reported and degraded");
55
+ }
56
+ if (grant.value.elevation === "none") {
57
+ opts.report(
58
+ `${opts.purpose} needs root, and this host's login is neither root nor able to sudo. ${opts.consequence}`
59
+ );
60
+ }
61
+ return grant.value.executor;
62
+ }
63
+
64
+ export {
65
+ rootChecked,
66
+ privilegedExecutor,
67
+ rootOrDegrade
68
+ };
@@ -5,12 +5,12 @@ const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  getTarCreateEnv,
7
7
  prepareSourceTarArgs
8
- } from "./chunk-6ODUBKUB.js";
8
+ } from "./chunk-5OUWIPOB.js";
9
9
  import {
10
10
  TRANSFER_EXCLUDES,
11
11
  packageManagerEnsureCommand,
12
12
  safeErrorMessage
13
- } from "./chunk-OTLSJYAC.js";
13
+ } from "./chunk-LEYSL46B.js";
14
14
 
15
15
  // ../../packages/adapters/src/runtime/git-clone.ts
16
16
  function sq(value) {
@@ -193,6 +193,19 @@ var BuildCancelledError = class extends Error {
193
193
  this.name = "BuildCancelledError";
194
194
  }
195
195
  };
196
+ async function killProcessesUnderDir(executor, dir, opts) {
197
+ const quoted = sq(dir);
198
+ const roots = opts?.includeSuffixed ? [quoted, `${quoted}-*`] : [quoted];
199
+ const patterns = roots.flatMap((root) => [
200
+ root,
201
+ `${root}/*`,
202
+ `${root}" (deleted)"`,
203
+ `${root}/*" (deleted)"`
204
+ ]);
205
+ const scan = (sig) => `for p in /proc/[0-9]*; do c=$(readlink "$p/cwd" 2>/dev/null); case "$c" in ${patterns.join("|")}) kill -${sig} "\${p##*/}" 2>/dev/null || true;; esac; done`;
206
+ await executor.exec(`${scan("TERM")}; sleep 2; ${scan("KILL")}`).catch(() => {
207
+ });
208
+ }
196
209
  async function runBuildPipeline(env, config, logger) {
197
210
  let startTime = Date.now();
198
211
  let currentStep = "prepare";
@@ -413,6 +426,7 @@ export {
413
426
  localGitSshWriter,
414
427
  BuildLogger,
415
428
  BuildCancelledError,
429
+ killProcessesUnderDir,
416
430
  runBuildPipeline,
417
431
  parseLogLevel,
418
432
  detectBuildKillHint,