Skip to content

Commit

Permalink
docs: explain chproxy arguments (#2689)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronark authored Nov 27, 2024
1 parent 2e35461 commit fdcc5e2
Show file tree
Hide file tree
Showing 7 changed files with 353 additions and 340 deletions.
1 change: 1 addition & 0 deletions apps/chproxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Read more: [https://engineering.unkey.com/docs/architecture/clickhouse-proxy](https://engineering.unkey.com/docs/architecture/clickhouse-proxy)
150 changes: 0 additions & 150 deletions apps/chproxy/src/main.ts

This file was deleted.

56 changes: 55 additions & 1 deletion apps/engineering/content/docs/architecture/clickhouse-proxy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
title: ClickHouse Proxy
---
import {GithubIcon} from "lucide-react"
import {Property} from "fumadocs-openapi/ui"

Our ClickHouse Proxy is a Bun app runnng on AWS Apprunner. It's only purpose is to receive small batches - or even just single rows - to batch them before sending them in bulk to ClickHouse.
Our ClickHouse Proxy is a go app runnng on AWS Apprunner. It's only purpose is to receive small batches - or even just single rows - to batch them before sending them in bulk to ClickHouse.
It does this by implementing the same HTTP interface as ClickHouse and buffering rows in memory, flushing periodically either every few seconds or when the buffer is full.

It's available at `clickhouse.unkey.cloud`.
Expand All @@ -16,6 +17,59 @@ Using the proxy is optional in development, but it can be enabled by providing t
Our ClickHouse proxy is fully managed in [unkeyed/infra](https://github.com/unkeyed/infra).


## Quickstart

The service is entirely configured via environment variables.

### Environment Variables

<Property
name="PORT"
type="integer"
required={false}
>
The port to listen on.

Default: `7123`
</Property>


<Property
name="BASIC_AUTH"
type="string"
required={true}
>
Username and password in the form `<username>:<password>` (username and password separated by a colon), which will be used to authorize incoming requests.

Basic auth was chosen because that's what ClickHouse uses and allows to reuse their SDKs.
In your sdk, you can specify the url as `https://proxyUser:proxyPassword@host:port` and it will just work.

</Property>


<Property
name="CLICKHOUSE_URL"
type="string"
required={true}
>
The HTTP URL of your clickhouse cluster. Ensure this includes the username and password

Example: `https://username:[email protected]:8123`
</Property>

### Running the service

You can run the service either by compiling the go binary via:
```bash
cd /apps/chproxy
go build -o chproxy .
./chproxy
```

Or using the included [Dockerfile](https://github.com/unkeyed/unkey/blob/main/apps/chproxy/Dockerfile)

See the [docker compose](https://github.com/unkeyed/unkey/blob/main/deployment/docker-compose.yaml) reference for more.

## References

<Callout title="Code" icon={<GithubIcon/>}>
Expand Down
2 changes: 1 addition & 1 deletion apps/engineering/content/docs/architecture/vault.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Vault
description: Secure encryption of secrets without
description: Secure encryption of secrets
---

import { Accordion, Accordions } from "fumadocs-ui/components/accordion"
Expand Down
7 changes: 4 additions & 3 deletions apps/engineering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"postinstall": "fumadocs-mdx"
},
"dependencies": {
"fumadocs-core": "14.4.0",
"fumadocs-mdx": "11.1.1",
"fumadocs-core": "14.5.4",
"fumadocs-mdx": "11.1.2",
"fumadocs-openapi": "^5.7.5",
"fumadocs-typescript": "^3.0.2",
"fumadocs-ui": "14.4.0",
"fumadocs-ui": "14.5.4",
"lucide-react": "^0.378.0",
"next": "^14.2.8",
"react": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"drizzle-orm": "generated",
"framer-motion": "11.0.23",
"fslightbox-react": "^1.7.6",
"fumadocs-core": "^14.5.2",
"fumadocs-core": "^14.5.4",
"geist": "^1.3.0",
"github-slugger": "^2.0.0",
"lucide-react": "^0.378.0",
Expand Down
Loading

0 comments on commit fdcc5e2

Please sign in to comment.