Skip to content

Running the Application

All four services must be running simultaneously. Use a separate terminal for each.

Services

1. Redis

bash
redis-server

Required by RQ (job queue) and session management.

2. Prefect Server + Worker

bash
bash start_prefect.sh

Starts the Prefect API server and worker on port 4201.

3. RQ Background Worker

bash
./venv/bin/python worker.py

Processes webhook and Fineract jobs from the Redis queue.

4. Quart Web Server

bash
./venv/bin/python app.py

Runs the async web server on port 5002.

Running Prefect Flows Manually

When running Prefect flows from a separate terminal, set the API URL first:

bash
export PREFECT_API_URL=http://127.0.0.1:4201/api

S3 Processing

bash
# All lenders
./venv/bin/python tasks/flows/s3_processing.py

# Specific lender
./venv/bin/python tasks/flows/s3_processing.py arthmate
./venv/bin/python tasks/flows/s3_processing.py ugro_razorpay

Repayment Pipeline

bash
# Standard run (includes dbt refresh)
./venv/bin/python tasks/flows/webhook_repayment_pipeline.py

# Skip dbt (if you just ran it)
./venv/bin/python tasks/flows/webhook_repayment_pipeline.py --skip-dbt

# Dry run - inspect queue without posting
./venv/bin/python tasks/flows/webhook_repayment_pipeline.py --dry-run

Running dbt

All dbt commands must be run from the dbt/ directory:

bash
cd dbt/

# Run all models
./venv/bin/dbt run

# Run specific model
./venv/bin/dbt run --select 'base_ugro_razorpay_api'

# Run tests
./venv/bin/dbt test

Or from the project root:

bash
./venv/bin/dbt run --project-dir dbt/ --profiles-dir ~/.dbt/

Logging

ProcessLog Location
Web serverlogs/YYYY-MM-DD/app.log
RQ workerlogs/YYYY-MM-DD/worker.log
S3 uploads3://turnofile/logs/YYYY-MM-DD/

After each S3 processing flow, logs are automatically uploaded to S3.

Turno Fineract LMS Documentation