TR
Interpol kırmızı liste verilerini periyodik olarak çekip RabbitMQ kuyruğuna yazan, oradan tüketip PostgreSQL’e kaydeden ve FastAPI tabanlı bir web arayüzünde canlı olarak gösteren mikroservis projesi.
- Fetcher (Container A): Interpol Red Notice verisini çeker, RabbitMQ’ya mesaj olarak yayınlar.
- Web Server (Container B): RabbitMQ’dan mesaj tüketir, PostgreSQL’e kaydeder, web arayüzünde listeler.
- RabbitMQ (Container C): Mesaj kuyruğu sistemi, Management UI ile gözlemleme.
- FastAPI + Jinja2 ile basit ve hızlı web arayüzü.
- RabbitMQ üzerinden producer/consumer mimarisi.
- SQLAlchemy ORM ile PostgreSQL kalıcı depolama.
- Docker Compose ile tek komutla build ve orkestrasyon.
- .env ile konfigürasyon, kod değiştirmeden ayar yönetimi.
- Test modu (TEST_MODE) ile gerçek API olmadan mock veri akışı.
- Docker 20.10+ ve Docker Compose
- 2 GB+ RAM önerilir (RabbitMQ + PostgreSQL için)
- Depoyu klonla
- git clone https://github.com/aakcay5656/interpol-notice-tracker.git
- cd interpol-notice-tracker
- .env dosyasını hazırla
- .env içeriği:
- RABBITMQ_USER=admin
- RABBITMQ_PASSWORD=admin123
- RABBITMQ_QUEUE=interpol_notices
- POSTGRES_USER=interpol_user
- POSTGRES_PASSWORD=interpol_pass
- POSTGRES_DB=interpol_db
- INTERPOL_API_URL=https://ws-public.interpol.int/notices/v1/red
- FETCH_INTERVAL=30
- RESULTS_PER_PAGE=20
- TEST_MODE=true
- Servisleri başlat
- docker-compose up --build
- Arayüzler
- Web Uygulaması: http://localhost:8000
- RabbitMQ UI: http://localhost:15672 (admin/admin123)
- container_a: Veri toplayıcı (curl-cffi + pika)
- container_b: Web sunucu (FastAPI, SQLAlchemy, Jinja2)
- docker-compose.yml: Orkestrasyon
- tests: Basit entegrasyon testleri
- Fetcher, INTERPOL_API_URL adresinden periyodik GET isteği yapar ve notice’leri tek tek RabbitMQ kuyruğuna gönderir
- Web Server, RabbitMQ kuyruğunu dinler, mesajları PostgreSQL’e yazar ve / üzerinden HTML tablo olarak gösterir
- Kayıt güncellenirse arayüzde “GÜNCELLENDİ” olarak vurgulanır.
- Tüm ayarlar .env ile yapılır:
- FETCH_INTERVAL: Saniye cinsinden çekme periyodu
- RESULTS_PER_PAGE: API’dan sayfa başına çekilecek kayıt
- TEST_MODE: true ise mock veri üretilir
- docker-compose.yml, .env içindeki değişkenleri kullanır.
- Kuyruk adı: interpol_notices
- Kalıcılık: queue durable, mesaj delivery_mode=2 ile kalıcı.
- İzleme: RabbitMQ UI üzerinden Queues sekmesi.
- PostgreSQL servis adı: db
- Varsayılan bağlantı: postgresql://interpol_user:interpol_pass@db:5432/interpol_db
- Tablo: interpol_notices (entity_id PK, JSON alanları, timestamp alanları)
- Kod formatı ve yorumlar PEP8 uyumlu tutulmuştur.
- Test modu: TEST_MODE=true iken fetcher gerçek API yerine mock notice üretir.
- Container log’ları:
- docker logs interpol_fetcher
- docker logs interpol_webserver
- 403 Forbidden (API): Browser’da çalışıp kodda çalışmıyorsa anti-bot korumalarından dolayı curl-cffi ile browser impersonation kullanılır.
- “database does not exist”: Eski volume çakışmaları için docker-compose down -v ardından yeniden başlatın.
- Healthcheck hataları: Postgres healthcheck’te -d ${POSTGRES_DB} parametresi kullanın.
- Dockerizing Celery and FastAPI - TestDriven.io
- FastAPI + Celery + Flower + RabbitMQ + Redis Example
- Building a FastAPI Application with Celery, RabbitMQ, and PostgreSQL
- FastAPI + PostgreSQL + RabbitMQ + Docker Example
- Python ML in Production - FastAPI + Celery with Docker
- FastAPI Template Issues - Open Collective
- FastAPI + PostgreSQL + Celery + RabbitMQ + Redis Backend Discussion
- MIT Lisansı
EN
A microservices project that periodically fetches Interpol red notice data, publishes it to RabbitMQ queue, consumes from the queue to store in PostgreSQL, and displays live updates through a FastAPI-based web interface.
- Fetcher (Container A): Fetches Interpol Red Notice data and publishes messages to RabbitMQ
- Web Server (Container B): Consumes messages from RabbitMQ, stores them in PostgreSQL, and displays them via web interface
- RabbitMQ (Container C): Message queue system with Management UI for monitoring
- Simple and fast web interface with FastAPI + Jinja2
- Producer/consumer architecture over RabbitMQ
- Persistent storage with PostgreSQL using SQLAlchemy ORM
- Single-command build and orchestration with Docker Compose
- Configuration via .env file without code changes
- Test mode (TEST_MODE) with mock data flow without real API
- Docker 20.10+ and Docker Compose
- 2 GB+ RAM recommended (for RabbitMQ + PostgreSQL)
- Clone the repository
cd interpol-notice-tracker
- Prepare .env file
RABBITMQ_USER=admin
RABBITMQ_PASSWORD=admin123
RABBITMQ_QUEUE=interpol_notices
POSTGRES_USER=interpol_user
POSTGRES_PASSWORD=interpol_pass
POSTGRES_DB=interpol_db
INTERPOL_API_URL=https://ws-public.interpol.int/notices/v1/red
FETCH_INTERVAL=30
RESULTS_PER_PAGE=20
TEST_MODE=true
- Start services
docker-compose up --build
- Access interfaces
- Web Application: http://localhost:8000
- RabbitMQ UI: http://localhost:15672 (admin/admin123)
- container_a: Data collector (curl-cffi + pika)
- container_b: Web server (FastAPI, SQLAlchemy, Jinja2)
- docker-compose.yml: Orchestration
- tests: Basic integration tests
- Fetcher makes periodic GET requests to INTERPOL_API_URL and sends notices one by one to RabbitMQ queue
- Web Server listens to RabbitMQ queue, writes messages to PostgreSQL, and displays them as HTML table on /
- When a record is updated, it is highlighted as "UPDATED" in the interface
All settings are configured via .env:
- FETCH_INTERVAL: Fetch period in seconds
- RESULTS_PER_PAGE: Number of records to fetch per page from API
- TEST_MODE: If true, generates mock data
- docker-compose.yml uses variables from .env file
- Queue name: interpol_notices
- Persistence: queue durable, message delivery_mode=2 for persistence
- Monitoring: Queues tab in RabbitMQ UI
- PostgreSQL service name: db
- Default connection: postgresql://interpol_user:interpol_pass@db:5432/interpol_db
- Table: interpol_notices (entity_id PK, JSON fields, timestamp fields)
- Code format and comments follow PEP8 standards
- Test mode: When TEST_MODE=true, fetcher generates mock notices instead of real API
- Container logs:
docker logs interpol_fetcher
docker logs interpol_webserver
- 403 Forbidden (API): If it works in browser but not in code, curl-cffi with browser impersonation is used due to anti-bot protections
- "database does not exist": For old volume conflicts, run
docker-compose down -vthen restart - Healthcheck errors: Use -d ${POSTGRES_DB} parameter in Postgres healthcheck
- Dockerizing Celery and FastAPI - TestDriven.io
- FastAPI + Celery + Flower + RabbitMQ + Redis Example
- Building a FastAPI Application with Celery, RabbitMQ, and PostgreSQL
- FastAPI + PostgreSQL + RabbitMQ + Docker Example
- Python ML in Production - FastAPI + Celery with Docker
- FastAPI Template Issues - Open Collective
- FastAPI + PostgreSQL + Celery + RabbitMQ + Redis Backend Discussion
MIT License