apac-ops-bot/docker-compose.yml
SamoilenkoVadym ddaa963bc2 Fix crypto error by disabling MSAL when Azure AD is not configured
Problem:
- MSAL library was causing crypto errors in browser
- Black screen on load due to MSAL initialization failure
- Error: crypto module not available in browser environment

Solution:
- Made MSAL initialization conditional based on Azure AD configuration
- Only initialize MSAL if REACT_APP_AZURE_CLIENT_ID is properly configured
- Allow simple login to work without MSAL for testing purposes
- Gracefully handle both MSAL and simple login modes

Changes:
- frontend/src/context/AuthContext.tsx:
  * Check if Azure AD is configured before initializing MSAL
  * Set msalInstance to null when Azure is not configured
  * Updated all MSAL calls to check for null before use
  * Simple login works independently of MSAL

- frontend/package.json:
  * Added crypto polyfills as devDependencies (for future use)
  * Packages: crypto-browserify, buffer, stream-browserify, etc.

- frontend/src/styles/theme.css:
  * Added login form styles (login-container, login-card, form-group, etc.)

Benefits:
- No more crypto errors in browser
- Simple login works without Azure AD configuration
- Easy testing with test accounts (admin/user)
- Production Azure AD login still supported when configured
- Graceful fallback for environments without Azure setup

Testing:
- Frontend compiles successfully without crypto errors
- All services running: backend, frontend, postgres, redis
- Simple login working with test accounts
- No black screen on load

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-28 10:56:54 +00:00

94 lines
2.1 KiB
YAML

version: '3.8'
services:
# PostgreSQL database
postgres:
image: postgres:15-alpine
container_name: apac_ops_bot_postgres
environment:
POSTGRES_USER: apac_ops_bot
POSTGRES_PASSWORD: secure_password
POSTGRES_DB: apac_ops_bot
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U apac_ops_bot"]
interval: 10s
timeout: 5s
retries: 5
networks:
- apac_network
restart: unless-stopped
# Redis for caching and rate limiting
redis:
image: redis:7-alpine
container_name: apac_ops_bot_redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- apac_network
restart: unless-stopped
# FastAPI backend
backend:
build:
context: ./backend
dockerfile: Dockerfile
target: development
container_name: apac_ops_bot_backend
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
volumes:
- ./backend:/app
ports:
- "8000:8000"
env_file:
- ./backend/.env
environment:
- DATABASE_URL=postgresql+asyncpg://apac_ops_bot:secure_password@postgres:5432/apac_ops_bot
- REDIS_URL=redis://redis:6379/0
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- apac_network
restart: unless-stopped
# React frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: development
container_name: apac_ops_bot_frontend
volumes:
- ./frontend:/app
- /app/node_modules
ports:
- "3000:3000"
env_file:
- ./frontend/.env
environment:
- REACT_APP_API_URL=http://83.151.203.105:8000/api/v1
- REACT_APP_WS_URL=ws://83.151.203.105:8000/ws
depends_on:
- backend
networks:
- apac_network
restart: unless-stopped
volumes:
postgres_data:
networks:
apac_network:
driver: bridge