PolicyIQ is a distributed, microservice-based ingestion platform for compliance analytics.
- Ingestion Service: Authenticates and accepts events.
- Queue Service: Durable SQLite-based FIFO queue.
- Validation Service: Polls queue, deduplicates, and validates.
- Enrichment Service: Adds sensitivity scores.
- Compliance Service: Evaluates policy rules.
- Anomaly Service: Detects behavioral anomalies (Z-score).
- Salesforce Sink: Pushes governed data to Data Cloud.
-
Build and Run:
docker-compose up --build -d
-
Send Event:
curl -X POST http://localhost:8000/events \ -H "Content-Type: application/json" \ -H "X-API-Key: secret" \ -d @sample_event.json
-
Check Queue Size:
curl -X GET http://localhost:8001/size
-
View Logs:
docker-compose logs -f
- Shared Library: Located in
shared/, copied to all services. - Configuration: Environment variables (see
docker-compose.yml). - Ports:
- Ingestion: 8000 (Internal target 8000)
- Queue: 8001 (Internal target 8000)
-
Stop Downstream Service:
docker-compose stop compliance-service
-
Expect Queue Growth (Validation Service will retry, then backoff):
curl -X GET http://localhost:8001/size
-
Trigger Permanent Failure (DLQ): Wait for retries to exhaust. Check DLQ:
docker-compose exec queue-service sqlite3 /data/queue.db "SELECT COUNT(*) FROM dead_letter_events"
-
Restart Service:
docker-compose start compliance-service
-
Trigger Replay (Optional):
curl -X POST http://localhost:8001/replay
I have provided a script to verify compatibility end-to-end.
-
Ensure Stack is Running:
docker-compose up -d
-
Run Test Script:
# Requires python installed locally pip install httpx python tests/e2e_verify.pyThis script will:
- Check Ingestion and Queue health.
- Post a test event.
- Verify valid Trace ID return.
- Verify Queue processing drainage.
-
Advanced: Verify Internal Services: To confirm all internal microservices are running and reachable:
docker-compose exec ingestion-service python -c "import httpx; s=['http://queue-service:8000','http://validation-service:8000','http://enrichment-service:8000','http://compliance-service:8000','http://anomaly-service:8000','http://salesforce-sink:8000']; [print(u, '->', httpx.get(u+'/health').status_code) for u in s]"
Expected Output: All services return
-> 200.