module.exports = {
  apps: [
    {
      name: "tip-api",
      script: "./node_modules/.bin/tsx",
      args: "packages/api/src/index.ts",
      cwd: "/opt/tip",
      interpreter: "none",
      exec_mode: "fork",
      env: {
        NODE_ENV: "production",
        API_PORT: "3201",
        POSTGRES_HOST: "localhost",
        POSTGRES_PORT: "5433",
        POSTGRES_DB: "transceiver_db",
        POSTGRES_USER: "tip",
        POSTGRES_PASSWORD: "CHANGE_ME",
        OLLAMA_URL: "http://YOUR_OLLAMA_HOST:11434",
        QDRANT_URL: "http://localhost:6333",
        DOCLING_URL: "http://localhost:8100",
      },
      max_memory_restart: "500M",
      instances: 1,
      autorestart: true,
    },
    {
      name: "tip-mcp",
      script: "./node_modules/.bin/tsx",
      args: "packages/mcp-server/src/http-server.ts",
      cwd: "/opt/tip",
      interpreter: "none",
      exec_mode: "fork",
      env: {
        NODE_ENV: "production",
        MCP_HTTP_PORT: "3202",
        MCP_SECRET: "CHANGE_ME",
        POSTGRES_HOST: "localhost",
        POSTGRES_PORT: "5433",
        POSTGRES_DB: "transceiver_db",
        POSTGRES_USER: "tip",
        POSTGRES_PASSWORD: "CHANGE_ME",
        QDRANT_URL: "http://localhost:6333",
        OLLAMA_URL: "http://YOUR_OLLAMA_HOST:11434",
        CORS_ORIGINS: "https://your-domain.example.com",
      },
      max_memory_restart: "300M",
      instances: 1,
      autorestart: true,
    },
    {
      name: "tip-scraper",
      script: "./node_modules/.bin/tsx",
      args: "packages/scraper/src/index.ts",
      cwd: "/opt/tip",
      interpreter: "none",
      exec_mode: "fork",
      env: {
        NODE_ENV: "production",
        POSTGRES_HOST: "localhost",
        POSTGRES_PORT: "5433",
        POSTGRES_DB: "transceiver_db",
        POSTGRES_USER: "tip",
        POSTGRES_PASSWORD: "CHANGE_ME",
      },
      max_memory_restart: "1G",
      instances: 1,
      autorestart: true,
      cron_restart: "0 0 * * *",
    },
  ],
};
