@rubys/fly-explorer
Version:
A comprehensive web-based dashboard for managing Fly.io infrastructure using Model Context Protocol (MCP) integration with flyctl
55 lines (45 loc) ⢠1.51 kB
JavaScript
import { spawn } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Path to the server entry point
const serverPath = join(__dirname, '..', 'dist', 'server', 'index.js');
// Default port
const port = process.env.PORT || 3001;
console.log('š Starting Fly Explorer...');
console.log(`š Server will be available at http://localhost:${port}`);
console.log('š Browser will open automatically when ready');
console.log('š Checking for flyctl... (will install automatically if needed)');
console.log('š Will verify Fly.io authentication (login prompt may appear)');
console.log('š Documentation: https://github.com/rubys/fly-explorer#readme');
console.log('');
// Start the server
const server = spawn('node', [serverPath], {
stdio: 'inherit',
env: {
...process.env,
PORT: port,
NODE_ENV: 'production'
}
});
server.on('error', (err) => {
console.error('ā Failed to start server:', err.message);
process.exit(1);
});
server.on('exit', (code) => {
if (code !== 0) {
console.error(`ā Server exited with code ${code}`);
process.exit(code);
}
});
// Handle graceful shutdown
process.on('SIGINT', () => {
console.log('\nš Shutting down Fly Explorer...');
server.kill('SIGINT');
});
process.on('SIGTERM', () => {
console.log('\nš Shutting down Fly Explorer...');
server.kill('SIGTERM');
});