How mihaibojin/waf-downloader works
Main Components
• Application Core (Cloudflare WAF Downloader Library):
• Core functionality within the “src/waf_logs” directory.
• This module handles communication with Cloudflare’s APIs, applies database schemas (notably from “src/waf_logs/resources/db”), processes the log data, and manages configuration such as schema application.
• CLI Interface:
• Shown as a separate component “src/waf_logs_cli” that utilizes the core library to provide a user-friendly command-line interface.
• Docker Container and Deployment Artifacts:
• Dockerfile(s) and the development environment definitions (in the .devcontainer directory) to represent the containerized builds.
• Incorporate Helm charts (found in the “charts/waf-downloader” directory) as an additional deployment mechanism in Kubernetes.
• Scripts and Task Automation:
• A block for the “scripts” and “Taskfile.yml” components, which contain helper scripts for building, testing, and deploying the project using both Docker and GitHub Actions.
• Database Interaction (Optional):
• External Services:
• Cloudflare: Represent Cloudflare’s API as an external system from which logs are downloaded.
• (Optionally) External CI/CD services indicated by GitHub Actions and pre-commit hooks.
Relationships and Data Flow
• If a DB connection is configured, the Application Core writes or updates log data in the Database. Otherwise, logs are sent to stdout.
• That build/deploy automation scripts trigger tasks that assemble these components, such as building the Docker image (“scripts/build-docker-image.bash”) and managing versioning.
Architectural Patterns and Design Principles
• Separation of Concerns:
• The project clearly separates the core functionality (downloading and processing logs) from the CLI interface and deployment configurations (Docker and Helm templates).
• Containerization:
• Usage of Docker for both development and production, with specific folders (.devcontainer, Dockerfile) to support a consistent environment.
• Automation and CI/CD:
• Optional Persistence:
• The database integration is optional, so clearly indicate an alternative path in the data flow (printing to stdout when no DB is configured).
Relevant Technologies and Frameworks
• Python and its dependencies are managed via “pyproject.toml” and “requirements*.txt” files.
• Container orchestration using Docker (and Helm for Kubernetes deployments).
• Continuous Integration with GitHub Actions and pre-commit hooks for code quality.