openship 0.4.8 → 0.5.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 (42) hide show
  1. package/README.md +1 -0
  2. package/dist/{bare-JY5Y5ELU.js → bare-VRGE5MXH.js} +7 -7
  3. package/dist/{chunk-TGIINPVM.js → chunk-6LKHXB6T.js} +22 -7
  4. package/dist/{chunk-2D3I5G6P.js → chunk-6PIYRG5I.js} +23 -3
  5. package/dist/{chunk-BBHX7T4R.js → chunk-BS2AXYZX.js} +401 -76
  6. package/dist/{chunk-SJIFLLX4.js → chunk-CUJXGK7R.js} +321 -85
  7. package/dist/{chunk-VFINNTUL.js → chunk-EAAGSQXN.js} +23 -8
  8. package/dist/{chunk-4Z5QO7N6.js → chunk-I6PSTQIR.js} +2 -2
  9. package/dist/{chunk-5NYUCONN.js → chunk-JLKKYUZA.js} +31 -49
  10. package/dist/{chunk-XPPZ7B2J.js → chunk-K2RPVGPN.js} +2 -2
  11. package/dist/{chunk-MZ2WEHHY.js → chunk-KNTJ7PSF.js} +1 -1
  12. package/dist/{chunk-L2VOGB2X.js → chunk-KZOBYJUW.js} +1 -1
  13. package/dist/{chunk-GKHUSZCD.js → chunk-NNPEG6HM.js} +1 -1
  14. package/dist/{chunk-SLTYVHU7.js → chunk-NXFIRK2Z.js} +381 -72
  15. package/dist/{chunk-FXTBHTWY.js → chunk-RB35YN3J.js} +271 -35
  16. package/dist/{chunk-6APULWSU.js → chunk-UMQP7SYT.js} +429 -66
  17. package/dist/{chunk-V6AN6XLZ.js → chunk-V7BZMGOT.js} +123 -45
  18. package/dist/{chunk-VDMQJHPI.js → chunk-YWMODKWL.js} +67 -4
  19. package/dist/{chunk-OXWDY22G.js → chunk-ZCOQJCZO.js} +1 -1
  20. package/dist/{cloud-KYWY3RP4.js → cloud-3M2WZ624.js} +12 -12
  21. package/dist/{detect-AZLOHUFX.js → detect-BAJMY6KM.js} +3 -3
  22. package/dist/{docker-LODK5Y2S.js → docker-2NGBRJFJ.js} +9 -7
  23. package/dist/{docker-edge-executor-VHW3JPJS.js → docker-edge-executor-5I4M5QT7.js} +1 -1
  24. package/dist/{edge-import-ABUDKKJI.js → edge-import-RIWNEIXQ.js} +21 -19
  25. package/dist/{ensure-container-edge-SW6HENSG.js → ensure-container-edge-3NSYKHRX.js} +6 -6
  26. package/dist/{executor-XJ6RP4Q2.js → executor-LOYMPU67.js} +3 -3
  27. package/dist/index.js +269 -331
  28. package/dist/{nginx-3L4SIBJA.js → nginx-QE4DOM5J.js} +4 -4
  29. package/dist/{openresty-lua-4WLGDSER.js → openresty-lua-BTAKECCF.js} +2 -2
  30. package/dist/server/index.js +51643 -45322
  31. package/dist/server/migrations/0073_project_volumes_object_storage.sql +3 -0
  32. package/dist/server/migrations/0074_project_compose_path.sql +1 -0
  33. package/dist/server/migrations/0075_service_command_argv.sql +1 -0
  34. package/dist/server/migrations/0076_rollback_retention.sql +17 -0
  35. package/dist/server/migrations/0077_domain_redirect.sql +13 -0
  36. package/dist/server/migrations/0078_grant_source_scope.sql +30 -0
  37. package/dist/server/migrations/0079_project_readiness.sql +18 -0
  38. package/dist/server/migrations/0080_deployment_error_classification.sql +26 -0
  39. package/dist/server/migrations/0081_project_readiness_repair.sql +34 -0
  40. package/dist/server/migrations/meta/_journal.json +63 -0
  41. package/dist/{setup-NU6T2PDU.js → setup-KELALK7H.js} +7 -7
  42. package/package.json +1 -1
@@ -5,25 +5,25 @@ const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  checkGit,
7
7
  installGit
8
- } from "./chunk-SLTYVHU7.js";
8
+ } from "./chunk-NXFIRK2Z.js";
9
9
  import {
10
10
  createDockerBuildContext,
11
11
  normalizeDockerRelativePath,
12
12
  resolveDockerfileCandidates
13
- } from "./chunk-V6AN6XLZ.js";
13
+ } from "./chunk-V7BZMGOT.js";
14
14
  import {
15
15
  prepareStackOutput,
16
16
  resolveProjectDir,
17
17
  resolveStaticOutputPath,
18
18
  runLocalBuild
19
- } from "./chunk-MZ2WEHHY.js";
19
+ } from "./chunk-KNTJ7PSF.js";
20
20
  import {
21
21
  BuildLogger,
22
22
  injectGitToken,
23
23
  runBuildPipeline,
24
24
  sq,
25
25
  transferLocalDirectory
26
- } from "./chunk-4Z5QO7N6.js";
26
+ } from "./chunk-I6PSTQIR.js";
27
27
  import {
28
28
  isRuntimeNotFoundError
29
29
  } from "./chunk-RPHRPFEH.js";
@@ -34,8 +34,9 @@ import {
34
34
  buildOutputTransferExcludes,
35
35
  missingOutputDirectoryMessage,
36
36
  packageManagerEnsureCommand,
37
- safeErrorMessage
38
- } from "./chunk-6APULWSU.js";
37
+ safeErrorMessage,
38
+ shellSplitWords
39
+ } from "./chunk-UMQP7SYT.js";
39
40
 
40
41
  // ../../packages/adapters/src/runtime/cloud.ts
41
42
  import { readFile } from "fs/promises";
@@ -202,47 +203,7 @@ function parseJsonArray(value) {
202
203
  return null;
203
204
  }
204
205
  }
205
- function splitWords(value) {
206
- const words = [];
207
- let current = "";
208
- let inSingle = false;
209
- let inDouble = false;
210
- let escaped = false;
211
- for (const char of value.trim()) {
212
- if (escaped) {
213
- current += char;
214
- escaped = false;
215
- continue;
216
- }
217
- if (char === "\\") {
218
- escaped = true;
219
- continue;
220
- }
221
- if (char === "'" && !inDouble) {
222
- inSingle = !inSingle;
223
- continue;
224
- }
225
- if (char === '"' && !inSingle) {
226
- inDouble = !inDouble;
227
- continue;
228
- }
229
- if (/\s/.test(char) && !inSingle && !inDouble) {
230
- if (current) {
231
- words.push(current);
232
- current = "";
233
- }
234
- continue;
235
- }
236
- current += char;
237
- }
238
- if (escaped) {
239
- current += "\\";
240
- }
241
- if (current) {
242
- words.push(current);
243
- }
244
- return words;
245
- }
206
+ var splitWords = shellSplitWords;
246
207
  function shellQuote(value) {
247
208
  if (PATHLIKE_RE.test(value)) {
248
209
  return value;
@@ -752,6 +713,11 @@ function restartPolicyForWorkload(policy) {
752
713
  if (base === "on-failure") return "on-failure";
753
714
  return "always";
754
715
  }
716
+ function resolveCloudWorkloadCmd(opts) {
717
+ const { commandArgv, startCommand, workdir } = opts;
718
+ if (commandArgv != null) return commandArgv.length > 0 ? commandArgv : void 0;
719
+ return startCommand ? ["sh", "-c", `cd ${sq(workdir)} && ${startCommand}`] : void 0;
720
+ }
755
721
  function exposeTarget(port, serviceName, slug, domain = SYSTEM.DOMAINS.CLOUD_DOMAIN) {
756
722
  const service = `service "${serviceName}" on port ${port}`;
757
723
  return slug ? `${service} for slug "${slug}" (${slug}.${domain})` : service;
@@ -839,13 +805,18 @@ var CloudComposeSupport = class {
839
805
  const port = config.publicPort ?? firstContainerPort(config.ports) ?? builtArtifact?.runtime.exposedPort;
840
806
  const workdir = builtArtifact?.runtime.workdir ?? "/";
841
807
  const startCommand = config.command ?? builtArtifact?.runtime.startCommand;
808
+ const workloadCmd = resolveCloudWorkloadCmd({
809
+ commandArgv: config.commandArgv,
810
+ startCommand,
811
+ workdir
812
+ });
842
813
  log({
843
814
  timestamp: now(),
844
815
  message: `Deploying cloud service "${config.serviceName}" in workspace ${workspaceId}...
845
816
  `,
846
817
  level: "info"
847
818
  });
848
- if (startCommand) {
819
+ if (workloadCmd) {
849
820
  log({
850
821
  timestamp: now(),
851
822
  message: `Creating workload for service "${config.serviceName}"...
@@ -861,7 +832,7 @@ var CloudComposeSupport = class {
861
832
  ws.workloads.create({
862
833
  id: "app",
863
834
  name: "app",
864
- cmd: ["sh", "-c", `cd ${sq(workdir)} && ${startCommand}`],
835
+ cmd: workloadCmd,
865
836
  working_dir: workdir,
866
837
  env: [...toEnvArray(runtimeEnv), ...port ? [`PORT=${port}`] : []],
867
838
  restart_policy: restartPolicyForWorkload(config.restart),
@@ -1412,6 +1383,9 @@ var CloudRuntime = class {
1412
1383
  "usage",
1413
1384
  "containerIp",
1414
1385
  "rollback",
1386
+ // One workspace per deployment, stopped-not-deleted on archive, so its
1387
+ // disk is still there to start back up (see makeActive).
1388
+ "unitRestore",
1415
1389
  "serviceShell",
1416
1390
  "inContainerExec"
1417
1391
  ]);
@@ -2259,6 +2233,14 @@ var CloudRuntime = class {
2259
2233
  const ws = this.ws(workspaceId);
2260
2234
  const log = onLog ?? (() => {
2261
2235
  });
2236
+ if (config.volumes?.length) {
2237
+ log({
2238
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2239
+ level: "warn",
2240
+ message: `Persistent storage (${config.volumes.join(", ")}) is not supported on Openship Cloud \u2014 the workspace disk is the only durable storage. Use object storage for uploads, or deploy to a server.
2241
+ `
2242
+ });
2243
+ }
2262
2244
  try {
2263
2245
  await ws.lifecycle.makePermanent();
2264
2246
  } catch (err) {
@@ -9,7 +9,7 @@ import {
9
9
  openSshUnixSocket,
10
10
  prepareSourceTarArgs,
11
11
  reconcileKnownHosts
12
- } from "./chunk-OXWDY22G.js";
12
+ } from "./chunk-ZCOQJCZO.js";
13
13
  import {
14
14
  SshDisconnectedError
15
15
  } from "./chunk-RPHRPFEH.js";
@@ -27,7 +27,7 @@ import {
27
27
  TRANSFER_EXCLUDES,
28
28
  formatBytes,
29
29
  safeErrorMessage
30
- } from "./chunk-6APULWSU.js";
30
+ } from "./chunk-UMQP7SYT.js";
31
31
 
32
32
  // ../../packages/adapters/src/system/executor.ts
33
33
  import { existsSync, readFileSync } from "fs";
@@ -6,7 +6,7 @@ import {
6
6
  detectBuildKillHint,
7
7
  runBuildPipeline,
8
8
  transferLocalDirectory
9
- } from "./chunk-4Z5QO7N6.js";
9
+ } from "./chunk-I6PSTQIR.js";
10
10
  import {
11
11
  LocalExecutor
12
12
  } from "./chunk-TYVME3XD.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-RPHRPFEH.js";
10
10
  import {
11
11
  safeErrorMessage
12
- } from "./chunk-6APULWSU.js";
12
+ } from "./chunk-UMQP7SYT.js";
13
13
 
14
14
  // ../../packages/adapters/src/system/environment.ts
15
15
  var profileCache = /* @__PURE__ */ new WeakMap();
@@ -6,7 +6,7 @@ import {
6
6
  COMPONENT_INSTALLERS,
7
7
  checkAll,
8
8
  checkComponents
9
- } from "./chunk-SLTYVHU7.js";
9
+ } from "./chunk-NXFIRK2Z.js";
10
10
 
11
11
  // ../../packages/adapters/src/system/state.ts
12
12
  var DEFAULT_STATE_PATH = "/etc/openship/setup-state.json";