Add Addigy API integration and Docker deployment with Redis caching
- Implemented complete Addigy API v2 client with authentication via x-api-key - Added device and policy endpoints with automatic org ID resolution - Created field mapping from snake_case to Title Case for UI compatibility - Handles nested 'facts' response structure from Addigy devices API - Added comprehensive API documentation in ADDIGY_API_GUIDE.md - Multi-stage Dockerfile with optimized production build - Custom ports: App on 3100, Redis on 6380 (avoids conflicts) - Docker Compose orchestration with health checks - Standalone Next.js output for smaller container images - Non-root user execution for security - Implemented Redis caching layer for API responses - 5-minute TTL with graceful fallback if Redis unavailable - Cache key structure: service:entity:filter1:filter2 - Applied to Addigy devices endpoint with cache hit/miss logging - Fixed TypeScript strict mode errors for production builds - Added null safety checks with optional chaining throughout API routes - Wrapped useSearchParams in Suspense boundary for Next.js 15+ compatibility - Fixed type assertions for dynamic API responses - Corrected Set<string> type mismatches in device comparison logic - Created DOCKER_README.md with complete deployment guide - Updated ADDIGY_API_GUIDE.md with real-world API patterns - Documented response structures, field mappings, and troubleshooting - Next.js 16.0.0 with Turbopack - Redis 7 with AOF persistence - Podman/Docker compatible - TypeScript strict mode compliant
This commit is contained in:
parent
cf5fabe306
commit
f429f3af54
23 changed files with 1931 additions and 36 deletions
67
autotask-app/docker-compose.yml
Normal file
67
autotask-app/docker-compose.yml
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Redis cache service on custom port 6380 (instead of default 6379)
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: psa-utils-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6380:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
command: redis-server --appendonly yes
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
# Next.js application on port 3100 (instead of 3000)
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: psa-utils-app
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3100:3100"
|
||||
env_file:
|
||||
- .env.local
|
||||
environment:
|
||||
# Application settings
|
||||
NODE_ENV: production
|
||||
PORT: 3100
|
||||
|
||||
# Redis configuration
|
||||
REDIS_URL: redis://redis:6379
|
||||
|
||||
# Autotask API Configuration
|
||||
AUTOTASK_API_URL: ${AUTOTASK_API_URL}
|
||||
AUTOTASK_USERNAME: ${AUTOTASK_USERNAME}
|
||||
AUTOTASK_SECRET: ${AUTOTASK_SECRET}
|
||||
AUTOTASK_API_INTEGRATION_CODE: ${AUTOTASK_API_INTEGRATION_CODE}
|
||||
|
||||
# Datto RMM API Configuration
|
||||
DATTO_RMM_API_URL: ${DATTO_RMM_API_URL}
|
||||
DATTO_RMM_API_KEY: ${DATTO_RMM_API_KEY}
|
||||
DATTO_RMM_API_SECRET: ${DATTO_RMM_API_SECRET}
|
||||
|
||||
# Addigy API Configuration
|
||||
ADDIGY_API_URL: ${ADDIGY_API_URL}
|
||||
ADDIGY_API_TOKEN: ${ADDIGY_API_TOKEN}
|
||||
ADDIGY_ORG_ID: ${ADDIGY_ORG_ID}
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
# Mount .env.local for development (remove in production)
|
||||
- ./.env.local:/app/.env.local:ro
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: psa-utils-network
|
||||
Loading…
Add table
Add a link
Reference in a new issue