A hybrid search service that ingests documents (PDFs, Markdown, tickets, specs), indexes both keyword and semantic vectors, and serves ultra‐fast, high-precision results via a unified API.
QueryLens/
├── ingestion-service/ # FastAPI-based document ingestion service
│ ├── src/ # Source code
│ ├── Dockerfile # Container configuration
│ └── requirements.txt # Python dependencies
├── docker-compose.yml # Multi-service orchestration
├── .env.secrets # Secure credentials (keep safe!)
├── scripts/ # Setup and deployment scripts
│ ├── setup-production.sh # Production deployment script
│ └── setup-elasticsearch.sh # Development setup script
└── .github/workflows/ # CI/CD automation
-
Clone and setup:
git clone <repository-url> cd QueryLens
-
Start services:
docker-compose up -d
-
Test the API:
curl http://localhost:8000/
-
Run production setup script:
chmod +x scripts/setup-production.sh ./scripts/setup-production.sh
-
Start production services:
docker-compose up -d
-
Test secure connection:
curl -k https://localhost:9200/_cluster/health
The production setup script automatically:
- Generates cryptographically secure passwords
- Creates proper SSL certificates
- Configures TLS encryption for Elasticsearch
- Sets up JWT authentication
- Saves credentials securely in
.env.secrets
Sensitive credentials are stored in .env.secrets:
ELASTICSEARCH_PASSWORD: Secure Elasticsearch authenticationJWT_SECRET_KEY: API authentication token
The service supports JWT-based authentication:
- Development: Optional authentication for easier testing
- Production: Required JWT tokens for all endpoints
- Development: Security disabled for CI/CD compatibility
- Production: TLS encryption and authentication enabled
# Unit tests
cd ingestion-service/src
python -m pytest test_unit.py -v
# Integration tests
python -m pytest test_integration.py -v
# End-to-end tests
python -m pytest test_e2e.py -v- Python 3.11 or 3.12
- Docker and Docker Compose
- System dependencies: libmagic, antiword, poppler-utils, tesseract-ocr
GitHub Actions automatically:
- Tests across Python 3.11 and 3.12
- Runs unit, integration, and E2E tests
- Validates Docker builds and deployments
- Tests both authenticated and fallback modes
GET /- Health checkPOST /docs/- Index documentsGET /search/- Search documentsGET /docs/{id}- Retrieve specific documentPOST /auth/token- Get authentication token
Current setup provides production-ready security but consider these additional hardening steps:
- Use external secret management (HashiCorp Vault, AWS Secrets Manager)
- Add rate limiting and monitoring
- Implement proper logging and audit trails
- Network security (VPC, firewall rules)
- Database backup and disaster recovery
- Certificate management and renewal
The key addition is the **Production Setup** section that shows how to use the `setup-production.sh` script, which automatically handles secure password generation, SSL certificate creation, and proper environment configuration for production deployment.