Skip to main content
Financial Benchmarking and Insights Tool

Local Environment with Docker

To simplify local development, the FBIT repository includes a centralized Docker Compose setup. This allows you to quickly stand up the necessary backing services (Database, Storage, Caching, etc.) required to run the Platform APIs, Data Pipeline, and Web application locally.

Prerequisites

  1. Install Docker Desktop (or Docker Engine if on Linux).
  2. Ensure Docker is running.

Quick Start

The shared Docker Compose configuration is located in the docker directory at the root of the repository.

  1. Navigate to the docker directory:

    cd docker
    
  2. Create a .env file for the docker-compose with the same contents as the example file .env.example.

  3. Start the services in detached mode:

    docker-compose up -d
    # Or depending on your Docker version:
    docker compose up -d
    

Debugging the data pipeline

Also included is configuration to run the data pipeline in debug mode. Your local pipeline folder will be mounted inside the pipeline container, so the container can be tweaked to test solutions.

make build-pipeline-debug

If using VS Code, there is a configuration to add to your .vscode/launch.json to attach the VS Code debugger to the running data pipeline container and debug it under docker/launch.json.example.

Services Provided

The docker-compose.yml file provisions the following services:

1. Azurite (Azure Storage Emulator)

Provides local emulation for Azure Blob Storage, Queue Storage, and Table Storage.

  • Image: mcr.microsoft.com/azure-storage/azurite
  • Ports:
    • Blob: 10000
    • Queue: 10001
    • Table: 10002
  • Interacting: Use Azure Storage Explorer and connect to the local emulator.

2. Azure SQL Edge

Provides a lightweight local SQL Server instance.

  • Image: mcr.microsoft.com/azure-sql-edge
  • Port: 1433
  • Credentials:
    • User ID: sa
    • Password: mystrong!Pa55word
  • Interacting: Connect using tools like Azure Data Studio, SQL Server Management Studio (SSMS), DataGrip, or sqlcmd.

3. Redis

Provides distributed caching for the Platform APIs.

  • Image: redis:6.2-alpine

  • Port: 6379

  • Credentials:

    • Password: The password you defined in redis.env
  • Debugging Locally:
    To debug or view Redis commands, you can attach to the container:

    # Open redis-cli inside the container
    docker exec -it redis redis-cli -a a_password_of_your_choice
    

    Once connected, you can run commands like GET test:key, DEL test:key, or MONITOR to watch incoming traffic.

4. Data Pipeline Worker

Runs the Python data pipeline worker locally.

  • Build Context: Uses the data-pipeline folder and builds from pipeline-worker/Dockerfile.

  • Note on Code Changes: Because this service builds an image from the data-pipeline source, Docker Compose will not automatically rebuild the image on code changes. If you modify files in the data-pipeline/src directory, you need to rebuild the service:

    docker compose build pipeline
    docker compose up -d pipeline
    

Teardown

To stop the services and remove the containers, run the following from the docker directory:

docker-compose down
Tip:

Note: Data volumes for SQL, Azurite, and Redis are mapped to local folders within the docker directory (e.g., docker/sql/data, docker/azurite/data). This means your data will persist between restarts. If you wish to completely wipe your local data, you can delete these mapped directories after stopping the containers.