UNPKG

@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
#!/usr/bin/env node 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'); });