Commit graph

7 commits

Author SHA1 Message Date
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
Vadym Samoilenko
2441d124f9 Fix path mismatch between Apache and Docker worker
Mount uploads/results at the same absolute path as host so
pdf_path stored by api.php matches inside the container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:46:54 +00:00
Vadym Samoilenko
102e11725c Use ports 1220/1221 for Redis/PostgreSQL to avoid host conflicts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:30:41 +00:00
Vadym Samoilenko
19588dd914 Use host Redis and PostgreSQL instead of containerized
Server already has Redis and PostgreSQL running. Worker uses
network_mode: host to connect directly, no port conflicts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:30:05 +00:00
Vadym Samoilenko
ceacfc356b Fix redis port conflict on production server
Use REDIS_PORT env var (default 6380) to avoid clash with host Redis on 6379.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:28:30 +00:00
Vadym Samoilenko
d02ac33912 Fix postgres port conflict on production server
Use DB_PORT env var (default 5433) to avoid clash with host PostgreSQL on 5432.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:26:23 +00:00
Vadym Samoilenko
112719b2c5 Add Docker stack, frontend redesign, and visual page inspector fix
- Redesigned frontend with Outfit/Figtree typography, coral accent palette,
  noise texture, glassmorphism header, and staggered animations
- Split monolithic index.html into modular JS (app, api, upload, batch,
  results, page-viewer, utils) and extracted CSS
- Fixed worker.py to generate page images for Visual Page Inspector
- Added Docker Compose stack (web, worker, redis, postgres)
- Added batch upload, HTML report export, rate limiting, and Redis queue
- Extended test suite with checker, remediation, worker, and DB tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:12:44 +00:00