@snowcone-app/browser-buddy
v1.0.0
Published
A TypeScript application that monitors and manages multiple Chromium browser instances
Readme
Browser Buddy
A TypeScript application that monitors and manages multiple Chromium browser instances using Puppeteer.
Features
- Launch multiple browser instances pointing to a specific URL
- Monitor browser health (memory usage and responsiveness)
- Automatically restart unhealthy browser instances
- Configurable via environment variables
Requirements
- Node.js (v14 or higher recommended)
- npm (v6 or higher recommended)
Installation
- Clone the repository
- Install dependencies:
npm installConfiguration
Configuration is handled through environment variables. You can set these in a .env file in the project root. See the .env file for available options:
BROWSER_INSTANCES: Number of browser instances to run (default: 3)TARGET_URL: URL to load in each browser (default: https://example.com)HEALTH_CHECK_INTERVAL_MS: Health check interval in milliseconds (default: 30000)MEMORY_THRESHOLD_MB: Memory threshold in MB that triggers restart (default: 500)RESPONSE_TIMEOUT_MS: Timeout in milliseconds for responsiveness checks (default: 5000)HEADLESS: Whether to use headless mode (default: false)WINDOW_WIDTH: Browser window width (default: 1366)WINDOW_HEIGHT: Browser window height (default: 768)
Usage
Start the application:
npm startBuild the TypeScript files:
npm run buildHealth Monitoring
Browser Buddy monitors browser instances for:
- Connectivity - Checks if the browser is still connected
- Responsiveness - Ensures the browser responds to commands within a timeout
- Memory Usage - Restarts browsers that exceed the memory threshold
License
MIT
