Implements per-store high-frequency crawl scheduling and inventory snapshot tracking for sales velocity estimation (Hoodie Analytics parity). Database migrations: - 117: Per-store crawl_interval_minutes and next_crawl_at columns - 118: inventory_snapshots table (30-day retention) - 119: product_visibility_events table for OOS/brand alerts (90-day) Backend changes: - inventory-snapshots.ts: Shared utility normalizing Dutchie/Jane/Treez - visibility-events.ts: Detects OOS, price changes, brand drops - task-scheduler.ts: checkHighFrequencyStores() runs every 60s - Handler updates: 2-line additions to save snapshots/events API endpoints: - GET /api/tasks/schedules/high-frequency - PUT /api/tasks/schedules/high-frequency/:id - DELETE /api/tasks/schedules/high-frequency/:id Frontend: - TasksDashboard: Per-Store Schedules section with stats Features: - Per-store intervals (15/30/60 min configurable) - Jitter (0-20%) to avoid detection patterns - Cross-platform support (Dutchie, Jane, Treez) - No crawler core changes - scheduling/post-crawl only 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
59 lines
1.7 KiB
Docker
59 lines
1.7 KiB
Docker
# Build stage
|
|
FROM code.cannabrands.app/creationshop/node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies with retry and fallback registry
|
|
# Primary: npmjs.org, Fallback: npmmirror.com (China mirror, globally accessible)
|
|
RUN npm config set fetch-retries 3 && \
|
|
npm config set fetch-retry-mintimeout 20000 && \
|
|
npm config set fetch-retry-maxtimeout 120000 && \
|
|
npm install || \
|
|
(npm config set registry https://registry.npmmirror.com && npm install)
|
|
|
|
# Copy source files
|
|
COPY . .
|
|
|
|
# Note: REACT_APP_API_URL is intentionally NOT set here
|
|
# The frontend uses relative URLs (same domain) in production
|
|
# API calls go to /api/* which the ingress routes to the backend
|
|
|
|
# Build the app (CRA produces /build, not /dist)
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM code.cannabrands.app/creationshop/nginx:alpine
|
|
|
|
# Copy built assets from builder stage (CRA outputs to /build)
|
|
COPY --from=builder /app/build /usr/share/nginx/html
|
|
|
|
# Copy nginx config for SPA routing
|
|
RUN echo 'server { \
|
|
listen 80; \
|
|
server_name _; \
|
|
root /usr/share/nginx/html; \
|
|
index index.html; \
|
|
\
|
|
# Gzip compression \
|
|
gzip on; \
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; \
|
|
\
|
|
# Cache static assets \
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { \
|
|
expires 1y; \
|
|
add_header Cache-Control "public, immutable"; \
|
|
} \
|
|
\
|
|
# SPA fallback - serve index.html for all routes \
|
|
location / { \
|
|
try_files $uri $uri/ /index.html; \
|
|
} \
|
|
}' > /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|