@supacloud/admin 0.7.6 → 0.7.7
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/index.js +64 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25096,6 +25096,11 @@ class SshConnectionPool {
|
|
|
25096
25096
|
} catch {}
|
|
25097
25097
|
}
|
|
25098
25098
|
}
|
|
25099
|
+
discard(conn) {
|
|
25100
|
+
try {
|
|
25101
|
+
conn.end();
|
|
25102
|
+
} catch {}
|
|
25103
|
+
}
|
|
25099
25104
|
closeAll() {
|
|
25100
25105
|
for (const conn of this.pool) {
|
|
25101
25106
|
try {
|
|
@@ -25130,13 +25135,15 @@ class SshTransport {
|
|
|
25130
25135
|
}
|
|
25131
25136
|
auditCommand(command, this.config.host, false);
|
|
25132
25137
|
const conn = await this.pool.acquire();
|
|
25138
|
+
let connectionReusable = true;
|
|
25133
25139
|
try {
|
|
25134
25140
|
return await new Promise((resolve, reject) => {
|
|
25135
25141
|
const outputLimit = this.config.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
|
|
25136
25142
|
const stdout = new BoundedOutputCollector(outputLimit);
|
|
25137
25143
|
const stderr = new BoundedOutputCollector(outputLimit);
|
|
25138
25144
|
const timer = setTimeout(() => {
|
|
25139
|
-
|
|
25145
|
+
connectionReusable = false;
|
|
25146
|
+
this.pool.discard(conn);
|
|
25140
25147
|
reject(new Error(`SSH command timed out after ${timeoutMs}ms`));
|
|
25141
25148
|
}, timeoutMs);
|
|
25142
25149
|
conn.exec(command, (err, stream) => {
|
|
@@ -25162,7 +25169,8 @@ class SshTransport {
|
|
|
25162
25169
|
});
|
|
25163
25170
|
});
|
|
25164
25171
|
} finally {
|
|
25165
|
-
|
|
25172
|
+
if (connectionReusable)
|
|
25173
|
+
this.pool.release(conn);
|
|
25166
25174
|
}
|
|
25167
25175
|
}
|
|
25168
25176
|
async upload(localPath, remotePath) {
|
|
@@ -25626,6 +25634,24 @@ SUPACLOUD_GH_MIN_VERSION="\${SUPACLOUD_GH_MIN_VERSION:-2.68.0}"
|
|
|
25626
25634
|
SUPACLOUD_GH_AMD64_SHA256="\${SUPACLOUD_GH_AMD64_SHA256:-83d5c2ccad5498f58bf6368acb1ab32588cf43ab3a4b1c301bf36328b1c8bd60}"
|
|
25627
25635
|
SUPACLOUD_GH_ARM64_SHA256="\${SUPACLOUD_GH_ARM64_SHA256:-06f86ec7103d41993b76cd78072f43595c34aaa56506d971d9860e67140bf909}"
|
|
25628
25636
|
|
|
25637
|
+
supacloud_curl_release_json() {
|
|
25638
|
+
local url="$1"
|
|
25639
|
+
local output="$2"
|
|
25640
|
+
curl -fsSL --proto '=https' --proto-redir '=https' \\
|
|
25641
|
+
--retry 1 --retry-delay 2 --retry-max-time 60 \\
|
|
25642
|
+
--connect-timeout 15 --max-time 30 --speed-limit 128 --speed-time 10 \\
|
|
25643
|
+
-o "$output" "$url"
|
|
25644
|
+
}
|
|
25645
|
+
|
|
25646
|
+
supacloud_curl_release_asset() {
|
|
25647
|
+
local url="$1"
|
|
25648
|
+
local output="$2"
|
|
25649
|
+
curl -fL --proto '=https' --proto-redir '=https' \\
|
|
25650
|
+
--retry 1 --retry-delay 2 --retry-max-time 180 \\
|
|
25651
|
+
--connect-timeout 15 --max-time 90 --speed-limit 128 --speed-time 60 \\
|
|
25652
|
+
-o "$output" "$url"
|
|
25653
|
+
}
|
|
25654
|
+
|
|
25629
25655
|
supacloud_component_tag() {
|
|
25630
25656
|
local component="$1"
|
|
25631
25657
|
local version="$2"
|
|
@@ -25691,18 +25717,15 @@ supacloud_fetch_component_release() {
|
|
|
25691
25717
|
supacloud_select_release "$component" "\${required_assets[@]}" <<< "$response"
|
|
25692
25718
|
}
|
|
25693
25719
|
|
|
25694
|
-
supacloud_fetch_release_json()
|
|
25720
|
+
supacloud_fetch_release_json() (
|
|
25695
25721
|
local url="$1"
|
|
25696
|
-
local
|
|
25697
|
-
|
|
25698
|
-
|
|
25699
|
-
|
|
25700
|
-
|
|
25701
|
-
|
|
25702
|
-
|
|
25703
|
-
fi
|
|
25704
|
-
return 1
|
|
25705
|
-
}
|
|
25722
|
+
local response_file
|
|
25723
|
+
response_file=$(mktemp) || return 1
|
|
25724
|
+
trap 'rm -f "$response_file"' EXIT
|
|
25725
|
+
trap 'trap - EXIT HUP INT TERM; rm -f "$response_file"; exit 1' HUP INT TERM
|
|
25726
|
+
supacloud_download_release_metadata_url "$url" "$response_file" || return 1
|
|
25727
|
+
cat "$response_file"
|
|
25728
|
+
)
|
|
25706
25729
|
|
|
25707
25730
|
supacloud_release_asset_url() {
|
|
25708
25731
|
local release_json="$1"
|
|
@@ -25718,11 +25741,26 @@ supacloud_download_url() {
|
|
|
25718
25741
|
local output="$2"
|
|
25719
25742
|
local proxy="\${SUPACLOUD_GITHUB_PROXY:-\${GH_PROXY:-}}"
|
|
25720
25743
|
|
|
25721
|
-
if
|
|
25744
|
+
if supacloud_curl_release_asset "$url" "$output"; then
|
|
25745
|
+
return 0
|
|
25746
|
+
fi
|
|
25747
|
+
if [[ -n "$proxy" ]]; then
|
|
25748
|
+
supacloud_curl_release_asset "\${proxy%/}/\${url}" "$output"
|
|
25749
|
+
return
|
|
25750
|
+
fi
|
|
25751
|
+
return 1
|
|
25752
|
+
}
|
|
25753
|
+
|
|
25754
|
+
supacloud_download_release_metadata_url() {
|
|
25755
|
+
local url="$1"
|
|
25756
|
+
local output="$2"
|
|
25757
|
+
local proxy="\${SUPACLOUD_GITHUB_PROXY:-\${GH_PROXY:-}}"
|
|
25758
|
+
|
|
25759
|
+
if supacloud_curl_release_json "$url" "$output"; then
|
|
25722
25760
|
return 0
|
|
25723
25761
|
fi
|
|
25724
25762
|
if [[ -n "$proxy" ]]; then
|
|
25725
|
-
|
|
25763
|
+
supacloud_curl_release_json "\${proxy%/}/\${url}" "$output"
|
|
25726
25764
|
return
|
|
25727
25765
|
fi
|
|
25728
25766
|
return 1
|
|
@@ -25803,7 +25841,8 @@ supacloud_install_pinned_tar_xz_binary() (
|
|
|
25803
25841
|
fi
|
|
25804
25842
|
|
|
25805
25843
|
extract_dir=$(mktemp -d)
|
|
25806
|
-
trap 'rm -rf "$extract_dir"; [[ -z "\${staged_target:-}" ]] || rm -f "$staged_target"' EXIT
|
|
25844
|
+
trap 'rm -rf "$extract_dir"; [[ -z "\${staged_target:-}" ]] || rm -f "$staged_target"' EXIT
|
|
25845
|
+
trap 'trap - EXIT HUP INT TERM; rm -rf "$extract_dir"; [[ -z "\${staged_target:-}" ]] || rm -f "$staged_target"; exit 1' HUP INT TERM
|
|
25807
25846
|
if ! tar --no-same-owner --no-same-permissions -xJf "$archive" -C "$extract_dir" "$member"; then
|
|
25808
25847
|
return 1
|
|
25809
25848
|
fi
|
|
@@ -26035,10 +26074,11 @@ supacloud_download_release_asset() (
|
|
|
26035
26074
|
mkdir -p "$(dirname "$destination")"
|
|
26036
26075
|
temporary_artifact=$(mktemp "\${destination}.tmp.XXXXXX")
|
|
26037
26076
|
temporary_checksums=$(mktemp "\${destination}.SHA256SUMS.tmp.XXXXXX")
|
|
26038
|
-
trap 'rm -f "\${temporary_artifact:-}" "\${temporary_checksums:-}"' EXIT
|
|
26077
|
+
trap 'rm -f "\${temporary_artifact:-}" "\${temporary_checksums:-}"' EXIT
|
|
26078
|
+
trap 'trap - EXIT HUP INT TERM; rm -f "\${temporary_artifact:-}" "\${temporary_checksums:-}"; exit 1' HUP INT TERM
|
|
26039
26079
|
|
|
26040
26080
|
if ! supacloud_download_url "$asset_url" "$temporary_artifact" \\
|
|
26041
|
-
|| !
|
|
26081
|
+
|| ! supacloud_download_release_metadata_url "$checksum_url" "$temporary_checksums" \\
|
|
26042
26082
|
|| ! supacloud_verify_checksum "$temporary_artifact" "$asset_name" "$temporary_checksums"; then
|
|
26043
26083
|
rm -f "$temporary_artifact" "$temporary_checksums"
|
|
26044
26084
|
return 1
|
|
@@ -26080,6 +26120,8 @@ var SAFE_HOSTNAME = /^(?=.{1,253}$)(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9
|
|
|
26080
26120
|
var SAFE_SYSTEMD_UNIT = /^[a-zA-Z0-9][a-zA-Z0-9_.@:-]{0,127}$/;
|
|
26081
26121
|
var SAFE_DB_IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_-]{0,62}$/;
|
|
26082
26122
|
var MINIMUM_COMPONENT_UPGRADE_VERSION = "0.50.27";
|
|
26123
|
+
var DIRECT_UPGRADE_SSH_TIMEOUT_MS = 720000;
|
|
26124
|
+
var PROXIED_UPGRADE_SSH_TIMEOUT_MS = 1320000;
|
|
26083
26125
|
function hostnameSchema(fieldName) {
|
|
26084
26126
|
return decodedSchema(Type.String(), Type.String({ minLength: 1, maxLength: 253 }), (value) => {
|
|
26085
26127
|
const normalized = value.trim();
|
|
@@ -26238,12 +26280,12 @@ function officialUpgradeOutcome(execution, executionError, cleanupError) {
|
|
|
26238
26280
|
throw remoteUpgradeFailure(execution);
|
|
26239
26281
|
return execution;
|
|
26240
26282
|
}
|
|
26241
|
-
async function executeOfficialUpgrade(ssh, helperPath, command) {
|
|
26283
|
+
async function executeOfficialUpgrade(ssh, helperPath, command, timeoutMs) {
|
|
26242
26284
|
let execution;
|
|
26243
26285
|
let executionError;
|
|
26244
26286
|
try {
|
|
26245
26287
|
await ssh.uploadText(helperPath, release_assets_default, 384);
|
|
26246
|
-
execution = await ssh.exec(command,
|
|
26288
|
+
execution = await ssh.exec(command, timeoutMs);
|
|
26247
26289
|
} catch (error) {
|
|
26248
26290
|
executionError = error;
|
|
26249
26291
|
}
|
|
@@ -26558,7 +26600,8 @@ ${result.stderr.slice(-500)}`;
|
|
|
26558
26600
|
githubProxy,
|
|
26559
26601
|
helperPath
|
|
26560
26602
|
});
|
|
26561
|
-
const
|
|
26603
|
+
const upgradeTimeoutMs = githubProxy ? PROXIED_UPGRADE_SSH_TIMEOUT_MS : DIRECT_UPGRADE_SSH_TIMEOUT_MS;
|
|
26604
|
+
const upgradeExecution = await executeOfficialUpgrade(ssh, helperPath, cmd, upgradeTimeoutMs);
|
|
26562
26605
|
const edgeBoundary = edgeRuntimeVersion ? "" : `
|
|
26563
26606
|
⚠️ Edge Runtime was not upgraded; provide --edge_runtime_version for a component transaction.`;
|
|
26564
26607
|
text = `✅ Upgrade done
|