Skip to content

Running Applications

Launchpad's monitoring system helps you manage and maintain long-running applications reliably. This guide covers how to configure, launch, and monitor your applications using Launchpad.

Overview

The monitoring system is built on top of PM2, a robust process manager, providing:

  • Process management and auto-restart
  • Log collection and rotation
  • Application status monitoring
  • Graceful shutdown handling

Basic Setup

  1. Install the required packages:
bash
npm install @bluecadet/launchpad
  1. Configure your applications in launchpad.config.js:
js
import { defineConfig } from '@bluecadet/launchpad/cli';
import { monitor } from '@bluecadet/launchpad/monitor';

export default defineConfig({
  plugins: [
    monitor({
      apps: [
        {
          pm2: {
            name: "my-app",
            script: "./app.exe",
            cwd: "./builds/",
            // Optional: environment variables
            env: {
              PORT: "3000"
            }
          }
        }
      ]
    })
  ]
});

WARNING

Always test your configuration in a development environment first

  1. Start your application
bash
npx launchpad monitor start

Configuration Options

Basic Settings

  • name: Unique identifier for your application
  • script: Path to your executable or script
  • cwd: Working directory for your application. Relative paths are resolved against the current working directory of the launchpad configuration.

Advanced Settings

js
{
  pm2: {
    // Process settings
    autorestart: true,
    
    // Resource limits
    max_memory_restart: '1G',
    
    // Environment
    env: {
      NODE_ENV: 'production'
    }
  }
}

Best Practices

  1. Unique Names: Give each application a unique, descriptive name
  2. Error Handling: Configure proper restart policies
  3. Resource Limits: Set memory limits to prevent system overload
  4. Logging: Use appropriate log levels for debugging

Next Steps

Released under the ISC License.