✨ Features Added: - Real-time event subscription using Drift SDK EventSubscriber - Periodic fallback monitoring for position changes - Interactive UI controls for starting/stopping monitoring - Comprehensive data source status tracking - Multi-source trade aggregation and deduplication 🔧 Backend Implementation: - EventSubscriber integration with OrderActionRecord events - Fallback to periodic monitoring (30s intervals) if events fail - Real-time trade cache management (last 100 trades) - Enhanced data availability status with monitoring state - Improved trade history from 5+ different API sources 🎨 Frontend Enhancements: - Live monitoring toggle button (🔴 Start Live / 🟢 Live) - Real-time status panel showing active monitoring state - Trade counter and last activity timestamps - Clear cache functionality for real-time trades - Enhanced status modal with monitoring details 🔗 API Endpoints: - POST /api/drift/realtime-monitoring - Control monitoring - GET /api/drift/realtime-monitoring - Check status - GET /api/drift/data-status - Enhanced with monitoring state 🐳 Docker Integration: - Updated container configuration for persistent monitoring - Environment variable support for real-time features - Database persistence for captured trades 💾 Database & Storage: - Automatic storage of real-time detected trades - Deduplication logic to prevent synthetic/duplicate trades - Persistent cache across container restarts 🚀 Usage: - Click 'Start Live' button in Trading History panel - Monitor will attempt EventSubscriber, fallback to periodic checks - All future trades automatically captured and stored - Status panel shows monitoring state and trade statistics This implements comprehensive real-time trading monitoring for Drift Protocol with robust fallback mechanisms and professional UI integration.
71 lines
1.6 KiB
Docker
71 lines
1.6 KiB
Docker
# Dockerfile for Next.js 15 + Playwright + Puppeteer/Chromium + Prisma + Tailwind + OpenAI
|
|
FROM node:20-slim
|
|
|
|
# Install system dependencies for Chromium and Playwright
|
|
RUN apt-get update && apt-get install -y \
|
|
wget \
|
|
ca-certificates \
|
|
fonts-liberation \
|
|
libappindicator3-1 \
|
|
libasound2 \
|
|
libatk-bridge2.0-0 \
|
|
libatk1.0-0 \
|
|
libcups2 \
|
|
libdbus-1-3 \
|
|
libdrm2 \
|
|
libgbm1 \
|
|
libnspr4 \
|
|
libnss3 \
|
|
libx11-xcb1 \
|
|
libxcomposite1 \
|
|
libxdamage1 \
|
|
libxrandr2 \
|
|
xdg-utils \
|
|
libxss1 \
|
|
libgconf-2-4 \
|
|
libxtst6 \
|
|
libxrandr2 \
|
|
libasound2 \
|
|
libpangocairo-1.0-0 \
|
|
libgdk-pixbuf2.0-0 \
|
|
libgtk-3-0 \
|
|
libxshmfence1 \
|
|
--no-install-recommends && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Chromium (Debian 12+ uses 'chromium' instead of 'chromium-browser')
|
|
RUN apt-get update && apt-get install -y \
|
|
chromium \
|
|
--no-install-recommends && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files and install dependencies
|
|
COPY package.json package-lock.json* pnpm-lock.yaml* yarn.lock* .npmrc* ./
|
|
RUN npm install
|
|
|
|
# Install Playwright browsers and dependencies
|
|
RUN npx playwright install --with-deps chromium
|
|
RUN npx playwright install-deps
|
|
|
|
# Copy the rest of the app
|
|
COPY . .
|
|
|
|
# Generate Prisma client
|
|
RUN npx prisma generate
|
|
|
|
# Fix permissions for node_modules binaries
|
|
RUN chmod +x node_modules/.bin/*
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Set environment variables for Puppeteer
|
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
|
|
|
# Start the app
|
|
CMD ["npm", "run", "dev:docker"]
|