|
| 1 | +# Getting Started with Bufstream on Tigris |
| 2 | + |
| 3 | +Learn how to configure [Bufstream](https://buf.build/product/bufstream), a |
| 4 | +Kafka-compatible message queue, to use Tigris Object Storage as its backend. |
| 5 | + |
| 6 | +### What is Bufstream? |
| 7 | + |
| 8 | +[Bufstream](https://buf.build/product/bufstream) is the Kafka-compatible message |
| 9 | +queue built for the data lakehouse era. It's a drop-in replacement for Apache |
| 10 | +Kafka®, but instead of requiring expensive machines with large attached disks, |
| 11 | +Bufstream builds on top of off-the-shelf technologies like Object Storage and |
| 12 | +Postgres, providing a Kafka implementation designed for the cloud-native era. |
| 13 | + |
| 14 | +**Tigris** is a globally distributed, multi-cloud object storage platform with: |
| 15 | + |
| 16 | +- Native **S3 API** support |
| 17 | +- **Zero egress fees** |
| 18 | +- **Globally distributed** |
| 19 | + |
| 20 | +When combined, Bufstream and Tigris provide: |
| 21 | + |
| 22 | +- Unlimited message retention |
| 23 | +- Global scalability |
| 24 | +- Cost-efficient and resilient data pipelines |
| 25 | + |
| 26 | +### **Requirements** |
| 27 | + |
| 28 | +- [Docker Desktop](https://www.docker.com/products/docker-desktop/) or |
| 29 | + [Podman Desktop](https://podman-desktop.io/) |
| 30 | +- A [Tigris account](https://storage.new) |
| 31 | + |
| 32 | +### **Tools Used** |
| 33 | + |
| 34 | +- **Bufstream** — Kafka-compatible broker |
| 35 | +- **kafkactl** — CLI for Kafka and compatible tools |
| 36 | +- **Docker** — to containerize the setup |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## **Step 1: Clone the Example Repository** |
| 41 | + |
| 42 | +Clone the demo project to your local machine: |
| 43 | + |
| 44 | +```bash |
| 45 | +git clone https://github.com/tigrisdata-community/bufstream-tigris |
| 46 | +cd bufstream-tigris |
| 47 | +``` |
| 48 | + |
| 49 | +This repository includes configuration files and sample data for testing. |
| 50 | + |
| 51 | +## **Step 2: Create a Tigris Bucket** |
| 52 | + |
| 53 | +1. Go to [storage.new](https://storage.new) and create a **new bucket** in the |
| 54 | + **Standard** access tier. |
| 55 | + |
| 56 | +2. Copy the **bucket name** for later. |
| 57 | + |
| 58 | +3. Create an **Access Key** with **Editor** permissions: |
| 59 | + [storage.new/accesskey](https://storage.new/accesskey) |
| 60 | + |
| 61 | +4. In the repository’s `.env` file, add your credentials: |
| 62 | + |
| 63 | +```bash |
| 64 | +# .env |
| 65 | +TIGRIS_ACCESS_KEY_ID=<your-access-key-id> |
| 66 | +TIGRIS_SECRET_ACCESS_KEY=<your-secret-access-key> |
| 67 | +``` |
| 68 | + |
| 69 | +## **Step 3: Configure Bufstream** |
| 70 | + |
| 71 | +Open the `bufstream.yaml` file in your cloned repo and update the `bucket` field |
| 72 | +with your Tigris bucket name. Leave `region` set to `auto` to let Tigris route |
| 73 | +to the nearest region. |
| 74 | + |
| 75 | +```yaml |
| 76 | +storage: |
| 77 | + provider: S3 |
| 78 | + region: auto |
| 79 | + bucket: <your-tigris-bucket-name> |
| 80 | + endpoint: https://t3.storage.dev |
| 81 | + access_key_id: |
| 82 | + env_var: TIGRIS_ACCESS_KEY_ID |
| 83 | + secret_access_key: |
| 84 | + env_var: TIGRIS_SECRET_ACCESS_KEY |
| 85 | +``` |
| 86 | +
|
| 87 | +## **Step 4: Start Bufstream** |
| 88 | +
|
| 89 | +Start the Docker environment: |
| 90 | +
|
| 91 | +```bash |
| 92 | +docker compose up -d |
| 93 | +``` |
| 94 | + |
| 95 | +You should see output similar to: |
| 96 | + |
| 97 | +```text |
| 98 | + ✔ Network bufstream-on-tigris_bufstream_net Created |
| 99 | + ✔ Container cli Started |
| 100 | + ✔ Container postgres Healthy |
| 101 | + ✔ Container bufstream Started |
| 102 | +``` |
| 103 | + |
| 104 | +## **Step 5: Create a Topic** |
| 105 | + |
| 106 | +Use `kafkactl` to create a topic: |
| 107 | + |
| 108 | +```bash |
| 109 | +docker exec cli kafkactl create topic bufstream-on-tigris |
| 110 | +``` |
| 111 | + |
| 112 | +Expected output: |
| 113 | + |
| 114 | +```text |
| 115 | +topic created: bufstream-on-tigris |
| 116 | +``` |
| 117 | + |
| 118 | +## **Step 6: Produce Messages** |
| 119 | + |
| 120 | +A sample message file (`messages.txt`) is included in the repository. To publish |
| 121 | +its contents to your topic, run: |
| 122 | + |
| 123 | +```bash |
| 124 | +docker exec cli kafkactl produce bufstream-on-tigris --file=/messages.txt |
| 125 | +``` |
| 126 | + |
| 127 | +Expected output: |
| 128 | + |
| 129 | +```text |
| 130 | +7 messages produced |
| 131 | +``` |
| 132 | + |
| 133 | +## **Step 7: Consume Messages** |
| 134 | + |
| 135 | +Read the last 100 messages from the topic: |
| 136 | + |
| 137 | +```bash |
| 138 | +docker exec cli kafkactl consume bufstream-on-tigris --tail=100 |
| 139 | +``` |
| 140 | + |
| 141 | +Example output: |
| 142 | + |
| 143 | +```text |
| 144 | +Hello, world! |
| 145 | +This |
| 146 | +is |
| 147 | +Bufstream |
| 148 | +running |
| 149 | +on |
| 150 | +Tigris! |
| 151 | +``` |
| 152 | + |
| 153 | +## **Verify in the Tigris Console** |
| 154 | + |
| 155 | +Open your Tigris Console and navigate to your bucket. You’ll see |
| 156 | +Bufstream-created keys representing your topic data. |
| 157 | + |
| 158 | +Bufstream now uses Tigris for: |
| 159 | + |
| 160 | +- Durable message storage |
| 161 | +- Unlimited retention |
| 162 | +- Globally accessible streams |
| 163 | + |
| 164 | +You can continue producing and consuming messages using `kafkactl` or integrate |
| 165 | +with your existing Kafka-compatible apps. |
| 166 | + |
| 167 | +:tada: Congratulations, you’ve successfully deployed Bufstream on Tigris. |
0 commit comments