hatchkit 0.1.39 → 0.1.40
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/dist/adopt.js +6 -4
- package/dist/adopt.js.map +1 -1
- package/dist/deploy/coolify-app.d.ts +9 -9
- package/dist/deploy/coolify-app.d.ts.map +1 -1
- package/dist/deploy/coolify-app.js +14 -19
- package/dist/deploy/coolify-app.js.map +1 -1
- package/dist/deploy/coolify.d.ts.map +1 -1
- package/dist/deploy/coolify.js +6 -2
- package/dist/deploy/coolify.js.map +1 -1
- package/dist/deploy/keys.d.ts +7 -2
- package/dist/deploy/keys.d.ts.map +1 -1
- package/dist/deploy/keys.js +27 -7
- package/dist/deploy/keys.js.map +1 -1
- package/dist/deploy/rollback.d.ts.map +1 -1
- package/dist/deploy/rollback.js +80 -22
- package/dist/deploy/rollback.js.map +1 -1
- package/dist/deploy/sync.d.ts +10 -7
- package/dist/deploy/sync.d.ts.map +1 -1
- package/dist/deploy/sync.js +13 -9
- package/dist/deploy/sync.js.map +1 -1
- package/dist/index.js +77 -6
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +107 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/inventory.js +1522 -0
- package/dist/inventory.js.map +1 -0
- package/dist/prompts.d.ts +0 -7
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +1 -7
- package/dist/prompts.js.map +1 -1
- package/dist/scaffold/app.js +1 -1
- package/dist/scaffold/app.js.map +1 -1
- package/dist/scaffold/infra.js +1 -1
- package/dist/utils/coolify-api.d.ts +11 -0
- package/dist/utils/coolify-api.d.ts.map +1 -1
- package/dist/utils/coolify-api.js +25 -0
- package/dist/utils/coolify-api.js.map +1 -1
- package/dist/utils/coolify-server-ips.d.ts +6 -12
- package/dist/utils/coolify-server-ips.d.ts.map +1 -1
- package/dist/utils/coolify-server-ips.js +26 -81
- package/dist/utils/coolify-server-ips.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,26 +12,16 @@
|
|
|
12
12
|
* common Docker-on-the-same-box install. That string IS NOT a
|
|
13
13
|
* routable IPv4 — it's the container-internal alias for the Docker
|
|
14
14
|
* host. Pointing DNS A records at it (Cloudflare or otherwise) gets
|
|
15
|
-
* rejected by the API.
|
|
16
|
-
*
|
|
15
|
+
* rejected by the API. So we ask /servers/{uuid}/domains, which
|
|
16
|
+
* surfaces the configured public_ipv4 / public_ipv6 (the values the
|
|
17
|
+
* operator entered when registering the "localhost" server). On
|
|
18
|
+
* non-Docker installs /servers itself already returns a real IPv4,
|
|
19
|
+
* so we fall back to that.
|
|
17
20
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* "localhost" server). It's the box's self-reported truth.
|
|
22
|
-
* 2. DNS resolution of the Coolify dashboard hostname. The user is
|
|
23
|
-
* reaching Coolify over the public internet, so the dashboard's
|
|
24
|
-
* A / AAAA records ARE necessarily the box's public IP. This
|
|
25
|
-
* catches setups where /servers/{uuid}/domains 404s (older
|
|
26
|
-
* Coolify) or the operator left public_ipv4 unset.
|
|
27
|
-
*
|
|
28
|
-
* When both sources give us an IPv4 and they disagree, we surface a
|
|
29
|
-
* yellow warning (stale public_ipv4, misconfigured floating IP, proxy
|
|
30
|
-
* in front of the wrong box, …) and proceed with Coolify's value.
|
|
21
|
+
* Coolify is the source of truth — no DNS cross-check, no second
|
|
22
|
+
* opinion. If /servers/{uuid}/domains is wrong, the user fixes it
|
|
23
|
+
* in the dashboard.
|
|
31
24
|
*/
|
|
32
|
-
import { resolve4, resolve6 } from "node:dns/promises";
|
|
33
|
-
import chalk from "chalk";
|
|
34
|
-
import ora from "ora";
|
|
35
25
|
/** True for valid public-routable IPv4 strings. Filters out the
|
|
36
26
|
* values Coolify hands back on Docker installs (`host.docker.internal`,
|
|
37
27
|
* `localhost`, `127.0.0.1`) plus IPv6, which we don't auto-manage. */
|
|
@@ -59,77 +49,32 @@ export function isPublicIpv6(s) {
|
|
|
59
49
|
return false; // link-local
|
|
60
50
|
return true;
|
|
61
51
|
}
|
|
62
|
-
/** Resolve the box's public IPv4 + IPv6
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// entries with `ip` set per running domain; for localhost-Coolify
|
|
71
|
-
// this falls back to the configured public_ipv4 / public_ipv6.
|
|
72
|
-
let coolifyV4;
|
|
73
|
-
let coolifyV6;
|
|
52
|
+
/** Resolve the box's public IPv4 + IPv6 from Coolify. Prefers
|
|
53
|
+
* /servers/{uuid}/domains (which surfaces public_ipv4 / public_ipv6
|
|
54
|
+
* for localhost-Coolify installs that report `host.docker.internal`
|
|
55
|
+
* on /servers), and falls back to the /servers ip field for
|
|
56
|
+
* non-Docker installs. */
|
|
57
|
+
export async function discoverPublicIps(api, serverUuid, fallbackServerIp) {
|
|
58
|
+
let v4;
|
|
59
|
+
let v6;
|
|
74
60
|
try {
|
|
75
61
|
const domains = await api.getServerDomains(serverUuid);
|
|
76
62
|
for (const d of domains) {
|
|
77
63
|
const ip = (d.ip ?? "").trim();
|
|
78
|
-
if (!
|
|
79
|
-
|
|
80
|
-
if (!
|
|
81
|
-
|
|
64
|
+
if (!v4 && isPublicIpv4(ip))
|
|
65
|
+
v4 = ip;
|
|
66
|
+
if (!v6 && isPublicIpv6(ip))
|
|
67
|
+
v6 = ip;
|
|
82
68
|
}
|
|
83
69
|
}
|
|
84
70
|
catch {
|
|
85
71
|
// /servers/{uuid}/domains can 404 / 501 on older Coolify builds.
|
|
86
|
-
//
|
|
87
|
-
}
|
|
88
|
-
// /servers itself may return a real IPv4 on non-Docker installs —
|
|
89
|
-
// use it as a last-resort source.
|
|
90
|
-
if (!coolifyV4 && isPublicIpv4(fallbackServerIp))
|
|
91
|
-
coolifyV4 = fallbackServerIp;
|
|
92
|
-
if (!coolifyV6 && isPublicIpv6(fallbackServerIp))
|
|
93
|
-
coolifyV6 = fallbackServerIp;
|
|
94
|
-
// Step 2: independent DNS resolution of the dashboard hostname.
|
|
95
|
-
let host;
|
|
96
|
-
try {
|
|
97
|
-
host = new URL(dashboardUrl).hostname;
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
/* ignore — dashboard URL might be malformed */
|
|
101
|
-
}
|
|
102
|
-
let dnsV4;
|
|
103
|
-
let dnsV6;
|
|
104
|
-
if (host && !isPublicIpv4(host)) {
|
|
105
|
-
const spinner = ora(`Resolving ${host} for cross-check`).start();
|
|
106
|
-
try {
|
|
107
|
-
const [v4, v6] = await Promise.allSettled([resolve4(host), resolve6(host)]);
|
|
108
|
-
if (v4.status === "fulfilled" && v4.value[0] && isPublicIpv4(v4.value[0])) {
|
|
109
|
-
dnsV4 = v4.value[0];
|
|
110
|
-
}
|
|
111
|
-
if (v6.status === "fulfilled" && v6.value[0] && isPublicIpv6(v6.value[0])) {
|
|
112
|
-
dnsV6 = v6.value[0];
|
|
113
|
-
}
|
|
114
|
-
const parts = [dnsV4 && `A ${dnsV4}`, dnsV6 && `AAAA ${dnsV6}`].filter(Boolean);
|
|
115
|
-
spinner.succeed(`DNS for ${host}: ${parts.length > 0 ? parts.join(", ") : "no records"}`);
|
|
116
|
-
}
|
|
117
|
-
catch {
|
|
118
|
-
spinner.fail(`Couldn't resolve ${host}`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else if (host && isPublicIpv4(host)) {
|
|
122
|
-
dnsV4 = host;
|
|
123
|
-
}
|
|
124
|
-
// Step 3: cross-check + decide. Prefer Coolify's value when we have
|
|
125
|
-
// it (it's the box's self-reported truth); fall back to DNS.
|
|
126
|
-
const v4 = coolifyV4 ?? dnsV4;
|
|
127
|
-
const v6 = coolifyV6 ?? dnsV6;
|
|
128
|
-
let mismatchWarning;
|
|
129
|
-
if (coolifyV4 && dnsV4 && coolifyV4 !== dnsV4) {
|
|
130
|
-
mismatchWarning = `Coolify reports public IPv4 ${coolifyV4} but ${host} resolves to ${dnsV4}. Using Coolify's value; double-check the DNS records and any floating-IP / proxy setup.`;
|
|
131
|
-
console.log(chalk.yellow(` ⚠ ${mismatchWarning}`));
|
|
72
|
+
// Fall through to the /servers ip field below.
|
|
132
73
|
}
|
|
133
|
-
|
|
74
|
+
if (!v4 && isPublicIpv4(fallbackServerIp))
|
|
75
|
+
v4 = fallbackServerIp;
|
|
76
|
+
if (!v6 && isPublicIpv6(fallbackServerIp))
|
|
77
|
+
v6 = fallbackServerIp;
|
|
78
|
+
return { v4, v6 };
|
|
134
79
|
}
|
|
135
80
|
//# sourceMappingURL=coolify-server-ips.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coolify-server-ips.js","sourceRoot":"","sources":["../../src/utils/coolify-server-ips.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"coolify-server-ips.js","sourceRoot":"","sources":["../../src/utils/coolify-server-ips.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH;;uEAEuE;AACvE,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC,CAAC,WAAW;IAC/C,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;y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