pdf-accessibility/.env.example
michael 4080638856 Migrate PDF processing from Redis worker to Google Cloud Run
Replace the Redis queue + Python worker daemon with a synchronous HTTP
call to a Cloud Run service, eliminating Redis and simplifying the
infrastructure from 4 containers (web, worker, redis, postgres) to just
web + postgres (with Cloud Run handling processing).

- Add cloudrun_service.py: Flask app wrapping EnterprisePDFChecker with
  POST /check and GET /health endpoints, GCS image upload
- Add Dockerfile.cloudrun + requirements-cloudrun.txt for Cloud Run image
- Add cloudbuild.yaml for Cloud Build with custom Dockerfile
- Rewrite api.php: remove all Redis code, add Cloud Run OIDC auth
  (getCloudRunToken), synchronous processing in handleCheck(), file-based
  rate limiting, GCS redirect in handleImage(), DB helper updateJobInDatabase()
- Update js/upload.js: handle synchronous completed response from Cloud Run,
  increase poll timeout to 15 minutes
- Update js/page-viewer.js: use GCS URLs directly for page images
- Simplify docker-compose.yml and docker-compose.prod.yml: remove worker
  and redis services
- Remove PHP Redis extension from Dockerfile.web
- Set 900s timeouts across nginx, PHP-FPM, gunicorn, curl, and Cloud Run
- Update cleanup.py: remove result_images pattern (now on GCS), add
  rate_limits cleanup
- Update .env.example: replace Redis vars with Cloud Run/GCS config

Cloud Run service deployed to:
  https://pdf-checker-bcb6ipdqka-uc.a.run.app
GCS bucket: gs://optical-pdf-images (7-day lifecycle, public read)
GCP project: optical-414516

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 14:50:38 -06:00

41 lines
1.6 KiB
Text

# Enterprise PDF Accessibility Checker - Environment Variables
# Copy this file to .env and fill in your API keys
# Anthropic Claude API Key (required for AI image analysis)
# Get your key from: https://console.anthropic.com/
ANTHROPIC_API_KEY=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
# Google Cloud Vision API (OPTIONAL - for enhanced image analysis)
# IMPORTANT: Comment out or remove lines you're not using!
#
# Option 1: Use credentials file path (UNCOMMENT and set path if using)
# GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/google-credentials.json
# Option 2: Or use API key directly (UNCOMMENT and set key if using)
GOOGLE_API_KEY=AIzaSyDWVxBWiDTeECqapiUpbXJadrxqcoA9tus
# Note: You only need ONE of the Google options above, not both
# The credentials file method is recommended for production use
# Development mode - set to 'true' for localhost auth bypass
DEV_MODE=true
# Database (PostgreSQL) - used in Docker setup
DB_HOST=postgres
DB_PORT=5432
DB_NAME=pdf_checker
DB_USER=pdf_checker
DB_PASSWORD=change_me_in_production
# Cloud Run - PDF processing service
# Set this to your deployed Cloud Run URL (leave empty for local Python fallback)
CLOUD_RUN_URL=https://pdf-checker-bcb6ipdqka-uc.a.run.app
# Path to GCP service account key for authenticating to Cloud Run
GCP_SA_KEY_PATH=./pdf-api-invoker-key.json
# GCS bucket for page images
GCS_BUCKET_NAME=optical-pdf-images
# Azure AD / MSAL Authentication
AZURE_TENANT_ID=e519c2e6-bc6d-4fdf-8d9c-923c2f002385
AZURE_CLIENT_ID=9079054c-9620-4757-a256-23413042f1ef
AZURE_REDIRECT_URI=https://ai-sandbox.oliver.solutions/pdf-accessibility