Reusable local infrastructure repo for development across different projects.
This repo is built around three rules:
- Compose files define services only
- default values live in
env/ - the root
.env.examplestays tiny and is used only for project-specific overrides
Compose files do not contain fallback defaults like
${VAR:-value}.If a required variable is missing from the merged env set, Docker Compose should fail immediately. That is intentional.
cp .env.example .env.projectThen adjust only what is project-specific.
For example, to start postgres and kafka:
python3 local_infra.py up postgres kafkaStart the Confluent Platform Kafka stack:
python3 local_infra.py up cp-kafkaStart the same stack with Kafka REST Proxy enabled:
python3 local_infra.py up cp-kafka-restStart a slim Airflow stack for local DAG testing:
python3 local_infra.py up airflowStart the same Airflow stack in stateful mode:
python3 local_infra.py --stateful up airflowStart the same stack with persistent volumes:
python3 local_infra.py --stateful up postgres kafkaStart only Postgres:
python3 local_infra.py up postgresPreview the exact Docker Compose command:
python3 local_infra.py --dry-run up postgres kafkaUse an extra override file:
python3 local_infra.py --env-file .env.project up postgres kafkaKeep these extra override files outside env/ so env/ remains reserved for service defaults only.
python3 local_infra.py [--env-file PATH] [--dry-run] [--stateful] <command> [services...]Commands:
updownconfiglist
Examples:
python3 local_infra.py list
python3 local_infra.py up kafka postgres
python3 local_infra.py --stateful up kafka postgres
python3 local_infra.py up cp-kafka
python3 local_infra.py config kafkaService name and aliases: postgres, pg
Description: Single-node PostgreSQL database.
| Configurable env | What it does | Default |
|---|---|---|
POSTGRES_IMAGE_TAG |
Chooses Postgres image tag. | 16-alpine |
POSTGRES_PORT |
Exposes Postgres on host port. | 5432 |
POSTGRES_DB |
Creates default database name. | local |
POSTGRES_USER |
Creates default database user. | postgres |
POSTGRES_PASSWORD |
Sets default user password. | postgres |
Service name and aliases: kafka, kafka-ui, kafkaui
Description: Single-node Kafka, KRaft mode, includes UI.
| Configurable env | What it does | Default |
|---|---|---|
KAFKA_IMAGE_TAG |
Chooses Kafka image tag. | latest |
KAFKA_PORT |
Exposes Kafka broker on host. | 9092 |
KAFKA_CONTROLLER_PORT |
Exposes Kafka controller on host. | 0 |
KAFKA_CLUSTER_ID |
Sets the single-node KRaft ID. | MkU3OEVBNTcwNTJENDM2Qk |
KAFKA_UI_IMAGE_TAG |
Chooses Kafka UI image tag. | v0.7.2 |
KAFKA_UI_PORT |
Exposes Kafka UI on host. | 8080 |
KAFKA_UI_CLUSTER_NAME |
Labels the cluster inside the UI. | local |
Service name and aliases: cp-kafka, cpkafka, cp-kafka-ui
Description: Single-node Confluent Platform Kafka, KRaft mode, includes Schema Registry and UI.
| Configurable env | What it does | Default |
|---|---|---|
CP_KAFKA_PLATFORM_TAG |
Chooses the Confluent Platform image tag. | 7.6.1 |
CP_KAFKA_UI_IMAGE_TAG |
Chooses Kafka UI image tag. | v0.7.2 |
CP_KAFKA_PORT |
Exposes Kafka broker on host. | 29092 |
CP_KAFKA_CONTROLLER_PORT |
Exposes Kafka controller on host. | 0 |
CP_SCHEMA_REGISTRY_PORT |
Exposes Schema Registry on host. | 8081 |
CP_SCHEMA_REGISTRY_COMPATIBILITY_LEVEL |
Sets global Schema Registry compatibility. | BACKWARD |
CP_KAFKA_UI_PORT |
Exposes Kafka UI on host. | 8088 |
CP_KAFKA_CLUSTER_ID |
Sets the single-node KRaft ID. | MkU3OEVBNTcwNTJENDM2Qk |
CP_KAFKA_UI_CLUSTER_NAME |
Labels the cluster inside the UI. | cp-local |
Service name and aliases: cp-kafka-rest, cpkafkarest, cpkafkarest, kafkarest, kafka-rest
Description: Extension for cp-kafka that adds Kafka REST Proxy. Running cp-kafka-rest from the CLI automatically
includes the base cp-kafka stack.
| Configurable env | What it does | Default |
|---|---|---|
CP_KAFKA_PLATFORM_TAG |
Chooses the Confluent Platform image tag. | 7.6.1 |
CP_KAFKA_REST_PORT |
Exposes Kafka REST Proxy on host. | 8082 |
Service name and aliases: airflow, af
Description: Slim Airflow stack for local DAG development. Includes dedicated Postgres metadata DB, airflow-init,
webserver, and scheduler.
| Configurable env | What it does | Default |
|---|---|---|
AIRFLOW_IMAGE_TAG |
Chooses Airflow image tag. | 2.10.5 |
AIRFLOW_PORT |
Exposes Airflow UI on host. | 8085 |
AIRFLOW_EXECUTOR |
Selects the Airflow executor. | LocalExecutor |
AIRFLOW_UID |
Sets the runtime UID for mounted files. | 50000 |
AIRFLOW_ADMIN_USERNAME |
The default admin username. | admin |
AIRFLOW_ADMIN_PASSWORD |
The default admin password. | admin |
AIRFLOW_POSTGRES_DB |
Creates the Airflow metadata database. | airflow |
AIRFLOW_POSTGRES_USER |
Creates the Airflow metadata database user. | airflow |
AIRFLOW_POSTGRES_PASSWORD |
Sets the Airflow metadata database password. | airflow |
AIRFLOW__CORE__LOAD_EXAMPLES |
Enables or disables Airflow example DAGs. | false |
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION |
Controls pause state for new DAGs. | true |
Service name and aliases: s3
Description: Local S3-compatible object storage powered by LocalStack.
| Configurable env | What it does | Default |
|---|---|---|
S3_IMAGE_TAG |
Chooses LocalStack image tag. | latest |
S3_PORT |
Exposes the LocalStack edge API on host. | 4566 |
S3_REGION |
Sets the default AWS region for S3 emulation. | us-east-1 |
S3_ACCESS_KEY_ID |
Sets the access key for local AWS clients. | test |
S3_SECRET_ACCESS_KEY |
Sets the secret key for local AWS clients. | test |
S3_DEFAULT_BUCKETS |
Creates default bucket names at startup. | local |