28 lines
1005 B
JavaScript
28 lines
1005 B
JavaScript
const { RemoteTerminal } = require('./remote_exec');
|
|
|
|
const GATEWAY_WS = 'wss://soc-gateway-28cd1dc4e034.hosted.ghaymah.systems/ws';
|
|
|
|
async function main() {
|
|
console.log('Connecting to soc-gateway terminal...');
|
|
const term = new RemoteTerminal(GATEWAY_WS);
|
|
await term.connect();
|
|
|
|
console.log('Starting SOC Gateway node process on port 3000...');
|
|
await term.exec('pkill -f "node /app/gateway.js" || true');
|
|
await term.exec('PORT=3000 nohup node /app/gateway.js > /var/log/gateway.log 2>&1 &');
|
|
await new Promise(r => setTimeout(r, 1500));
|
|
|
|
const ps = await term.exec('ps aux | grep gateway.js');
|
|
console.log('Process check:\n', ps.output);
|
|
|
|
const localWget = await term.exec('wget -qO- http://localhost:3000/health');
|
|
console.log('Local port 3000 health check:\n', localWget.output);
|
|
|
|
const headHtml = await term.exec('wget -qO- http://localhost:3000/ | head -n 15');
|
|
console.log('Local port 3000 HTML check:\n', headHtml.output);
|
|
|
|
term.close();
|
|
}
|
|
|
|
main().catch(console.error);
|