Files
Deep-Package-Inspection/scripts/deep-diag.js
T
rafif dd4c8f6876 feat(source2): push all latest files - device labeling, help system, proxy docs, database isolation fix
- Added DOKUMENTASI-FILTER-PER-SITE.md (site isolation docs)
- Fixed start-with-env.js to force-load .env.production
- Fixed MONGODB_URI hostname from mongodb-netify to mongodb.prod.proit.id
- Updated .gitignore to exclude sensitive scripts and credential files
- Minor UI and labeling improvements
2026-07-29 14:14:29 +07:00

49 lines
1.6 KiB
JavaScript

// scripts/deep-diag.js
'use strict';
const { Client } = require('ssh2');
const conn = new Client();
const PUB = '/home/adminbackend/web/demoplace.my.id/public_html';
function exec(conn, cmd) {
console.log('\n$ ' + cmd.substring(0, 80));
return new Promise(resolve => {
conn.exec(cmd, (err, s) => {
if (err) { resolve(''); return; }
let out = '';
s.on('data', d => { out += d; process.stdout.write(d.toString()); })
.stderr.on('data', d => { out += d; process.stdout.write(d.toString()); })
.on('close', () => resolve(out));
});
});
}
conn.on('ready', async () => {
// 1. Cek proses yang sedang berjalan
await exec(conn, 'ps -p 3193322 -o cmd 2>/dev/null | tail -1');
// 2. Cek BUILD_ID di standalone
const saPath = PUB + '/.next/standalone';
await exec(conn, 'cat ' + saPath + '/.next/BUILD_ID 2>/dev/null || echo NO_BUILD_ID_IN_STANDALONE');
// 3. List chunks di standalone
await exec(conn, 'ls ' + saPath + '/.next/static/chunks/ | head -15');
// 4. List static root di standalone
await exec(conn, 'ls ' + saPath + '/.next/static/');
// 5. Cek apakah ada server.js lain yang mungkin sedang berjalan
await exec(conn, 'ps aux | grep "node.*server" | grep -v grep | head -5');
// 6. PM2 info untuk backone-frontend
await exec(conn, '/home/adminbackend/.npm-global/bin/pm2 show backone-frontend 2>/dev/null | grep -E "(script|cwd|pid|restart)"');
// 7. Cek log terbaru
await exec(conn, 'tail -20 ' + PUB + '/logs/frontend-out.log 2>/dev/null | head -20');
conn.end();
}).connect({
host: '103.185.47.52', port: 2222,
username: 'adminbackend', password: 'htEo7x6LsBQiEHHH',
readyTimeout: 30000
});