Skip to content

Local Development

Local Development

This guide walks through setting up a local Koku development environment using Docker Compose.

Prerequisites

  • Docker or Podman with Docker Compose (or podman-compose)
  • Git
  • Python 3.11+ and pipenv (for running tests and nise)

Clone and Start

git clone https://github.com/project-koku/koku.git
cd koku

Koku provides several Docker Compose targets depending on what you need:

CommandWhat it starts
make docker-upFull stack (database, Koku API, Masu, worker, Trino, MinIO, Redis, Kafka)
make docker-up-minMinimal (database, Koku API, Masu, worker)
make docker-up-min-trinoMinimal + Trino
make docker-up-onpremOn-prem mode (core + Kafka, no Trino/S3)

For most development work, the minimal target is sufficient:

make docker-up-min

The Koku API will be available at http://localhost:8000.

Generate Test Data

Nise generates synthetic cost and usage data for all supported providers. Install it and load sample data:

pip install koku-nise

Nise can generate data for AWS, Azure, GCP, and OpenShift. See the nise documentation for detailed usage.

Verify the API

Once the stack is running and data is loaded, query the API:

curl -s http://localhost:8000/api/cost-management/v1/status/ | python -m json.tool

Environment Variables

Key environment variables are configured in the .env file at the repository root. The most important ones:

VariableDefaultPurpose
POSTGRES_SQL_SERVICE_HOSTlocalhostPostgreSQL host
DATABASE_NAMEkokuDatabase name
REDIS_HOSTlocalhostRedis host
S3_ENDPOINTS3/MinIO endpoint (optional for minimal mode)
TRINO_HOSTTrino host (optional for minimal mode)
DEVELOPMENTTrueEnables development identity middleware

Running Tests

pipenv install --dev
pipenv run tox

Run a specific test:

pipenv run tox -- koku/api/test/test_status.py::StatusViewTest::test_status

Next Steps