openship 0.6.9 → 0.7.1

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 (62) hide show
  1. package/dist/bare-AB4SMTNJ.js +29 -0
  2. package/dist/{chunk-P7RCYELG.js → chunk-2BAKEGGF.js} +1 -1
  3. package/dist/{chunk-VAI5VOOI.js → chunk-2YAY5XHK.js} +1 -1
  4. package/dist/{chunk-X53JXRS4.js → chunk-37XZTLBJ.js} +3 -3
  5. package/dist/{chunk-R5DC5PEF.js → chunk-3K65MMYV.js} +39 -10
  6. package/dist/{chunk-D3OEMXYP.js → chunk-3WBKLDGC.js} +12 -7
  7. package/dist/{chunk-ENKJ7XIF.js → chunk-3YSSXSC2.js} +12 -12
  8. package/dist/{chunk-3MP6ACKM.js → chunk-7MCPDYKP.js} +799 -165
  9. package/dist/{chunk-D6HU4VUZ.js → chunk-7TQP6723.js} +2 -2
  10. package/dist/{chunk-SK4FFCFR.js → chunk-AMADTKC6.js} +1 -1
  11. package/dist/{chunk-NPSRGIHV.js → chunk-B2BQX6JX.js} +6 -5
  12. package/dist/{chunk-MUWVC5R4.js → chunk-BBPKAQ54.js} +12 -9
  13. package/dist/{chunk-WEZFTL4V.js → chunk-COI4VFRW.js} +217 -2
  14. package/dist/{chunk-5DJOB7IX.js → chunk-CQ2JOXEQ.js} +3 -3
  15. package/dist/{chunk-7PEXM2UI.js → chunk-DQR5TPFB.js} +6 -6
  16. package/dist/{chunk-IAMOUDHY.js → chunk-ETK6IBCH.js} +24 -15
  17. package/dist/{chunk-T46BQOLY.js → chunk-FNWNUYS3.js} +3 -3
  18. package/dist/{chunk-UAWY6X7V.js → chunk-GPTBEPUE.js} +485 -67
  19. package/dist/{chunk-634DDFT5.js → chunk-H36ASAYI.js} +8 -8
  20. package/dist/{chunk-AHJYP7DG.js → chunk-IVMPA6RC.js} +74 -17
  21. package/dist/{chunk-5UXHT6ED.js → chunk-IXBOV7BE.js} +113 -20
  22. package/dist/{chunk-GNOMEMNI.js → chunk-KATXZ5AB.js} +1 -1
  23. package/dist/{chunk-T6DVUX4F.js → chunk-KCMEWNP7.js} +14 -3
  24. package/dist/{chunk-N5YZMO33.js → chunk-L4DRH6ZA.js} +12 -1
  25. package/dist/{chunk-BO6CY4V2.js → chunk-NF7NQOAP.js} +47 -4
  26. package/dist/{chunk-FCGJN5Q5.js → chunk-NIOLZENU.js} +9 -9
  27. package/dist/{chunk-7YBWXEM6.js → chunk-OEYXXSAM.js} +4 -4
  28. package/dist/{chunk-6GU6JSK6.js → chunk-S5GU345P.js} +3 -3
  29. package/dist/{chunk-TAZZZKYO.js → chunk-TKK5NPDQ.js} +2 -2
  30. package/dist/{chunk-NUT6HKK6.js → chunk-WG5PDWZ3.js} +5 -5
  31. package/dist/{chunk-NIYD7MD2.js → chunk-XJSLJLNY.js} +90 -46
  32. package/dist/{cloud-REV3DPJH.js → cloud-T2JOFEQL.js} +20 -20
  33. package/dist/{detect-BBFT5GEU.js → detect-SWLZURYX.js} +5 -5
  34. package/dist/{docker-EG3QSE6I.js → docker-SQNZRZXN.js} +11 -11
  35. package/dist/{docker-edge-executor-E5TOTLMR.js → docker-edge-executor-BSSQQS76.js} +8 -8
  36. package/dist/{edge-import-YJVJUGYC.js → edge-import-LUDX77C2.js} +27 -27
  37. package/dist/{edge-preflight-QUW4BM7N.js → edge-preflight-JAEFWBRI.js} +14 -14
  38. package/dist/{ensure-container-edge-FOEFQ3PI.js → ensure-container-edge-U7FTLFVJ.js} +12 -12
  39. package/dist/{executor-NTWDJ3DB.js → executor-GYRZ7RIU.js} +7 -7
  40. package/dist/host-channel-preflight-U4IZCRXR.js +54 -0
  41. package/dist/index.js +72 -50
  42. package/dist/{local-executor-OQ2GRN7K.js → local-executor-JCR46VAP.js} +3 -3
  43. package/dist/{nginx-4U4C2XUS.js → nginx-YA6IRPJT.js} +10 -10
  44. package/dist/{openresty-lua-LLWT5XQW.js → openresty-lua-DUOB64TP.js} +8 -8
  45. package/dist/{privilege-MNDVMDST.js → privilege-4B2TMVW2.js} +6 -6
  46. package/dist/server/index.js +13286 -5381
  47. package/dist/server/lua/site_logger.lua +18 -1
  48. package/dist/server/migrations/0117_github_installation_workspace_scope.sql +24 -0
  49. package/dist/server/migrations/0118_git_sources.sql +66 -0
  50. package/dist/server/migrations/0119_backup_run_batch.sql +8 -0
  51. package/dist/server/migrations/0120_domain_primary_unique.sql +24 -0
  52. package/dist/server/migrations/0121_host_port_claim_overlap.sql +14 -0
  53. package/dist/server/migrations/0122_data_transfer_staging.sql +45 -0
  54. package/dist/server/migrations/meta/_journal.json +42 -0
  55. package/dist/setup-T3WN3HRS.js +25 -0
  56. package/dist/{ssh-client-2XWZCMGI.js → ssh-client-FZDWP5PQ.js} +3 -3
  57. package/dist/up-U73RUN5R.js +61 -0
  58. package/package.json +1 -1
  59. package/dist/bare-FA66N7GC.js +0 -29
  60. package/dist/host-channel-preflight-OI2TRHSG.js +0 -54
  61. package/dist/setup-IFIMPQZJ.js +0 -25
  62. package/dist/up-RC5ZQIAD.js +0 -61
@@ -0,0 +1,29 @@
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
+ BareRuntime,
7
+ STATIC_RELEASE_BASE
8
+ } from "./chunk-3YSSXSC2.js";
9
+ import "./chunk-CQ2JOXEQ.js";
10
+ import "./chunk-AMADTKC6.js";
11
+ import "./chunk-IVMPA6RC.js";
12
+ import "./chunk-GPTBEPUE.js";
13
+ import "./chunk-R4VDPFLS.js";
14
+ import "./chunk-2YAY5XHK.js";
15
+ import "./chunk-TKK5NPDQ.js";
16
+ import "./chunk-KCMEWNP7.js";
17
+ import "./chunk-FNWNUYS3.js";
18
+ import "./chunk-KATXZ5AB.js";
19
+ import "./chunk-B2BQX6JX.js";
20
+ import "./chunk-2BAKEGGF.js";
21
+ import "./chunk-NF7NQOAP.js";
22
+ import "./chunk-7TQP6723.js";
23
+ import "./chunk-L4DRH6ZA.js";
24
+ import "./chunk-COI4VFRW.js";
25
+ import "./chunk-PXKCZB2I.js";
26
+ export {
27
+ BareRuntime,
28
+ STATIC_RELEASE_BASE
29
+ };
@@ -4,7 +4,7 @@ import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  shellQuote
7
- } from "./chunk-WEZFTL4V.js";
7
+ } from "./chunk-COI4VFRW.js";
8
8
 
9
9
  // ../../packages/adapters/src/system/local-shell.ts
10
10
  import { execFile } from "child_process";
@@ -4,7 +4,7 @@ import { createRequire as __ospCreateRequire } from "node:module";
4
4
  const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  PACKAGE_ROOT_ONLY_EXCLUDES
7
- } from "./chunk-WEZFTL4V.js";
7
+ } from "./chunk-COI4VFRW.js";
8
8
 
9
9
  // ../../packages/adapters/src/archive.ts
10
10
  import { execFile } from "child_process";
@@ -6,7 +6,7 @@ import {
6
6
  describeProcess,
7
7
  probeListeningPort,
8
8
  waitForPortFree
9
- } from "./chunk-BO6CY4V2.js";
9
+ } from "./chunk-NF7NQOAP.js";
10
10
  import {
11
11
  EDGE_CONTAINER_NAME,
12
12
  classifyProxy,
@@ -16,11 +16,11 @@ import {
16
16
  resolveContainerPublishingPort,
17
17
  stopContainerDurably,
18
18
  tryExec
19
- } from "./chunk-D6HU4VUZ.js";
19
+ } from "./chunk-7TQP6723.js";
20
20
  import {
21
21
  AppError,
22
22
  shellQuote
23
- } from "./chunk-WEZFTL4V.js";
23
+ } from "./chunk-COI4VFRW.js";
24
24
 
25
25
  // ../../packages/adapters/src/system/proxy/detect.ts
26
26
  var EDGE_PORTS = [80, 443];
@@ -7,7 +7,36 @@ import {
7
7
  COMPONENT_INSTALLERS,
8
8
  checkAll,
9
9
  checkComponents
10
- } from "./chunk-NIYD7MD2.js";
10
+ } from "./chunk-XJSLJLNY.js";
11
+
12
+ // ../../packages/adapters/src/system/requirements.ts
13
+ var REMOTE_SERVER_REQUIRED_COMPONENTS = ["docker", "git"];
14
+ var SYSTEM_COMPONENT_DEPENDENCIES = {
15
+ // The managed edge is always the openship-edge container. There is no
16
+ // host-OpenResty fallback, so Docker must be ready before any edge image work.
17
+ edge: ["docker"]
18
+ };
19
+ function getSystemComponentDependencies(name) {
20
+ return SYSTEM_COMPONENT_DEPENDENCIES[name] ?? [];
21
+ }
22
+ function resolveSystemComponentInstallPlan(requested) {
23
+ const ordered = [];
24
+ const resolved = /* @__PURE__ */ new Set();
25
+ const visiting = /* @__PURE__ */ new Set();
26
+ const visit = (name) => {
27
+ if (resolved.has(name)) return;
28
+ if (visiting.has(name)) {
29
+ throw new Error(`Cyclic system component dependency involving "${name}"`);
30
+ }
31
+ visiting.add(name);
32
+ for (const dependency of getSystemComponentDependencies(name)) visit(dependency);
33
+ visiting.delete(name);
34
+ resolved.add(name);
35
+ ordered.push(name);
36
+ };
37
+ for (const name of requested) visit(name);
38
+ return ordered;
39
+ }
11
40
 
12
41
  // ../../packages/adapters/src/system/state.ts
13
42
  var DEFAULT_STATE_PATH = "/etc/openship/setup-state.json";
@@ -50,14 +79,12 @@ function resolveRules(mode) {
50
79
  }
51
80
  return [
52
81
  { feature: "build", requires: ["git"], message: "Build requires Git" },
53
- // Even in bare RUNTIME mode (apps run as host processes) the edge itself is a
54
- // container — its installer needs Docker and says so.
55
82
  { feature: "routing", requires: ["edge"], message: "Routing requires the edge" },
56
83
  { feature: "ssl", requires: ["edge"], message: "SSL requires the edge" }
57
84
  ];
58
85
  }
59
- function resolveRequired(mode) {
60
- return mode === "docker" ? ["docker", "git", "edge"] : ["git", "edge"];
86
+ function resolveRequired() {
87
+ return resolveSystemComponentInstallPlan([...REMOTE_SERVER_REQUIRED_COMPONENTS, "edge"]);
61
88
  }
62
89
  var SystemManager = class {
63
90
  mode;
@@ -76,7 +103,7 @@ var SystemManager = class {
76
103
  this.mode = mode;
77
104
  this.executor = opts.executor;
78
105
  this.rules = resolveRules(mode);
79
- this.required = resolveRequired(mode);
106
+ this.required = resolveRequired();
80
107
  this.stateStore = opts.stateStore ?? new FileStateStore(opts.executor);
81
108
  this.installerConfig = opts.installerConfig ?? {};
82
109
  this.provisionLock = opts.provisionLock;
@@ -140,9 +167,10 @@ var SystemManager = class {
140
167
  if (!rule) {
141
168
  return { feature, ready: true, missing: [], message: `No prerequisites for "${feature}"` };
142
169
  }
170
+ const required = resolveSystemComponentInstallPlan(rule.requires);
143
171
  const state = await this.loadState();
144
172
  if (state?.setupComplete) {
145
- const allPresent = rule.requires.every(
173
+ const allPresent = required.every(
146
174
  (name) => state.components[name]?.healthy === true
147
175
  );
148
176
  if (allPresent) {
@@ -150,7 +178,7 @@ var SystemManager = class {
150
178
  return { feature, ready: true, missing: [], message: `${feature} is ready` };
151
179
  }
152
180
  }
153
- const statuses = await checkComponents(this.executor, rule.requires);
181
+ const statuses = await checkComponents(this.executor, required);
154
182
  const unhealthy = statuses.filter((s) => !s.healthy);
155
183
  return {
156
184
  feature,
@@ -401,8 +429,9 @@ var SystemManager = class {
401
429
  return { installed, failed };
402
430
  }
403
431
  async ensureNamedComponents(names, logFn, installerConfig, heading, errorMessage) {
432
+ const required = resolveSystemComponentInstallPlan(names);
404
433
  const critical = async () => {
405
- const statuses = await checkComponents(this.executor, names);
434
+ const statuses = await checkComponents(this.executor, required);
406
435
  const missing = statuses.filter((status) => !status.healthy);
407
436
  if (missing.length === 0) {
408
437
  await this.updateStateFromChecks(statuses);
@@ -419,7 +448,7 @@ var SystemManager = class {
419
448
  if (failed.length > 0) {
420
449
  throw new Error(failed[0].error ?? `Failed to install ${failed[0].component}`);
421
450
  }
422
- const recheck = await checkComponents(this.executor, names);
451
+ const recheck = await checkComponents(this.executor, required);
423
452
  await this.updateStateFromChecks(recheck);
424
453
  const unhealthy = recheck.filter((status) => !status.healthy);
425
454
  if (unhealthy.length > 0) {
@@ -8,14 +8,14 @@ import {
8
8
  } from "./chunk-I3DPMTSF.js";
9
9
  import {
10
10
  LocalExecutor
11
- } from "./chunk-T6DVUX4F.js";
11
+ } from "./chunk-KCMEWNP7.js";
12
12
  import {
13
13
  logEntry,
14
14
  sq
15
- } from "./chunk-P7RCYELG.js";
15
+ } from "./chunk-2BAKEGGF.js";
16
16
  import {
17
17
  edgeFailureReason
18
- } from "./chunk-X53JXRS4.js";
18
+ } from "./chunk-37XZTLBJ.js";
19
19
 
20
20
  // ../../packages/adapters/src/system/docker-edge-executor.ts
21
21
  import Dockerode from "dockerode";
@@ -135,18 +135,23 @@ ${output}` };
135
135
  const { code, stderr } = await this.run(`mv ${sq(from)} ${sq(to)}`);
136
136
  if (code !== 0) throw new Error(stderr.trim() || `Failed to rename ${from}`);
137
137
  }
138
- async writeFile(path, content) {
139
- if (this.fileMode === "mounted") return this.files.writeFile(path, content);
138
+ async writeFile(path, content, opts) {
139
+ if (this.fileMode === "mounted") {
140
+ return opts === void 0 ? this.files.writeFile(path, content) : this.files.writeFile(path, content, opts);
141
+ }
140
142
  const encoded = Buffer.from(content, "utf8").toString("base64");
141
143
  const dir = path.replace(/\/[^/]*$/, "");
142
144
  if (dir && dir !== path) await this.exec(`mkdir -p ${sq(dir)}`);
145
+ if (opts?.mode !== void 0) {
146
+ await this.exec(`: > ${sq(path)} && chmod ${opts.mode.toString(8)} ${sq(path)}`);
147
+ }
143
148
  if (encoded.length === 0) {
144
- await this.exec(`: > ${sq(path)}`);
149
+ if (opts?.mode === void 0) await this.exec(`: > ${sq(path)}`);
145
150
  return;
146
151
  }
147
152
  for (let offset = 0; offset < encoded.length; offset += WRITE_CHUNK) {
148
153
  const chunk = encoded.slice(offset, offset + WRITE_CHUNK);
149
- const redirect = offset === 0 ? ">" : ">>";
154
+ const redirect = offset === 0 && opts?.mode === void 0 ? ">" : ">>";
150
155
  await this.exec(`printf '%s' ${sq(chunk)} | base64 -d ${redirect} ${sq(path)}`);
151
156
  }
152
157
  }
@@ -7,11 +7,11 @@ import {
7
7
  resolveProjectDir,
8
8
  resolveStaticOutputPath,
9
9
  runLocalBuild
10
- } from "./chunk-5DJOB7IX.js";
10
+ } from "./chunk-CQ2JOXEQ.js";
11
11
  import {
12
12
  isArtifactPathRef,
13
13
  removeManagedArtifact
14
- } from "./chunk-SK4FFCFR.js";
14
+ } from "./chunk-AMADTKC6.js";
15
15
  import {
16
16
  BuildCancelledError,
17
17
  BuildLogger,
@@ -24,42 +24,42 @@ import {
24
24
  splitRuntimeEnv,
25
25
  sq,
26
26
  transferLocalDirectory
27
- } from "./chunk-AHJYP7DG.js";
27
+ } from "./chunk-IVMPA6RC.js";
28
28
  import {
29
29
  LocalExecutor
30
- } from "./chunk-T6DVUX4F.js";
30
+ } from "./chunk-KCMEWNP7.js";
31
31
  import {
32
32
  privilegedExecutor
33
- } from "./chunk-T46BQOLY.js";
33
+ } from "./chunk-FNWNUYS3.js";
34
34
  import {
35
35
  HOST_STATE_DIR,
36
36
  envOps,
37
37
  hostRefusal,
38
38
  opScript
39
- } from "./chunk-GNOMEMNI.js";
39
+ } from "./chunk-KATXZ5AB.js";
40
40
  import {
41
41
  ensureOwnedDir,
42
42
  resolveEnvironment
43
- } from "./chunk-NPSRGIHV.js";
43
+ } from "./chunk-B2BQX6JX.js";
44
44
  import {
45
45
  sq as sq2,
46
46
  wrapLocalBuildCommand
47
- } from "./chunk-P7RCYELG.js";
47
+ } from "./chunk-2BAKEGGF.js";
48
48
  import {
49
49
  portOccupantDetails,
50
50
  probeListeningPort
51
- } from "./chunk-BO6CY4V2.js";
51
+ } from "./chunk-NF7NQOAP.js";
52
52
  import {
53
53
  managedDeploymentUnitName,
54
54
  probeExec,
55
55
  withReason
56
- } from "./chunk-D6HU4VUZ.js";
56
+ } from "./chunk-7TQP6723.js";
57
57
  import {
58
58
  formatDuration,
59
59
  isRemoteConnectionError,
60
60
  isRetryableRemoteConnectionError,
61
61
  systemDebug
62
- } from "./chunk-N5YZMO33.js";
62
+ } from "./chunk-L4DRH6ZA.js";
63
63
  import {
64
64
  DeployError,
65
65
  LANGUAGES,
@@ -73,7 +73,7 @@ import {
73
73
  refused,
74
74
  safeErrorMessage,
75
75
  shellQuote
76
- } from "./chunk-WEZFTL4V.js";
76
+ } from "./chunk-COI4VFRW.js";
77
77
 
78
78
  // ../../packages/adapters/src/system/remote-journal.ts
79
79
  var OPSH_RUN_VERSION = 1;