-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: explain chproxy arguments (#2689)
- Loading branch information
Showing
7 changed files
with
353 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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`. | ||
|
@@ -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/>}> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.