openship 0.4.7 → 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.
- package/README.md +1 -0
- package/dist/{bare-2HYDXQEH.js → bare-VRGE5MXH.js} +7 -7
- package/dist/{chunk-TGIINPVM.js → chunk-6LKHXB6T.js} +22 -7
- package/dist/{chunk-R5BHFFAV.js → chunk-6PIYRG5I.js} +56 -17
- package/dist/{chunk-IMBD5PZ5.js → chunk-BS2AXYZX.js} +430 -86
- package/dist/{chunk-SJIFLLX4.js → chunk-CUJXGK7R.js} +321 -85
- package/dist/{chunk-VFINNTUL.js → chunk-EAAGSQXN.js} +23 -8
- package/dist/{chunk-4Z5QO7N6.js → chunk-I6PSTQIR.js} +2 -2
- package/dist/{chunk-XFCDYZUQ.js → chunk-JLKKYUZA.js} +31 -49
- package/dist/{chunk-4TJC4JZQ.js → chunk-K2RPVGPN.js} +23 -4
- package/dist/{chunk-MZ2WEHHY.js → chunk-KNTJ7PSF.js} +1 -1
- package/dist/{chunk-L2VOGB2X.js → chunk-KZOBYJUW.js} +1 -1
- package/dist/{chunk-IPYPMI3S.js → chunk-NNPEG6HM.js} +1 -1
- package/dist/{chunk-UXWAVM4C.js → chunk-NXFIRK2Z.js} +398 -112
- package/dist/{chunk-FXTBHTWY.js → chunk-RB35YN3J.js} +271 -35
- package/dist/{chunk-6APULWSU.js → chunk-UMQP7SYT.js} +429 -66
- package/dist/{chunk-V6AN6XLZ.js → chunk-V7BZMGOT.js} +123 -45
- package/dist/{chunk-VDMQJHPI.js → chunk-YWMODKWL.js} +67 -4
- package/dist/{chunk-OXWDY22G.js → chunk-ZCOQJCZO.js} +1 -1
- package/dist/{cloud-2KXREXMO.js → cloud-3M2WZ624.js} +12 -12
- package/dist/{detect-2XSCFFTF.js → detect-BAJMY6KM.js} +7 -5
- package/dist/{docker-LODK5Y2S.js → docker-2NGBRJFJ.js} +9 -7
- package/dist/{docker-edge-executor-VHW3JPJS.js → docker-edge-executor-5I4M5QT7.js} +1 -1
- package/dist/{edge-import-ZQ4Y5HEA.js → edge-import-RIWNEIXQ.js} +21 -19
- package/dist/{ensure-container-edge-ED25XL3Z.js → ensure-container-edge-3NSYKHRX.js} +6 -6
- package/dist/{executor-YPT6RH6O.js → executor-LOYMPU67.js} +3 -3
- package/dist/index.js +309 -338
- package/dist/{nginx-XWJAOGS4.js → nginx-QE4DOM5J.js} +4 -4
- package/dist/{openresty-lua-4WLGDSER.js → openresty-lua-BTAKECCF.js} +2 -2
- package/dist/server/index.js +51705 -45369
- package/dist/server/migrations/0073_project_volumes_object_storage.sql +3 -0
- package/dist/server/migrations/0074_project_compose_path.sql +1 -0
- package/dist/server/migrations/0075_service_command_argv.sql +1 -0
- package/dist/server/migrations/0076_rollback_retention.sql +17 -0
- package/dist/server/migrations/0077_domain_redirect.sql +13 -0
- package/dist/server/migrations/0078_grant_source_scope.sql +30 -0
- package/dist/server/migrations/0079_project_readiness.sql +18 -0
- package/dist/server/migrations/0080_deployment_error_classification.sql +26 -0
- package/dist/server/migrations/0081_project_readiness_repair.sql +34 -0
- package/dist/server/migrations/meta/_journal.json +63 -0
- package/dist/{setup-2DMFIA74.js → setup-KELALK7H.js} +7 -7
- 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-
|
|
8
|
+
} from "./chunk-NXFIRK2Z.js";
|
|
9
9
|
import {
|
|
10
10
|
createDockerBuildContext,
|
|
11
11
|
normalizeDockerRelativePath,
|
|
12
12
|
resolveDockerfileCandidates
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-V7BZMGOT.js";
|
|
14
14
|
import {
|
|
15
15
|
prepareStackOutput,
|
|
16
16
|
resolveProjectDir,
|
|
17
17
|
resolveStaticOutputPath,
|
|
18
18
|
runLocalBuild
|
|
19
|
-
} from "./chunk-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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:
|
|
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-
|
|
12
|
+
} from "./chunk-ZCOQJCZO.js";
|
|
13
13
|
import {
|
|
14
14
|
SshDisconnectedError
|
|
15
15
|
} from "./chunk-RPHRPFEH.js";
|
|
@@ -27,10 +27,10 @@ import {
|
|
|
27
27
|
TRANSFER_EXCLUDES,
|
|
28
28
|
formatBytes,
|
|
29
29
|
safeErrorMessage
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-UMQP7SYT.js";
|
|
31
31
|
|
|
32
32
|
// ../../packages/adapters/src/system/executor.ts
|
|
33
|
-
import { readFileSync } from "fs";
|
|
33
|
+
import { existsSync, readFileSync } from "fs";
|
|
34
34
|
|
|
35
35
|
// ../../packages/adapters/src/system/ssh-executor.ts
|
|
36
36
|
import { createReadStream } from "fs";
|
|
@@ -1508,6 +1508,18 @@ function createExecutor(ssh) {
|
|
|
1508
1508
|
function hostControlDisabled() {
|
|
1509
1509
|
return process.env.OPENSHIP_HOST_CONTROL?.trim().toLowerCase() === "false";
|
|
1510
1510
|
}
|
|
1511
|
+
function runningInContainer() {
|
|
1512
|
+
if (process.env.OPENSHIP_IN_CONTAINER?.trim().toLowerCase() === "true") return true;
|
|
1513
|
+
try {
|
|
1514
|
+
if (existsSync("/.dockerenv")) return true;
|
|
1515
|
+
} catch {
|
|
1516
|
+
}
|
|
1517
|
+
try {
|
|
1518
|
+
return /\b(docker|containerd|podman|kubepods)\b/.test(readFileSync("/proc/1/cgroup", "utf8"));
|
|
1519
|
+
} catch {
|
|
1520
|
+
return false;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1511
1523
|
function createHostExecutor() {
|
|
1512
1524
|
if (hostControlDisabled()) {
|
|
1513
1525
|
throw new Error(
|
|
@@ -1515,7 +1527,14 @@ function createHostExecutor() {
|
|
|
1515
1527
|
);
|
|
1516
1528
|
}
|
|
1517
1529
|
const host = process.env.OPENSHIP_HOST_SSH_HOST?.trim();
|
|
1518
|
-
if (!host)
|
|
1530
|
+
if (!host) {
|
|
1531
|
+
if (runningInContainer()) {
|
|
1532
|
+
throw new Error(
|
|
1533
|
+
"This operation targets the HOST machine, but no host channel is configured (OPENSHIP_HOST_SSH_HOST is unset) and Openship is running in a container \u2014 so it would have run inside the container instead, against the wrong filesystem. Re-run `openship up` to provision the host channel."
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
return localExecutor;
|
|
1537
|
+
}
|
|
1519
1538
|
const keyPath = process.env.OPENSHIP_HOST_SSH_KEY?.trim();
|
|
1520
1539
|
const portRaw = Number(process.env.OPENSHIP_HOST_SSH_PORT || "22");
|
|
1521
1540
|
const port = Number.isInteger(portRaw) && portRaw > 0 && portRaw < 65536 ? portRaw : 22;
|