Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
9d9ff44
added rabbitmq to docker; scripts to test mq flow
rajumb502 May 15, 2026
70e6e7c
working local dev setup
rajumb502 May 21, 2026
9d584a2
working local setup
rajumb502 May 22, 2026
755c0aa
automated a left over manual steps
rajumb502 May 23, 2026
fd3eb8e
auto seed after local test bed creation
rajumb502 May 24, 2026
5f40ad5
minor formatting changes
rajumb502 May 24, 2026
93d1f7c
fixed feedback queue consumer for local testbed
rajumb502 May 24, 2026
2300ceb
added db migration call
rajumb502 Jun 2, 2026
0df154e
added structured logs
rajumb502 Jun 11, 2026
c81729e
rafactored log emission
rajumb502 Jun 11, 2026
76ac68a
updated start local script to use docker
rajumb502 Jun 11, 2026
1066420
documented cross service interactions between the 4 TAP services
rajumb502 Jun 11, 2026
3ce8a2e
local setup script using podman instead of docker.
rajumb502 Jun 14, 2026
bae2eeb
added separate container for tap_plg
rajumb502 Jun 16, 2026
daec228
Update start_local_podman.sh
rajumb502 Jun 16, 2026
a8eb2d3
Merge branch 'pla-v2-no-es' into pal-v2-health
rajumb502 Jun 17, 2026
aea0dfa
fixes after branch merge
rajumb502 Jun 18, 2026
3758100
changed emit_structured_log to _emit
rajumb502 Jun 18, 2026
7873b5b
changed _emit to emit
rajumb502 Jun 18, 2026
429289b
added/replaced frappe.logger with emit
rajumb502 Jun 18, 2026
4bc704d
added more logs
rajumb502 Jun 19, 2026
272f886
added more logs
rajumb502 Jun 19, 2026
b8933ad
added ValidationError to non-retryable error
rajumb502 Jun 21, 2026
90427db
set local settings after restoring dev DB
rajumb502 Jun 22, 2026
281f9f5
separate rag container in local dev
rajumb502 Jun 23, 2026
8290d7e
minor refactoring in start/seed scripts
rajumb502 Jun 23, 2026
c9559cf
added mandatory fields in seed_local.py
rajumb502 Jun 23, 2026
8d16f0d
fixed bug in ProgramEnrollment seeding
rajumb502 Jun 23, 2026
45ccd9d
docker compose to get rabbitmq vars from env file
rajumb502 Jun 26, 2026
6cd68c8
Configure Google credentials script
rajumb502 Jun 26, 2026
b9d3c6c
minor change in end of script comment
rajumb502 Jun 26, 2026
bb63657
refactored container creation
rajumb502 Jun 26, 2026
8a3313e
fixed issues post refactor of start podman script
rajumb502 Jun 27, 2026
0d5f6f8
added AttributeError to non retryable errors & minor formatting issues
rajumb502 Jun 27, 2026
619c118
modified final message in start script
rajumb502 Jun 27, 2026
250aae6
added logs to jobs triggered by RQ
rajumb502 Jun 29, 2026
1e6a65a
refactored seeding; separated API Key from Auth key
rajumb502 Jun 30, 2026
1f3917f
added more logs
rajumb502 Jun 30, 2026
101b481
updated system understanding doc
rajumb502 Jul 1, 2026
fea36b6
emit structured logs to separate file
rajumb502 Jul 6, 2026
e8547c7
Update monitoring.py
rajumb502 Jul 7, 2026
f02eb53
added timeout parameters to pika connection
rajumb502 Jul 8, 2026
5be616e
added instructions for manual testing
rajumb502 Jul 8, 2026
05f7131
increased interval for heartbeats in local setup
rajumb502 Jul 8, 2026
330ba7f
filter out heartbeat logs in stubs
rajumb502 Jul 8, 2026
4eb3c75
updated doc for Rotational logs
rajumb502 Jul 8, 2026
693fa03
script to reset test data after each round
rajumb502 Jul 8, 2026
7c6d920
added comment for resolving clash if using dev lms
rajumb502 Jul 14, 2026
67496b7
print error logs for unhandled exceptions
rajumb502 Jul 16, 2026
405b0fb
added logs for scheduler
rajumb502 Jul 20, 2026
db77d2e
updated submission example in start_local_podman script
rajumb502 Jul 27, 2026
e2a340c
added doc for setting up server
rajumb502 Jul 28, 2026
85756f6
added SITE_NAME env var for LMS consumer
rajumb502 Jul 29, 2026
ed38a2a
added instructions to start lms consumer
rajumb502 Jul 29, 2026
e2f0761
Intentional operator monitoring alerts marked as separate category
rajumb502 Jul 29, 2026
8b43d6a
added ops agent config yaml
rajumb502 Jul 29, 2026
a6908e8
fixed issue in ops agent config
rajumb502 Jul 29, 2026
037ad7e
fix time format issue in ops agent config
rajumb502 Jul 29, 2026
5b0b784
added back timestamp format in ops agent config
rajumb502 Jul 29, 2026
a3a7027
reverted time format fix
rajumb502 Jul 29, 2026
10617b3
Added more details on ops agent config.
rajumb502 Jul 31, 2026
64aa7ca
fix timestamp handling in ops config yaml
rajumb502 Aug 3, 2026
b6ee87d
made tap_llm console_consumer similar to rag service's
rajumb502 Aug 3, 2026
ff0d88d
updated server setup doc
rajumb502 Aug 5, 2026
a903799
Fixed issues in ops config
rajumb502 Aug 11, 2026
5ec20dd
updated server setup for https config.
rajumb502 Aug 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Postman/
.env.*
!.env.example
env.local
*.bak
scripts/private/*
273 changes: 273 additions & 0 deletions docker/local/docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
name: tap_lms_local

# ── Changes from the original docker-compose.yml ─────────────────────────────
#
# Added/Updated services:
# tap_plg_worker + tap_plg_api + tap_plg_postgres — real ML service
# llm-stub — fake OpenAI/TogetherAI/VertexAI (no real LLM calls)
# glific-stub — fake Glific GraphQL API (no real WhatsApp messages)
#
# Container count: 10 total
# dev-lms, postgres, redis-cache, redis-queue, rabbitmq,
# tap_plg_postgres, tap_plg_worker, tap_plg_api, llm-stub, glific-stub

services:
# ── Frappe dev container (tap_lms) ──────────────────────────

dev-lms:
user: "${UID:-1000}:${GID:-1000}"
build:
context: ../..
dockerfile: docker/local/Dockerfile
container_name: tap_lms_dev
# Runs the idempotent bootstrap, then bench + both consumers, so a
# plain `podman-compose up` is enough on its own — no more manual
# `exec ... bash -lc '...'` steps required after the containers exist.
# Override with `command: sleep infinity` if you'd rather exec in
# and drive things by hand.
command: ["bash", "/workspace/frappe_tap/scripts/entrypoint.sh"]
restart: on-failure
depends_on:
postgres:
condition: service_healthy
redis-cache:
condition: service_started
redis-queue:
condition: service_started
rabbitmq:
condition: service_started
glific-stub:
condition: service_started
tap_plg_api:
condition: service_started
llm-stub:
condition: service_started
env_file:
- ../../env.local
environment:
SHELL: /bin/bash
GLIFIC_API_URL: http://glific-stub:4000
APP_ENV: dev
STUB_MODE: "0"
# rag_service's isolated venv reuses downloaded wheels across
# rebuilds via this cache, so even a forced reinstall (changed
# requirements.txt) doesn't re-download numpy/opencv/etc. from
# the network every time.
PIP_CACHE_DIR: /home/frappe/.cache/pip
ports:
- "${WEB_PORT:-8000}:8000"
- "${SOCKETIO_PORT:-9000}:9000"
volumes:
- bench-data:/home/frappe/frappe-bench
- ../..:/workspace/frappe_tap:cached,z
- ../../../rag_service:/workspace/rag_service:cached,z
# Named volumes so the rag_service venv and its pip download
# cache survive container recreation (down/up, --build, etc.)
# instead of being rebuilt from scratch every time.
- rag-venv-data:/home/frappe/rag_venv
# Mount the local folder for pip cache so it survives
# volume deletions. the :U flag changes the UID/GID to
# that of the container.
- ~/.cache/pip-docker-cache:/home/frappe/.cache/pip:z,U
working_dir: /home/frappe

# ── PostgreSQL (Frappe) ────────────────────────────────────────────────────
postgres:
image: postgres:15
container_name: tap_lms_postgres
environment:
POSTGRES_USER: "${POSTGRES_USER:-postgres}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-postgres}"
POSTGRES_DB: "${POSTGRES_DB:-postgres}"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
interval: 5s
timeout: 5s
retries: 20
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres-data:/var/lib/postgresql/data

# ── Redis cache ────────────────────────────────────────────────────────────
redis-cache:
image: redis:7-alpine
container_name: tap_lms_redis_cache
ports:
- "${REDIS_CACHE_PORT:-6379}:6379"

# ── Redis queue ────────────────────────────────────────────────────────────
redis-queue:
image: redis:7-alpine
container_name: tap_lms_redis_queue
ports:
- "${REDIS_QUEUE_PORT:-6380}:6379"

# ── RabbitMQ ───────────────────────────────────────────────────────────────
rabbitmq:
image: docker.io/library/rabbitmq:4-management
container_name: tap_lms_rabbitmq
ports:
- "5672:5672"
- "15672:15672"
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest

# ── tap_plg PostgreSQL (pgvector) ──────────────────────────────────────────
tap_plg_postgres:
image: pgvector/pgvector:pg16
container_name: tap_lms_plg_postgres
environment:
POSTGRES_DB: plagiarism_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d plagiarism_db"]
interval: 5s
timeout: 5s
retries: 20
ports:
- "5433:5432"
volumes:
- tap_plg_postgres_data:/var/lib/postgresql/data

# ── tap_plg worker (Real ML Service) ──────────────────────────────────────
tap_plg_worker:
build:
context: ../../../tap_plg
dockerfile: Dockerfile
container_name: tap_lms_plg_worker
environment:
RABBITMQ_HOST: "${RABBITMQ_HOST:-rabbitmq}"
RABBITMQ_PORT: "${RABBITMQ_PORT:-5672}"
RABBITMQ_USER: "${RABBITMQ_USERNAME:-guest}"
RABBITMQ_PASS: "${RABBITMQ_PASSWORD:-guest}"
RABBITMQ_VHOST: "${RABBITMQ_VIRTUAL_HOST:-/}"
SUBMISSION_QUEUE: "${RABBITMQ_SUBMISSION_QUEUE:-submission_queue}"
FEEDBACK_QUEUE: "${RABBITMQ_PLAGIARISM_RESULTS_QUEUE:-plagiarism_feedback}"
POSTGRES_HOST: tap_plg_postgres
POSTGRES_PORT: 5432
POSTGRES_DB: plagiarism_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
CLIP_MODEL: "${CLIP_MODEL:-ViT-B/32}"
CLIP_PRETRAINED: "${CLIP_PRETRAINED:-openai}"
USE_PGVECTOR: "true"
MOCK_GLIFIC: "true"
APP_ENV: dev
LOG_LEVEL: INFO
# Ensure all ML libraries use the persistent cache volume
HF_HOME: /root/.cache/huggingface
TORCH_HOME: /root/.cache/torch
XDG_CACHE_HOME: /root/.cache
HF_HUB_DISABLE_SYMLINKS: "1"
depends_on:
rabbitmq:
condition: service_started
tap_plg_postgres:
condition: service_started
volumes:
- ../../../tap_plg:/app:cached,z
- tap_plg_model_cache:/root/.cache:z

# ── tap_plg API ────────────────────────────────────────────────────────────
tap_plg_api:
build:
context: ../../../tap_plg
dockerfile: Dockerfile.api
container_name: tap_lms_plg_api
command:
[
"uvicorn",
"api.api:app",
"--host",
"0.0.0.0",
"--port",
"8000",
"--reload",
]
environment:
RABBITMQ_HOST: "${RABBITMQ_HOST:-rabbitmq}"
RABBITMQ_PORT: "${RABBITMQ_PORT:-5672}"
RABBITMQ_USER: "${RABBITMQ_USERNAME:-guest}"
RABBITMQ_PASS: "${RABBITMQ_PASSWORD:-guest}"
RABBITMQ_VHOST: "${RABBITMQ_VIRTUAL_HOST:-/}"
SUBMISSION_QUEUE: "${RABBITMQ_SUBMISSION_QUEUE:-submission_queue}"
FEEDBACK_QUEUE: "${RABBITMQ_PLAGIARISM_RESULTS_QUEUE:-plagiarism_feedback}"
APP_ENV: dev
LOG_LEVEL: INFO
ports:
- "${TAP_PLG_API_PORT:-8080}:8000"
depends_on:
rabbitmq:
condition: service_started
volumes:
- ../../../tap_plg:/app:cached,z
healthcheck:
test:
["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
interval: 30s
timeout: 5s
retries: 5

# ── LLM stub ──────────────────────────────────────────────────────────────
# Replaces OpenAI / TogetherAI / Vertex AI.
# Returns realistic randomised feedback JSON in OpenAI-compatible format.
# Deterministic per submission_id. Simulates 0.5–2s latency.
# Point rag_service LLM Settings → base_url at http://llm-stub:8001
llm-stub:
build:
context: ./llm_stub
dockerfile: Dockerfile
container_name: tap_lms_llm_stub
command:
[
"uvicorn",
"main:app",
"--host",
"0.0.0.0",
"--port",
"8001",
"--reload",
]
ports:
- "${LLM_STUB_PORT:-8001}:8001"
volumes:
- ./llm_stub:/app:z
healthcheck:
test:
["CMD-SHELL", "curl -f http://localhost:8001/health || exit 1"]
interval: 30s
timeout: 5s
retries: 3

# ── Glific stub ────────────────────────────────────────────────────────────
# Replaces the Glific GraphQL API. No real WhatsApp messages sent.
# Stubs all 8 operations used by tap_lms/glific_integration.py.
#
# Developer audit endpoints:
# GET http://localhost:4000/stub/flow-calls — all startContactFlow calls
# GET http://localhost:4000/stub/contacts — all contacts created
# GET http://localhost:4000/stub/reset — clear state between tests
glific-stub:
build:
context: ./glific_stub
dockerfile: Dockerfile
container_name: tap_lms_glific_stub
ports:
- "${GLIFIC_STUB_PORT:-4000}:4000"
healthcheck:
test:
["CMD-SHELL", "curl -f http://localhost:4000/health || exit 1"]
interval: 30s
timeout: 5s
retries: 3

volumes:
bench-data:
postgres-data:
tap_plg_postgres_data:
tap_plg_model_cache:
rag-venv-data:
pip-cache:
13 changes: 12 additions & 1 deletion docker/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ services:
condition: service_started
redis-queue:
condition: service_started
rabbitmq:
condition: service_started
env_file:
- ../../env.local
environment:
Expand All @@ -23,7 +25,7 @@ services:
- "${SOCKETIO_PORT:-9000}:9000"
volumes:
- bench-data:/home/frappe/frappe-bench
- ../..:/workspace/frappe_tap:cached
- ../..:/workspace/frappe_tap:cached,z
working_dir: /home/frappe

postgres:
Expand Down Expand Up @@ -55,6 +57,15 @@ services:
ports:
- "${REDIS_QUEUE_PORT:-6380}:6379"

rabbitmq:
image: docker.io/library/rabbitmq:4-management
ports:
- "5672:5672" # AMQP protocol port
- "15672:15672" # Web Management Dashboard
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest

volumes:
bench-data:
postgres-data:
16 changes: 16 additions & 0 deletions docker/local/glific_stub/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.11-slim

WORKDIR /app

RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY main.py .

EXPOSE 4000

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "4000", "--log-level", "info"]
Loading