Local Development

If you are new here, read everything and follow the steps the end.

Develop and Test Locally

We have written a script that makes it easy to run this on any local machine (Mac, WSL2). Only deploy the services you need. This script depends on the env values in .env-dev.

$ ./scripts/run.sh <one or more service names that you are testing>
# names of the services - api, channel, language, flow, retriver, indexer

It's important that we test the data contracts (input / output JSONs) for our service. Run the service in one window, send JSON message to Kafka via another and read the messages generated by your service in another.

# create topics (queues) on kafka
./scripts/create-topic.sh topic_name

# send message to your service
./scripts/send-message.sh topic <json>

# read messages from your service
./scripts/read-message.sh topic

Setting up Local DB

Connecting to database

It will prompt for password.

  • flow - adding a user

  • flow - checking state stored in the db

Data Contracts

See the Pydantic models lib/data_models.py

API

Indexer

topic: indexer message:

Steps

  1. Create environment by copying .env-dev.template to .env-dev. Update the values if required. You can look at the larger list of constants in .env

  2. Bring up the service e.g. api

  1. Make any modifications to the database

  1. Setup a listener to the queue

  1. Test the data contracts by sending a message to the queue or api

  1. Check the database by using DBeaver

Reseting Dev Environment

Often there are times when it's better to start from scratch.

Last updated

Was this helpful?