openship 0.6.0 → 0.6.5
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 +7 -2
- package/dist/{bare-FSUAM5V5.js → bare-XQIPDO4R.js} +10 -9
- package/dist/{chunk-PSZSKEPA.js → chunk-3ZAGC5NT.js} +64 -17
- package/dist/{chunk-6ODUBKUB.js → chunk-5OUWIPOB.js} +69 -7
- package/dist/chunk-6HOA5JT7.js +124 -0
- package/dist/{chunk-TWJCLD4W.js → chunk-6JELW75A.js} +4 -4
- package/dist/{chunk-GUQ3QCJ7.js → chunk-7334NSJL.js} +399 -369
- package/dist/chunk-7S4USQYF.js +1753 -0
- package/dist/{chunk-3LDWWY7U.js → chunk-A7EWM2KA.js} +41 -7
- package/dist/chunk-ELGRMZOW.js +25 -0
- package/dist/chunk-EZPPTWJQ.js +292 -0
- package/dist/{chunk-IXM5245F.js → chunk-GRTXMUHA.js} +553 -538
- package/dist/chunk-HPXP6LXZ.js +428 -0
- package/dist/{chunk-OTLSJYAC.js → chunk-LEYSL46B.js} +2135 -85
- package/dist/{chunk-EMXI4UCU.js → chunk-LFCSC4IU.js} +29 -10
- package/dist/{chunk-JIMUYEKN.js → chunk-MSZUCNPV.js} +1 -1
- package/dist/{chunk-OGY63DGD.js → chunk-PZRRL5PC.js} +71 -28
- package/dist/{chunk-VE2YOK4I.js → chunk-QLX7NBEA.js} +1218 -588
- package/dist/chunk-RFWJE7ZN.js +68 -0
- package/dist/{chunk-VDDMADOF.js → chunk-TM2IQPYU.js} +16 -2
- package/dist/{chunk-3FYIXVX5.js → chunk-VDESJSG6.js} +451 -106
- package/dist/{chunk-B3CE2OMR.js → chunk-VHMOQL5Y.js} +276 -50
- package/dist/{chunk-QEH4QUBX.js → chunk-VLQ3UIVO.js} +393 -53
- package/dist/{chunk-VZ2ZHPS2.js → chunk-WE7BXW6L.js} +3 -9
- package/dist/chunk-WFRXYWK2.js +444 -0
- package/dist/chunk-XRNRT37W.js +316 -0
- package/dist/{chunk-EP2TNALB.js → chunk-XVOBL7BC.js} +31 -8
- package/dist/cloud-3DODOWTR.js +36 -0
- package/dist/{detect-ALF4GXRX.js → detect-P4CIQBRH.js} +3 -3
- package/dist/{docker-QECQJ5P4.js → docker-3K2NEBD6.js} +15 -8
- package/dist/{docker-edge-executor-62N64MGS.js → docker-edge-executor-YZZ6P7IC.js} +5 -5
- package/dist/{edge-import-CQWHN2Q3.js → edge-import-MCJNVTZ2.js} +26 -23
- package/dist/edge-preflight-ES6FH4JK.js +42 -0
- package/dist/{ensure-container-edge-MJVXJQG5.js → ensure-container-edge-YPITNH45.js} +9 -8
- package/dist/{executor-JELARVKC.js → executor-DZGX55K2.js} +12 -5
- package/dist/host-channel-preflight-MUXE3KZU.js +49 -0
- package/dist/index.js +3668 -4063
- package/dist/{nginx-AXGNWRKZ.js → nginx-NSAHWGJV.js} +11 -5
- package/dist/node-bootstrap.js +241 -0
- package/dist/node-entry.js +52 -1
- package/dist/{openresty-lua-IE4P5YQX.js → openresty-lua-DR4D3EZ6.js} +6 -2
- package/dist/privilege-YTVI4SKF.js +19 -0
- package/dist/server/engine/samples/fail2ban/jail.d/sshd.local +4 -1
- package/dist/server/index.js +21501 -13137
- package/dist/server/lua/geo_country.lua +4 -3
- package/dist/server/lua/pipe_stream.lua +52 -39
- package/dist/server/lua/site_logger.lua +22 -24
- package/dist/server/migrations/0098_instance_product_mode.sql +12 -0
- package/dist/server/migrations/0099_mail_webmail_project.sql +24 -0
- package/dist/server/migrations/0100_server_ssh_private_key.sql +11 -0
- package/dist/server/migrations/0101_mail_resume_step.sql +12 -0
- package/dist/server/migrations/0102_project_workload_axes.sql +19 -0
- package/dist/server/migrations/0103_dns_credential.sql +41 -0
- package/dist/server/migrations/0104_instance_host_control.sql +15 -0
- package/dist/server/migrations/meta/_journal.json +49 -0
- package/dist/{setup-FA4PW4NU.js → setup-WUUZURHS.js} +10 -9
- package/dist/up-XEO3SR6Z.js +58 -0
- package/package.json +4 -2
- package/dist/chunk-IW2UKBVF.js +0 -144
- package/dist/chunk-ZCFVHA25.js +0 -89
- package/dist/cloud-E5M6VMCG.js +0 -31
- package/dist/server/lua/pipe_log.lua +0 -77
- /package/dist/{dist-es-JGBPABJI.js → dist-es-ZP5QDSJ3.js} +0 -0
|
@@ -5,25 +5,31 @@ const require = __ospCreateRequire(import.meta.url);
|
|
|
5
5
|
import {
|
|
6
6
|
MANAGED_STATIC_BASE,
|
|
7
7
|
NginxProvider,
|
|
8
|
+
VHOST_GENERATION,
|
|
8
9
|
acmeKeyArgs,
|
|
9
10
|
assertValidChallengeToken,
|
|
11
|
+
readVhostGeneration,
|
|
10
12
|
renderGeoEntries,
|
|
11
13
|
renderProxyOptions,
|
|
12
14
|
renderProxyTlsOptions,
|
|
13
15
|
summarizeCertbotFailure
|
|
14
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VLQ3UIVO.js";
|
|
15
17
|
import "./chunk-I3DPMTSF.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-WE7BXW6L.js";
|
|
19
|
+
import "./chunk-A7EWM2KA.js";
|
|
20
|
+
import "./chunk-PZRRL5PC.js";
|
|
21
|
+
import "./chunk-EZPPTWJQ.js";
|
|
22
|
+
import "./chunk-WFRXYWK2.js";
|
|
19
23
|
import "./chunk-ZFJXPCQP.js";
|
|
20
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-LEYSL46B.js";
|
|
21
25
|
import "./chunk-PXKCZB2I.js";
|
|
22
26
|
export {
|
|
23
27
|
MANAGED_STATIC_BASE,
|
|
24
28
|
NginxProvider,
|
|
29
|
+
VHOST_GENERATION,
|
|
25
30
|
acmeKeyArgs,
|
|
26
31
|
assertValidChallengeToken,
|
|
32
|
+
readVhostGeneration,
|
|
27
33
|
renderGeoEntries,
|
|
28
34
|
renderProxyOptions,
|
|
29
35
|
renderProxyTlsOptions,
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// src/node-bootstrap.ts
|
|
2
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
3
|
+
import { existsSync as existsSync2 } from "fs";
|
|
4
|
+
import { join as join4 } from "path";
|
|
5
|
+
import { createInterface } from "readline";
|
|
6
|
+
|
|
7
|
+
// src/lib/node-runtime.ts
|
|
8
|
+
import { execFileSync, spawnSync } from "child_process";
|
|
9
|
+
import { chmodSync, existsSync, lstatSync, mkdirSync as mkdirSync2, rmSync, symlinkSync, writeFileSync } from "fs";
|
|
10
|
+
import { join as join3 } from "path";
|
|
11
|
+
|
|
12
|
+
// src/lib/cache.ts
|
|
13
|
+
import { createHash } from "crypto";
|
|
14
|
+
import { createReadStream, createWriteStream, mkdirSync } from "fs";
|
|
15
|
+
import { dirname, join as join2 } from "path";
|
|
16
|
+
|
|
17
|
+
// src/lib/paths.ts
|
|
18
|
+
import { homedir } from "os";
|
|
19
|
+
import { join, resolve } from "path";
|
|
20
|
+
var DEFAULT_HOME = join(homedir(), ".openship");
|
|
21
|
+
var override = process.env.OPENSHIP_HOME?.trim();
|
|
22
|
+
var OS_DIR = override ? resolve(override) : DEFAULT_HOME;
|
|
23
|
+
var DATA_DIR = join(OS_DIR, "data");
|
|
24
|
+
var LOG_DIR = join(OS_DIR, "logs");
|
|
25
|
+
var AUTH_SECRET_FILE = join(OS_DIR, "auth-secret");
|
|
26
|
+
var INTERNAL_TOKEN_FILE = join(OS_DIR, "internal-token");
|
|
27
|
+
|
|
28
|
+
// src/lib/cache.ts
|
|
29
|
+
var CACHE_DIR = join2(OS_DIR, "cache");
|
|
30
|
+
var RELEASES_DIR = join2(CACHE_DIR, "releases");
|
|
31
|
+
async function downloadToFile(url, dest, onProgress) {
|
|
32
|
+
const res = await fetch(url, { headers: { "User-Agent": "openship-cli" } });
|
|
33
|
+
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} for ${url}`);
|
|
34
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
35
|
+
const total = Number(res.headers.get("content-length")) || 0;
|
|
36
|
+
const hash = createHash("sha256");
|
|
37
|
+
const file = createWriteStream(dest);
|
|
38
|
+
const reader = res.body.getReader();
|
|
39
|
+
let received = 0;
|
|
40
|
+
try {
|
|
41
|
+
for (; ; ) {
|
|
42
|
+
const { done, value } = await reader.read();
|
|
43
|
+
if (done) break;
|
|
44
|
+
hash.update(value);
|
|
45
|
+
if (!file.write(Buffer.from(value))) {
|
|
46
|
+
await new Promise((r) => file.once("drain", r));
|
|
47
|
+
}
|
|
48
|
+
received += value.length;
|
|
49
|
+
onProgress?.(received, total);
|
|
50
|
+
}
|
|
51
|
+
} finally {
|
|
52
|
+
file.end();
|
|
53
|
+
}
|
|
54
|
+
await new Promise((resolve2, reject) => {
|
|
55
|
+
file.on("finish", () => resolve2());
|
|
56
|
+
file.on("error", reject);
|
|
57
|
+
});
|
|
58
|
+
return { sha256: hash.digest("hex"), size: received };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/lib/node-runtime.ts
|
|
62
|
+
var NODE_MAJOR = 22;
|
|
63
|
+
var NODE_DIST = "https://nodejs.org/dist";
|
|
64
|
+
var RUNTIME_DIR = join3(OS_DIR, "runtime");
|
|
65
|
+
var RUNTIME_CURRENT = join3(RUNTIME_DIR, "current");
|
|
66
|
+
var BIN_DIR = join3(OS_DIR, "bin");
|
|
67
|
+
var LAUNCHER_PATH = join3(BIN_DIR, "openship");
|
|
68
|
+
var LAUNCHER_SH = `#!/bin/sh
|
|
69
|
+
# Openship CLI launcher \u2014 runs the tarball-installed CLI under Node.
|
|
70
|
+
# Managed by scripts/install.sh and \`openship update\`; manual edits are overwritten.
|
|
71
|
+
SELF="$0"
|
|
72
|
+
while [ -L "$SELF" ]; do
|
|
73
|
+
_t="$(readlink "$SELF")"
|
|
74
|
+
case "$_t" in /*) SELF="$_t" ;; *) SELF="$(dirname "$SELF")/$_t" ;; esac
|
|
75
|
+
done
|
|
76
|
+
BIN_DIR="$(cd "$(dirname "$SELF")" && pwd)"
|
|
77
|
+
HOME_DIR="$(dirname "$BIN_DIR")"
|
|
78
|
+
CLI="$HOME_DIR/cli/current/dist/index.js"
|
|
79
|
+
VENDORED_NODE="$HOME_DIR/runtime/current/bin/node"
|
|
80
|
+
# Prefer a system node >= ${NODE_MAJOR}; fall back to the vendored runtime.
|
|
81
|
+
if command -v node >/dev/null 2>&1 && node -e 'process.exit(+process.versions.node.split(".")[0]>=${NODE_MAJOR}?0:1)' 2>/dev/null; then
|
|
82
|
+
exec node "$CLI" "$@"
|
|
83
|
+
elif [ -x "$VENDORED_NODE" ]; then
|
|
84
|
+
exec "$VENDORED_NODE" "$CLI" "$@"
|
|
85
|
+
else
|
|
86
|
+
echo "openship: no Node >= ${NODE_MAJOR} found (system or vendored). Reinstall: curl -fsSL https://get.openship.io | sh" >&2
|
|
87
|
+
exit 127
|
|
88
|
+
fi
|
|
89
|
+
`;
|
|
90
|
+
function nodeDistOs() {
|
|
91
|
+
if (process.platform === "darwin") return "darwin";
|
|
92
|
+
if (process.platform === "linux") return "linux";
|
|
93
|
+
throw new Error(`Unsupported platform for vendored Node: ${process.platform}`);
|
|
94
|
+
}
|
|
95
|
+
function nodeDistArch() {
|
|
96
|
+
if (process.arch === "x64") return "x64";
|
|
97
|
+
if (process.arch === "arm64") return "arm64";
|
|
98
|
+
throw new Error(`Unsupported arch for vendored Node: ${process.arch}`);
|
|
99
|
+
}
|
|
100
|
+
function majorOf(bin) {
|
|
101
|
+
try {
|
|
102
|
+
const out = execFileSync(bin, ["-e", "process.stdout.write(process.versions.node)"], {
|
|
103
|
+
encoding: "utf8",
|
|
104
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
105
|
+
});
|
|
106
|
+
const m = Number(out.trim().split(".")[0]);
|
|
107
|
+
return Number.isInteger(m) ? m : null;
|
|
108
|
+
} catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function repoint(link, target) {
|
|
113
|
+
try {
|
|
114
|
+
if (lstatSync(link)) rmSync(link, { recursive: true, force: true });
|
|
115
|
+
} catch {
|
|
116
|
+
}
|
|
117
|
+
symlinkSync(target, link);
|
|
118
|
+
}
|
|
119
|
+
async function resolveLatestNode() {
|
|
120
|
+
const res = await fetch(`${NODE_DIST}/index.json`, {
|
|
121
|
+
headers: { "User-Agent": "openship-cli" },
|
|
122
|
+
signal: AbortSignal.timeout(15e3)
|
|
123
|
+
});
|
|
124
|
+
if (!res.ok) throw new Error(`Node dist index lookup failed: HTTP ${res.status}`);
|
|
125
|
+
const rows = await res.json();
|
|
126
|
+
const prefix = `v${NODE_MAJOR}.`;
|
|
127
|
+
const row = rows.find((r) => r.version.startsWith(prefix) && r.lts) ?? rows.find((r) => r.version.startsWith(prefix));
|
|
128
|
+
if (!row) throw new Error(`No Node ${NODE_MAJOR}.x release found on nodejs.org`);
|
|
129
|
+
return row.version;
|
|
130
|
+
}
|
|
131
|
+
async function fetchVendoredNode(onLog) {
|
|
132
|
+
const ver = await resolveLatestNode();
|
|
133
|
+
const os = nodeDistOs();
|
|
134
|
+
const arch = nodeDistArch();
|
|
135
|
+
const name = `node-${ver}-${os}-${arch}.tar.gz`;
|
|
136
|
+
mkdirSync2(RUNTIME_DIR, { recursive: true });
|
|
137
|
+
const tarball = join3(RUNTIME_DIR, name);
|
|
138
|
+
onLog?.(`Fetching Node ${ver} (${os}-${arch}) from nodejs.org\u2026`);
|
|
139
|
+
const { sha256 } = await downloadToFile(`${NODE_DIST}/${ver}/${name}`, tarball);
|
|
140
|
+
const shaRes = await fetch(`${NODE_DIST}/${ver}/SHASUMS256.txt`, {
|
|
141
|
+
headers: { "User-Agent": "openship-cli" },
|
|
142
|
+
signal: AbortSignal.timeout(15e3)
|
|
143
|
+
});
|
|
144
|
+
if (!shaRes.ok) {
|
|
145
|
+
rmSync(tarball, { force: true });
|
|
146
|
+
throw new Error(`Node checksum list fetch failed: HTTP ${shaRes.status}`);
|
|
147
|
+
}
|
|
148
|
+
const expected = (await shaRes.text()).split("\n").map((l) => l.trim()).find((l) => l.endsWith(` ${name}`) || l.endsWith(` ${name}`))?.split(/\s+/)[0]?.toLowerCase();
|
|
149
|
+
if (!expected) {
|
|
150
|
+
rmSync(tarball, { force: true });
|
|
151
|
+
throw new Error(`No checksum for ${name} in SHASUMS256.txt`);
|
|
152
|
+
}
|
|
153
|
+
if (expected !== sha256) {
|
|
154
|
+
rmSync(tarball, { force: true });
|
|
155
|
+
throw new Error(`Node download checksum mismatch (expected ${expected}, got ${sha256}).`);
|
|
156
|
+
}
|
|
157
|
+
const unpacked = join3(RUNTIME_DIR, `node-${ver}-${os}-${arch}`);
|
|
158
|
+
rmSync(unpacked, { recursive: true, force: true });
|
|
159
|
+
const untar = spawnSync("tar", ["-xzf", tarball, "-C", RUNTIME_DIR], { stdio: "inherit" });
|
|
160
|
+
if (untar.status !== 0) throw new Error("Failed to extract the Node runtime (is `tar` available?).");
|
|
161
|
+
rmSync(tarball, { force: true });
|
|
162
|
+
const nodeBin = join3(unpacked, "bin", "node");
|
|
163
|
+
if (!existsSync(nodeBin)) throw new Error(`Node unpacked but ${nodeBin} is missing (unexpected layout).`);
|
|
164
|
+
repoint(RUNTIME_CURRENT, unpacked);
|
|
165
|
+
return nodeBin;
|
|
166
|
+
}
|
|
167
|
+
async function ensureNodeRuntime(onLog) {
|
|
168
|
+
if ((majorOf("node") ?? 0) >= NODE_MAJOR) return { node: "node", source: "system" };
|
|
169
|
+
const existing = join3(RUNTIME_CURRENT, "bin", "node");
|
|
170
|
+
if (existsSync(existing) && (majorOf(existing) ?? 0) >= NODE_MAJOR) {
|
|
171
|
+
return { node: existing, source: "vendored" };
|
|
172
|
+
}
|
|
173
|
+
return { node: await fetchVendoredNode(onLog), source: "vendored" };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/node-bootstrap.ts
|
|
177
|
+
var NODE_REEXEC_ENV = "OPENSHIP_NODE_REEXEC";
|
|
178
|
+
var VENDOR_ENV = "OPENSHIP_VENDOR_NODE";
|
|
179
|
+
var vendoredNode = () => join4(OS_DIR, "runtime", "current", "bin", "node");
|
|
180
|
+
function majorOf2(bin) {
|
|
181
|
+
const out = spawnSync2(bin, ["-e", "process.stdout.write(process.versions.node)"], {
|
|
182
|
+
encoding: "utf8"
|
|
183
|
+
});
|
|
184
|
+
if (out.status !== 0) return 0;
|
|
185
|
+
return Number.parseInt(out.stdout.trim().split(".")[0] ?? "", 10) || 0;
|
|
186
|
+
}
|
|
187
|
+
function reexec(nodeBin, cliPath) {
|
|
188
|
+
const res = spawnSync2(nodeBin, [cliPath, ...process.argv.slice(2)], {
|
|
189
|
+
stdio: "inherit",
|
|
190
|
+
env: { ...process.env, [NODE_REEXEC_ENV]: "1" }
|
|
191
|
+
});
|
|
192
|
+
return { handled: true, status: res.status ?? 1 };
|
|
193
|
+
}
|
|
194
|
+
function isAffirmative(answer) {
|
|
195
|
+
return !/^n/i.test(answer.trim());
|
|
196
|
+
}
|
|
197
|
+
function ask(question) {
|
|
198
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
199
|
+
return new Promise((resolve2) => {
|
|
200
|
+
rl.question(question, (answer) => {
|
|
201
|
+
rl.close();
|
|
202
|
+
resolve2(isAffirmative(answer));
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
async function recoverOldNode(opts) {
|
|
207
|
+
const existing = vendoredNode();
|
|
208
|
+
if (existsSync2(existing) && majorOf2(existing) >= NODE_MAJOR) {
|
|
209
|
+
return reexec(existing, opts.cliPath);
|
|
210
|
+
}
|
|
211
|
+
if (!opts.offerDownload) return { handled: false };
|
|
212
|
+
if (process.platform === "win32") return { handled: false };
|
|
213
|
+
const forced = process.env[VENDOR_ENV]?.trim();
|
|
214
|
+
if (forced === "0") return { handled: false };
|
|
215
|
+
if (forced !== "1") {
|
|
216
|
+
if (!process.stdin.isTTY) return { handled: false };
|
|
217
|
+
const yes = await ask(
|
|
218
|
+
`
|
|
219
|
+
Openship can download its own Node ${NODE_MAJOR} (~50 MB) into ${OS_DIR}/runtime
|
|
220
|
+
and use it for Openship only \u2014 your system Node is left exactly as it is.
|
|
221
|
+
|
|
222
|
+
Download it now? [Y/n] `
|
|
223
|
+
);
|
|
224
|
+
if (!yes) return { handled: false };
|
|
225
|
+
}
|
|
226
|
+
let nodeBin;
|
|
227
|
+
try {
|
|
228
|
+
nodeBin = (await ensureNodeRuntime(opts.log)).node;
|
|
229
|
+
} catch (e) {
|
|
230
|
+
opts.log(`Could not set up Node ${NODE_MAJOR}: ${e.message}`);
|
|
231
|
+
return { handled: false };
|
|
232
|
+
}
|
|
233
|
+
if (nodeBin === "node") return { handled: false };
|
|
234
|
+
opts.log(`Using Node ${NODE_MAJOR} from ${OS_DIR}/runtime \u2014 future runs pick it up automatically.`);
|
|
235
|
+
return reexec(nodeBin, opts.cliPath);
|
|
236
|
+
}
|
|
237
|
+
export {
|
|
238
|
+
NODE_REEXEC_ENV,
|
|
239
|
+
isAffirmative,
|
|
240
|
+
recoverOldNode
|
|
241
|
+
};
|
package/dist/node-entry.js
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/node-entry.ts
|
|
4
|
-
import "
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
var HARD_FLOOR = 20;
|
|
6
|
+
var SUPPORTED = 22;
|
|
7
|
+
var INSTALLER = "curl -fsSL https://get.openship.io | sh";
|
|
8
|
+
var CLI_PATH = fileURLToPath(new URL("./index.js", import.meta.url));
|
|
9
|
+
var log = (msg) => process.stderr.write(`${msg}
|
|
10
|
+
`);
|
|
11
|
+
var runningBun = typeof process.versions.bun === "string";
|
|
12
|
+
var major = Number.parseInt(process.versions.node?.split(".")[0] ?? "", 10);
|
|
13
|
+
var reexeced = process.env.OPENSHIP_NODE_REEXEC === "1";
|
|
14
|
+
var tooOld = !runningBun && !reexeced && Number.isFinite(major) && major < SUPPORTED;
|
|
15
|
+
if (tooOld) {
|
|
16
|
+
try {
|
|
17
|
+
const { recoverOldNode } = await import("./node-bootstrap.js");
|
|
18
|
+
const outcome = await recoverOldNode({
|
|
19
|
+
cliPath: CLI_PATH,
|
|
20
|
+
// 20 and 21 DO run: reuse a Node already on disk, but don't prompt to download
|
|
21
|
+
// one on every invocation to fix a setup that already works.
|
|
22
|
+
offerDownload: major < HARD_FLOOR,
|
|
23
|
+
log
|
|
24
|
+
});
|
|
25
|
+
if (outcome.handled) process.exit(outcome.status ?? 0);
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
if (major < HARD_FLOOR) {
|
|
29
|
+
process.stderr.write(
|
|
30
|
+
`
|
|
31
|
+
Openship needs Node ${SUPPORTED} or newer \u2014 this is Node v${process.versions.node}.
|
|
32
|
+
|
|
33
|
+
Install Node ${SUPPORTED}+ and re-run, or use the official installer, which
|
|
34
|
+
brings its own Node and doesn't touch the one you have:
|
|
35
|
+
|
|
36
|
+
${INSTALLER}
|
|
37
|
+
|
|
38
|
+
Non-interactive (CI, a service)? Set OPENSHIP_VENDOR_NODE=1 and Openship
|
|
39
|
+
fetches its own Node ${SUPPORTED} without asking.
|
|
40
|
+
|
|
41
|
+
If you upgrade Node with a version manager (nvm, fnm, volta), global packages
|
|
42
|
+
live per Node version \u2014 reinstall the CLI afterwards or the command will go
|
|
43
|
+
missing: npm i -g openship
|
|
44
|
+
|
|
45
|
+
`
|
|
46
|
+
);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
process.stderr.write(
|
|
50
|
+
`Warning: Node v${process.versions.node} is below Openship's supported floor (Node ${SUPPORTED}+). It may work; it isn't tested. Upgrade, or install with:
|
|
51
|
+
${INSTALLER}
|
|
52
|
+
`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
await import("./index.js");
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
EDGE_HTTPS_REJECT_BLOCK,
|
|
19
19
|
EDGE_LUA_PACKAGE_PATH,
|
|
20
20
|
EDGE_MGMT_SERVER_BLOCK,
|
|
21
|
+
EDGE_SAME_PATH_MOUNTS,
|
|
21
22
|
EDGE_SERVER_NAMES_HASH_BUCKET_SIZE,
|
|
22
23
|
EDGE_SHARED_DICTS,
|
|
23
24
|
GEOIP_DB_PATH,
|
|
@@ -38,9 +39,11 @@ import {
|
|
|
38
39
|
ensureOpenRestyConfig,
|
|
39
40
|
luaSourceAvailable,
|
|
40
41
|
parseNginxVersion
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-PZRRL5PC.js";
|
|
43
|
+
import "./chunk-EZPPTWJQ.js";
|
|
44
|
+
import "./chunk-WFRXYWK2.js";
|
|
42
45
|
import "./chunk-ZFJXPCQP.js";
|
|
43
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-LEYSL46B.js";
|
|
44
47
|
import "./chunk-PXKCZB2I.js";
|
|
45
48
|
export {
|
|
46
49
|
ACME_CHALLENGE_LOCATION,
|
|
@@ -58,6 +61,7 @@ export {
|
|
|
58
61
|
EDGE_HTTPS_REJECT_BLOCK,
|
|
59
62
|
EDGE_LUA_PACKAGE_PATH,
|
|
60
63
|
EDGE_MGMT_SERVER_BLOCK,
|
|
64
|
+
EDGE_SAME_PATH_MOUNTS,
|
|
61
65
|
EDGE_SERVER_NAMES_HASH_BUCKET_SIZE,
|
|
62
66
|
EDGE_SHARED_DICTS,
|
|
63
67
|
GEOIP_DB_PATH,
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
privilegedExecutor,
|
|
7
|
+
rootChecked,
|
|
8
|
+
rootOrDegrade
|
|
9
|
+
} from "./chunk-RFWJE7ZN.js";
|
|
10
|
+
import "./chunk-EZPPTWJQ.js";
|
|
11
|
+
import "./chunk-WFRXYWK2.js";
|
|
12
|
+
import "./chunk-ZFJXPCQP.js";
|
|
13
|
+
import "./chunk-LEYSL46B.js";
|
|
14
|
+
import "./chunk-PXKCZB2I.js";
|
|
15
|
+
export {
|
|
16
|
+
privilegedExecutor,
|
|
17
|
+
rootChecked,
|
|
18
|
+
rootOrDegrade
|
|
19
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
[sshd]
|
|
2
2
|
backend = polling
|
|
3
3
|
journalmatch=
|
|
4
|
-
|
|
4
|
+
# openship-mail runs no sshd (SSH is on the host, not in the mail container), so
|
|
5
|
+
# there is no /var/log/auth.log for this jail to tail — leaving it enabled makes
|
|
6
|
+
# fail2ban crash-loop on a missing logpath. Disabled for the containerized engine.
|
|
7
|
+
enabled = false
|
|
5
8
|
filter = sshd
|
|
6
9
|
logpath = PH_SSHD_LOGFILE tail
|
|
7
10
|
action = PH_FAIL2BAN_ACTION[name=sshd, port="PH_SSHD_PORT", protocol=tcp]
|