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
package/README.md CHANGED
@@ -35,6 +35,7 @@
35
35
  <a href="docs/i18n/README.pt.md"><img src="https://img.shields.io/badge/lang-Português-555" alt="Português" /></a>
36
36
  <a href="docs/i18n/README.de.md"><img src="https://img.shields.io/badge/lang-Deutsch-555" alt="Deutsch" /></a>
37
37
  <a href="docs/i18n/README.tr.md"><img src="https://img.shields.io/badge/lang-Türkçe-555" alt="Türkçe" /></a>
38
+ <a href="docs/i18n/README.ko.md"><img src="https://img.shields.io/badge/lang-한국어-555" alt="한국어" /></a>
38
39
  </p>
39
40
 
40
41
  <p align="center">
@@ -5,17 +5,17 @@ const require = __ospCreateRequire(import.meta.url);
5
5
  import {
6
6
  BareRuntime,
7
7
  STATIC_RELEASE_BASE
8
- } from "./chunk-VDMQJHPI.js";
9
- import "./chunk-MZ2WEHHY.js";
10
- import "./chunk-L2VOGB2X.js";
11
- import "./chunk-4Z5QO7N6.js";
12
- import "./chunk-XPPZ7B2J.js";
13
- import "./chunk-OXWDY22G.js";
8
+ } from "./chunk-YWMODKWL.js";
9
+ import "./chunk-KNTJ7PSF.js";
10
+ import "./chunk-KZOBYJUW.js";
11
+ import "./chunk-I6PSTQIR.js";
12
+ import "./chunk-K2RPVGPN.js";
13
+ import "./chunk-ZCOQJCZO.js";
14
14
  import "./chunk-RPHRPFEH.js";
15
15
  import "./chunk-TYVME3XD.js";
16
16
  import "./chunk-FPRHYBY2.js";
17
17
  import "./chunk-ILFETZOM.js";
18
- import "./chunk-6APULWSU.js";
18
+ import "./chunk-UMQP7SYT.js";
19
19
  import "./chunk-KI2EY3WB.js";
20
20
  export {
21
21
  BareRuntime,
@@ -14,6 +14,15 @@ import {
14
14
  import Dockerode from "dockerode";
15
15
  import { PassThrough } from "stream";
16
16
  var DEFAULT_SOCKET = "/var/run/docker.sock";
17
+ function explainEdgeExecError(err, containerName) {
18
+ const msg = err?.message ?? String(err);
19
+ if (/is not running|not running|409/i.test(msg)) {
20
+ return new Error(
21
+ `edge container "${containerName}" is not running yet (still starting, or stopped) \u2014 wait for it to be up (docker start ${containerName}) and retry.`
22
+ );
23
+ }
24
+ return err instanceof Error ? err : new Error(msg);
25
+ }
17
26
  var WRITE_CHUNK = 6e4;
18
27
  var DockerEdgeExecutor = class {
19
28
  docker;
@@ -30,13 +39,19 @@ var DockerEdgeExecutor = class {
30
39
  /** Run one command inside the edge container, capturing stdout/stderr + exit. */
31
40
  async run(command) {
32
41
  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 });
42
+ let exec;
43
+ let stream;
44
+ try {
45
+ exec = await container.exec({
46
+ Cmd: ["/bin/sh", "-c", command],
47
+ AttachStdout: true,
48
+ AttachStderr: true,
49
+ Tty: false
50
+ });
51
+ stream = await exec.start({ stdin: false });
52
+ } catch (err) {
53
+ throw explainEdgeExecError(err, this.containerName);
54
+ }
40
55
  const outStream = new PassThrough();
41
56
  const errStream = new PassThrough();
42
57
  let stdout = "";
@@ -8,10 +8,10 @@ import {
8
8
  } from "./chunk-ILFETZOM.js";
9
9
  import {
10
10
  OPENRESTY_LUA_DIR
11
- } from "./chunk-VFINNTUL.js";
11
+ } from "./chunk-EAAGSQXN.js";
12
12
  import {
13
13
  AppError
14
- } from "./chunk-6APULWSU.js";
14
+ } from "./chunk-UMQP7SYT.js";
15
15
 
16
16
  // ../../packages/adapters/src/system/proxy/detect.ts
17
17
  var EDGE_PORTS = [80, 443];
@@ -65,7 +65,21 @@ function vhostLog(message, level = "info") {
65
65
  async function sanitizeEdgeVhosts(executor, sitesDir, onLog) {
66
66
  const script = [
67
67
  `for f in ${sq(sitesDir)}/*.conf; do`,
68
- ` [ -f "$f" ] || continue;`,
68
+ // A host-side vhost may be a symlink into /etc/nginx/sites-available. That
69
+ // target is deliberately not mounted in the edge container, so leaving the
70
+ // link here makes nginx's include glob fail at startup. Materialize valid
71
+ // links before the container mounts this directory; remove dangling ones.
72
+ ` [ -e "$f" ] || [ -L "$f" ] || continue;`,
73
+ ` if [ -L "$f" ]; then`,
74
+ ` if [ ! -e "$f" ]; then`,
75
+ ` echo "dropped-dangling-link $f"; rm -f "$f"; continue;`,
76
+ ` fi;`,
77
+ ` if cat "$f" > "$f.osh-link"; then`,
78
+ ` rm -f "$f"; mv "$f.osh-link" "$f"; echo "materialized-link $f";`,
79
+ ` else`,
80
+ ` rm -f "$f.osh-link"; echo "dropped-unreadable-link $f"; rm -f "$f"; continue;`,
81
+ ` fi;`,
82
+ ` fi;`,
69
83
  // A real server_name is anything that isn't the `_` wildcard.
70
84
  ` if ! grep -qE '^[[:space:]]*server_name[[:space:]]+[^_;[:space:]]' "$f"; then`,
71
85
  ` echo "dropped-catchall $f"; rm -f "$f"; continue;`,
@@ -82,6 +96,12 @@ async function sanitizeEdgeVhosts(executor, sitesDir, onLog) {
82
96
  onLog(vhostLog(`Dropped catch-all vhost ${file} \u2014 the edge image provides it.`, "warn"));
83
97
  } else if (action === "unset-default") {
84
98
  onLog(vhostLog(`Removed default_server from ${file} \u2014 the edge image owns it.`, "warn"));
99
+ } else if (action === "materialized-link") {
100
+ onLog(vhostLog(`Materialized linked edge vhost ${file} for the container mount.`, "warn"));
101
+ } else if (action === "dropped-dangling-link") {
102
+ onLog(vhostLog(`Dropped dangling edge vhost link ${file}.`, "warn"));
103
+ } else if (action === "dropped-unreadable-link") {
104
+ onLog(vhostLog(`Dropped unreadable edge vhost link ${file}.`, "warn"));
85
105
  }
86
106
  }
87
107
  }