openship 0.4.8 → 0.6.0

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 (112) hide show
  1. package/README.md +27 -1
  2. package/dist/bare-FSUAM5V5.js +23 -0
  3. package/dist/{bowser-O3AEA6AN.js → bowser-HNOTPGJO.js} +2 -2
  4. package/dist/{chunk-5MZ624VX.js → chunk-2GWYYHOR.js} +1 -1
  5. package/dist/chunk-3FYIXVX5.js +8051 -0
  6. package/dist/{chunk-ILFETZOM.js → chunk-3LDWWY7U.js} +21 -1
  7. package/dist/{chunk-W73X43R7.js → chunk-3NQQXMDR.js} +3 -3
  8. package/dist/{chunk-OWED2GRM.js → chunk-42WQABXM.js} +2 -2
  9. package/dist/{chunk-TYVME3XD.js → chunk-6FH4AXVY.js} +20 -3
  10. package/dist/{chunk-OXWDY22G.js → chunk-6ODUBKUB.js} +3 -3
  11. package/dist/{chunk-DYPH4HCI.js → chunk-AO252K7Z.js} +1 -1
  12. package/dist/{chunk-XPPZ7B2J.js → chunk-B3CE2OMR.js} +14 -12
  13. package/dist/{chunk-IXCHURVK.js → chunk-DOD2BXHQ.js} +4 -4
  14. package/dist/{chunk-VWPEKOH6.js → chunk-DRK3MEDS.js} +3 -3
  15. package/dist/{chunk-V6AN6XLZ.js → chunk-EMXI4UCU.js} +125 -47
  16. package/dist/{chunk-GKHUSZCD.js → chunk-EP2TNALB.js} +2 -2
  17. package/dist/{chunk-SLTYVHU7.js → chunk-GUQ3QCJ7.js} +942 -519
  18. package/dist/chunk-I3DPMTSF.js +29 -0
  19. package/dist/{chunk-L2VOGB2X.js → chunk-IW2UKBVF.js} +3 -3
  20. package/dist/{chunk-VDMQJHPI.js → chunk-IXM5245F.js} +228 -13
  21. package/dist/{chunk-MZ2WEHHY.js → chunk-JIMUYEKN.js} +4 -4
  22. package/dist/chunk-OGY63DGD.js +705 -0
  23. package/dist/{chunk-O6ZZF52V.js → chunk-ONKEYSMY.js} +2 -2
  24. package/dist/{chunk-6APULWSU.js → chunk-OTLSJYAC.js} +1744 -118
  25. package/dist/{chunk-EI575GHN.js → chunk-PDW4L3NV.js} +3 -3
  26. package/dist/{chunk-5NYUCONN.js → chunk-PSZSKEPA.js} +33 -51
  27. package/dist/{chunk-KI2EY3WB.js → chunk-PXKCZB2I.js} +1 -1
  28. package/dist/{chunk-FXTBHTWY.js → chunk-QEH4QUBX.js} +649 -85
  29. package/dist/{chunk-6APIPIJY.js → chunk-QWHBRY2K.js} +5 -5
  30. package/dist/{chunk-6B5YCFFV.js → chunk-RVER2EOO.js} +5 -5
  31. package/dist/{chunk-Q2CIRAOK.js → chunk-RXQBD4ZY.js} +1 -1
  32. package/dist/{chunk-TGIINPVM.js → chunk-TWJCLD4W.js} +60 -10
  33. package/dist/{chunk-4Z5QO7N6.js → chunk-VDDMADOF.js} +3 -3
  34. package/dist/{chunk-BBHX7T4R.js → chunk-VE2YOK4I.js} +991 -254
  35. package/dist/{chunk-2D3I5G6P.js → chunk-VZ2ZHPS2.js} +73 -43
  36. package/dist/{chunk-AVIB7CT7.js → chunk-WNWQBB7F.js} +2 -2
  37. package/dist/{chunk-FRNAR33O.js → chunk-XZYFZ6A5.js} +3 -3
  38. package/dist/{chunk-RPHRPFEH.js → chunk-ZCFVHA25.js} +1 -1
  39. package/dist/{chunk-FPRHYBY2.js → chunk-ZFJXPCQP.js} +1 -1
  40. package/dist/{chunk-JYGD5WSN.js → chunk-ZWLDLTJP.js} +1 -1
  41. package/dist/cloud-E5M6VMCG.js +31 -0
  42. package/dist/{cloud-7QYOGF7F.js → cloud-KRTZ2IL5.js} +3 -3
  43. package/dist/{detect-AZLOHUFX.js → detect-ALF4GXRX.js} +7 -8
  44. package/dist/{dist-IQJ6H6UZ.js → dist-BM6NPWIH.js} +3 -3
  45. package/dist/{dist-es-X3B5QYKB.js → dist-es-2YRDXMUU.js} +6 -6
  46. package/dist/{dist-es-OSNJBLXB.js → dist-es-CCVZEFRZ.js} +5 -5
  47. package/dist/{dist-es-VNKHQVIB.js → dist-es-IOH6G4GM.js} +4 -4
  48. package/dist/{dist-es-RYHIPOTN.js → dist-es-JGBPABJI.js} +14 -14
  49. package/dist/{dist-es-JSTDUS7Q.js → dist-es-KWSMDPIP.js} +6 -6
  50. package/dist/{dist-es-5DY7K32L.js → dist-es-UYDDOVZ3.js} +6 -6
  51. package/dist/{dist-es-WV4AMOII.js → dist-es-XUOR4NQN.js} +8 -8
  52. package/dist/docker-QECQJ5P4.js +32 -0
  53. package/dist/docker-edge-executor-62N64MGS.js +17 -0
  54. package/dist/edge-import-CQWHN2Q3.js +48 -0
  55. package/dist/ensure-container-edge-MJVXJQG5.js +32 -0
  56. package/dist/{event-streams-EHRAKL75.js → event-streams-TR4GAC53.js} +4 -4
  57. package/dist/{executor-XJ6RP4Q2.js → executor-JELARVKC.js} +8 -8
  58. package/dist/index.js +1209 -560
  59. package/dist/{loadSso-46FQRIZS.js → loadSso-UGF4JMRK.js} +10 -10
  60. package/dist/{local-executor-V7U5VOZW.js → local-executor-WOFZD72X.js} +4 -4
  61. package/dist/nginx-AXGNWRKZ.js +31 -0
  62. package/dist/node-entry.js +4 -0
  63. package/dist/{noop-FMMFG2EZ.js → noop-NJ72F46T.js} +3 -3
  64. package/dist/openresty-lua-IE4P5YQX.js +81 -0
  65. package/dist/server/index.js +116248 -94749
  66. package/dist/server/lua/geo_country.lua +31 -6
  67. package/dist/server/lua/maxminddb.lua +403 -0
  68. package/dist/server/lua/mgmt_api.lua +431 -68
  69. package/dist/server/lua/pipe_log.lua +10 -4
  70. package/dist/server/lua/site_logger.lua +220 -12
  71. package/dist/server/migrations/0073_project_volumes_object_storage.sql +3 -0
  72. package/dist/server/migrations/0074_project_compose_path.sql +1 -0
  73. package/dist/server/migrations/0075_service_command_argv.sql +1 -0
  74. package/dist/server/migrations/0076_rollback_retention.sql +17 -0
  75. package/dist/server/migrations/0077_domain_redirect.sql +13 -0
  76. package/dist/server/migrations/0078_grant_source_scope.sql +30 -0
  77. package/dist/server/migrations/0079_project_readiness.sql +18 -0
  78. package/dist/server/migrations/0080_deployment_error_classification.sql +26 -0
  79. package/dist/server/migrations/0081_project_readiness_repair.sql +34 -0
  80. package/dist/server/migrations/0082_edge_target_verification.sql +39 -0
  81. package/dist/server/migrations/0083_service_incident.sql +84 -0
  82. package/dist/server/migrations/0084_analytics_daily_rollup.sql +72 -0
  83. package/dist/server/migrations/0085_resource_usage.sql +68 -0
  84. package/dist/server/migrations/0086_remote_infra_updates.sql +41 -0
  85. package/dist/server/migrations/0087_server_container_version_columns.sql +17 -0
  86. package/dist/server/migrations/0088_audit_source_and_settings.sql +27 -0
  87. package/dist/server/migrations/0089_auto_scan_infra.sql +7 -0
  88. package/dist/server/migrations/0090_project_collect_paths.sql +18 -0
  89. package/dist/server/migrations/0091_project_server_id.sql +26 -0
  90. package/dist/server/migrations/0092_project_internal_alias.sql +13 -0
  91. package/dist/server/migrations/0093_service_incident_org_index.sql +13 -0
  92. package/dist/server/migrations/0094_backup_restore_meta.sql +15 -0
  93. package/dist/server/migrations/0095_backup_restore_cancel.sql +19 -0
  94. package/dist/server/migrations/0096_backup_policy_retention_defaults.sql +20 -0
  95. package/dist/server/migrations/0097_update_status_upstream_only.sql +35 -0
  96. package/dist/server/migrations/meta/_journal.json +175 -0
  97. package/dist/setup-FA4PW4NU.js +21 -0
  98. package/dist/{signin-ITOPKKUB.js → signin-3M3UPB6K.js} +10 -10
  99. package/dist/{sso-oidc-NON2PD7Y.js → sso-oidc-3VDIYOEJ.js} +10 -10
  100. package/dist/{sts-HHFFSAY2.js → sts-B3WIYLXR.js} +9 -9
  101. package/package.json +6 -3
  102. package/dist/bare-JY5Y5ELU.js +0 -23
  103. package/dist/chunk-SJIFLLX4.js +0 -2931
  104. package/dist/chunk-VFINNTUL.js +0 -362
  105. package/dist/cloud-KYWY3RP4.js +0 -30
  106. package/dist/docker-LODK5Y2S.js +0 -16
  107. package/dist/docker-edge-executor-VHW3JPJS.js +0 -13
  108. package/dist/edge-import-ABUDKKJI.js +0 -45
  109. package/dist/ensure-container-edge-SW6HENSG.js +0 -31
  110. package/dist/nginx-3L4SIBJA.js +0 -24
  111. package/dist/openresty-lua-4WLGDSER.js +0 -42
  112. package/dist/setup-NU6T2PDU.js +0 -20
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env sh
2
- ":" //# ; exec "$(command -v bun || command -v node)" "$0" "$@"
2
+ ":" //# ; exec "$(command -v node || command -v bun)" "$0" "$@"
3
3
  import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  SerdeContextConfig,
7
7
  SignatureV4,
8
8
  UnionSerde
9
- } from "./chunk-IXCHURVK.js";
9
+ } from "./chunk-DOD2BXHQ.js";
10
10
  import {
11
11
  getValueFromTextNode
12
- } from "./chunk-VWPEKOH6.js";
12
+ } from "./chunk-DRK3MEDS.js";
13
13
  import {
14
14
  FromStringShapeDeserializer,
15
15
  NormalizedSchema
16
- } from "./chunk-W73X43R7.js";
16
+ } from "./chunk-3NQQXMDR.js";
17
17
  import {
18
18
  toUtf8
19
- } from "./chunk-JYGD5WSN.js";
19
+ } from "./chunk-ZWLDLTJP.js";
20
20
 
21
21
  // ../../node_modules/@smithy/signature-v4/dist-es/signature-v4a-container.js
22
22
  var signatureV4aContainer = {
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env sh
2
- ":" //# ; exec "$(command -v bun || command -v node)" "$0" "$@"
2
+ ":" //# ; exec "$(command -v node || command -v bun)" "$0" "$@"
3
3
  import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  collectBodyString
7
- } from "./chunk-EI575GHN.js";
7
+ } from "./chunk-PDW4L3NV.js";
8
8
  import {
9
9
  ProtocolLib,
10
10
  SerdeContextConfig,
11
11
  UnionSerde
12
- } from "./chunk-IXCHURVK.js";
12
+ } from "./chunk-DOD2BXHQ.js";
13
13
  import {
14
14
  HttpBindingProtocol,
15
15
  HttpInterceptingShapeDeserializer,
16
16
  HttpInterceptingShapeSerializer,
17
17
  NormalizedSchema,
18
18
  determineTimestampFormat
19
- } from "./chunk-W73X43R7.js";
19
+ } from "./chunk-3NQQXMDR.js";
20
20
  import {
21
21
  LazyJsonString,
22
22
  NumericValue,
@@ -27,7 +27,7 @@ import {
27
27
  parseRfc3339DateTimeWithOffset,
28
28
  parseRfc7231DateTime,
29
29
  toBase64
30
- } from "./chunk-JYGD5WSN.js";
30
+ } from "./chunk-ZWLDLTJP.js";
31
31
 
32
32
  // ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js
33
33
  function jsonReviver(key, value, context) {
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env sh
2
- ":" //# ; exec "$(command -v bun || command -v node)" "$0" "$@"
2
+ ":" //# ; exec "$(command -v node || command -v bun)" "$0" "$@"
3
3
  import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
 
@@ -1,14 +1,21 @@
1
1
  #!/usr/bin/env sh
2
- ":" //# ; exec "$(command -v bun || command -v node)" "$0" "$@"
2
+ ":" //# ; exec "$(command -v node || command -v bun)" "$0" "$@"
3
3
  import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  LocalExecutor
7
- } from "./chunk-TYVME3XD.js";
7
+ } from "./chunk-6FH4AXVY.js";
8
+ import {
9
+ explainEdgeDown,
10
+ isEdgeDownFailure
11
+ } from "./chunk-I3DPMTSF.js";
12
+ import {
13
+ edgeFailureReason
14
+ } from "./chunk-VZ2ZHPS2.js";
8
15
  import {
9
16
  logEntry,
10
17
  sq
11
- } from "./chunk-FPRHYBY2.js";
18
+ } from "./chunk-ZFJXPCQP.js";
12
19
 
13
20
  // ../../packages/adapters/src/system/docker-edge-executor.ts
14
21
  import Dockerode from "dockerode";
@@ -27,16 +34,52 @@ var DockerEdgeExecutor = class {
27
34
  this.docker = opts.docker ?? new Dockerode({ socketPath: opts.socketPath ?? DEFAULT_SOCKET });
28
35
  this.fileMode = opts.fileMode ?? "mounted";
29
36
  }
37
+ /**
38
+ * Why the edge refused (or couldn't answer) a command, in one operator-facing
39
+ * line — the dockerode counterpart of `edgeContainerExecutor`'s host-shell probe.
40
+ *
41
+ * Reads the state and the log through the daemon API rather than a shell, which is
42
+ * the whole reason `edgeFailureReason` is a pure parser: the two transports agree
43
+ * on what counts as the cause without sharing a channel. Best-effort — a probe
44
+ * that fails must not replace the real failure with an error about diagnosing it.
45
+ *
46
+ * The condition this exists for used to be reported as `(HTTP code 409) … container
47
+ * <64-hex-id> is not running`: the RESOLVED id, no name, no cause. During `openship
48
+ * up` migration that surfaced as six identical 409s against the edge's own id while
49
+ * it was still starting, and from the cert flow it surfaced as a container the
50
+ * operator had no reason to think was involved at all.
51
+ */
52
+ async explainDown(err) {
53
+ const message = err?.message ?? String(err);
54
+ const container = this.docker.getContainer(this.containerName);
55
+ const status = await container.inspect().then((info) => info.State?.Status ?? null).catch(() => null);
56
+ const logs = await container.logs({ stdout: true, stderr: true, tail: 40, follow: false }).then((out) => Buffer.isBuffer(out) ? out.toString("utf8") : String(out)).catch(() => null);
57
+ const explanation = explainEdgeDown({
58
+ container: this.containerName,
59
+ status,
60
+ reason: logs ? edgeFailureReason(logs) : null
61
+ });
62
+ return new Error(`${explanation}
63
+ ${message}`);
64
+ }
30
65
  /** Run one command inside the edge container, capturing stdout/stderr + exit. */
31
66
  async run(command) {
32
67
  const container = this.docker.getContainer(this.containerName);
33
- const exec = await container.exec({
34
- Cmd: ["/bin/sh", "-c", command],
35
- AttachStdout: true,
36
- AttachStderr: true,
37
- Tty: false
38
- });
39
- const stream = await exec.start({ stdin: false });
68
+ let exec;
69
+ let stream;
70
+ try {
71
+ exec = await container.exec({
72
+ Cmd: ["/bin/sh", "-c", command],
73
+ AttachStdout: true,
74
+ AttachStderr: true,
75
+ Tty: false
76
+ });
77
+ stream = await exec.start({ stdin: false });
78
+ } catch (err) {
79
+ const message = err?.message ?? String(err);
80
+ if (isEdgeDownFailure(message) || /\b409\b/.test(message)) throw await this.explainDown(err);
81
+ throw err instanceof Error ? err : new Error(message);
82
+ }
40
83
  const outStream = new PassThrough();
41
84
  const errStream = new PassThrough();
42
85
  let stdout = "";
@@ -61,6 +104,7 @@ var DockerEdgeExecutor = class {
61
104
  const { code, stdout, stderr } = await this.run(command);
62
105
  if (code !== 0) {
63
106
  const detail = [stderr.trim(), stdout.trim()].filter(Boolean).join("\n");
107
+ if (isEdgeDownFailure(detail)) throw await this.explainDown(new Error(detail));
64
108
  throw new Error(
65
109
  detail || `command exited ${code} in edge container ${this.containerName}`
66
110
  );
@@ -71,6 +115,12 @@ var DockerEdgeExecutor = class {
71
115
  const { code, stdout, stderr } = await this.run(command);
72
116
  const output = [stdout, stderr].filter(Boolean).join("");
73
117
  if (output) onLog(logEntry(output, code === 0 ? "info" : "error"));
118
+ if (code !== 0 && isEdgeDownFailure(output)) {
119
+ const explanation = (await this.explainDown(new Error(output))).message.split("\n")[0];
120
+ onLog(logEntry(explanation, "error"));
121
+ return { code, output: `${explanation}
122
+ ${output}` };
123
+ }
74
124
  return { code, output };
75
125
  }
76
126
  // ── File ops ─────────────────────────────────────────────────────────────
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env sh
2
- ":" //# ; exec "$(command -v bun || command -v node)" "$0" "$@"
2
+ ":" //# ; exec "$(command -v node || command -v bun)" "$0" "$@"
3
3
  import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  getTarCreateEnv,
7
7
  prepareSourceTarArgs
8
- } from "./chunk-OXWDY22G.js";
8
+ } from "./chunk-6ODUBKUB.js";
9
9
  import {
10
10
  TRANSFER_EXCLUDES,
11
11
  packageManagerEnsureCommand,
12
12
  safeErrorMessage
13
- } from "./chunk-6APULWSU.js";
13
+ } from "./chunk-OTLSJYAC.js";
14
14
 
15
15
  // ../../packages/adapters/src/runtime/git-clone.ts
16
16
  function sq(value) {