easy-vps 0.2.0 → 0.2.1
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/services/deploy.js +10 -4
- package/package.json +1 -1
package/dist/services/deploy.js
CHANGED
|
@@ -370,7 +370,10 @@ async function clones(remote) {
|
|
|
370
370
|
' name=$(basename "$dir")',
|
|
371
371
|
' repo=$(git -C "$dir" config --get remote.origin.url 2>/dev/null)',
|
|
372
372
|
' branch=$(git -C "$dir" rev-parse --abbrev-ref HEAD 2>/dev/null)',
|
|
373
|
-
'
|
|
373
|
+
// The port is the authoritative one (it's what Nginx proxies to); read it
|
|
374
|
+
// from the deploy config the panel mirrors next to the clone.
|
|
375
|
+
' port=$(grep -oE \'"port"[[:space:]]*:[[:space:]]*[0-9]+\' "$dir/.easy-vps.json" 2>/dev/null | grep -oE \'[0-9]+\' | head -n1)',
|
|
376
|
+
' printf "%s\\t%s\\t%s\\t%s\\n" "$name" "$repo" "$branch" "$port"',
|
|
374
377
|
'done',
|
|
375
378
|
].join('\n');
|
|
376
379
|
const { stdout, code } = await remote.exec((0, ssh_1.loginShell)(script), 15_000);
|
|
@@ -380,10 +383,11 @@ async function clones(remote) {
|
|
|
380
383
|
.split('\n')
|
|
381
384
|
.map((line) => line.split('\t'))
|
|
382
385
|
.filter((parts) => parts[0]?.trim())
|
|
383
|
-
.map(([name, repository, branch]) => ({
|
|
386
|
+
.map(([name, repository, branch, port]) => ({
|
|
384
387
|
name: name.trim(),
|
|
385
388
|
repository: repository?.trim() ?? '',
|
|
386
389
|
branch: branch?.trim() || 'main',
|
|
390
|
+
port: port?.trim() ? Number(port.trim()) : undefined,
|
|
387
391
|
}));
|
|
388
392
|
}
|
|
389
393
|
/** PM2 processes by name, with the port they were started on. */
|
|
@@ -447,11 +451,13 @@ async function list(remote) {
|
|
|
447
451
|
domains.list(remote).catch(() => []),
|
|
448
452
|
]);
|
|
449
453
|
const domainForPort = new Map(configured.map((entry) => [entry.port, entry.domain]));
|
|
450
|
-
return cloned.map(({ name, repository, branch }) => {
|
|
454
|
+
return cloned.map(({ name, repository, branch, port: configPort }) => {
|
|
451
455
|
const process = pm2.get(name);
|
|
452
456
|
const container = docker.get(name);
|
|
453
457
|
const runtime = container && !process ? 'docker' : 'pm2';
|
|
454
|
-
|
|
458
|
+
// Prefer the saved deploy config's port (authoritative for the domain
|
|
459
|
+
// mapping); fall back to what PM2/Docker report, then 0.
|
|
460
|
+
const port = configPort ?? process?.port ?? container?.port ?? 0;
|
|
455
461
|
let status = 'unknown';
|
|
456
462
|
if (process)
|
|
457
463
|
status = process.status === 'online' ? 'running' : 'stopped';
|