Skip to content

Commit 7c47813

Browse files
mvanhornn1ru4l
andauthored
docs(commerce): add service README (#7996)
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
1 parent 2e45b2b commit 7c47813

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# `@hive/commerce`
2+
3+
This service provides the commerce backend for Hive: usage estimation, rate-limit lookups, and
4+
Stripe billing. It exposes a tRPC router (`commerceRouter` in `src/api.ts`) consumed by the `server`
5+
and `usage` services via the `COMMERCE_ENDPOINT` configuration.
6+
7+
The service listens on port `4012` by default.
8+
9+
## Configuration
10+
11+
| Name | Required | Description | Example Value |
12+
| ----------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
13+
| `PORT` | No | The port this service is running on. | `4012` |
14+
| `ENVIRONMENT` | No | The environment of your Hive app. (**Note:** This will be used for Sentry reporting.) | `staging` |
15+
| `RELEASE` | No | The release identifier reported with Sentry events. Defaults to `local`. | `v9.6.0` |
16+
| `WEB_APP_URL` | No | Public URL of the Hive web app. | `http://localhost:3000` |
17+
| `CLICKHOUSE_PROTOCOL` | **Yes** | The protocol used to connect to ClickHouse. | `http` or `https` |
18+
| `CLICKHOUSE_HOST` | **Yes** | Host of the ClickHouse instance. | `127.0.0.1` |
19+
| `CLICKHOUSE_PORT` | **Yes** | Port of the ClickHouse instance. | `8123` |
20+
| `CLICKHOUSE_USERNAME` | **Yes** | Username for accessing ClickHouse. | `default` |
21+
| `CLICKHOUSE_PASSWORD` | **Yes** | Password for accessing ClickHouse. | `clickhouse` |
22+
| `POSTGRES_HOST` | **Yes** | Host of the postgres database. | `127.0.0.1` |
23+
| `POSTGRES_PORT` | **Yes** | Port of the postgres database. | `5432` |
24+
| `POSTGRES_DB` | **Yes** | Name of the postgres database. | `registry` |
25+
| `POSTGRES_USER` | **Yes** | User name for accessing the postgres database. | `postgres` |
26+
| `POSTGRES_PASSWORD` | No | Password for accessing the postgres database. | `postgres` |
27+
| `POSTGRES_SSL` | No | Whether the postgres connection should be established via SSL. | `1` (enabled) or `0` (disabled) |
28+
| `LIMIT_CACHE_UPDATE_INTERVAL_MS` | No | How often, in milliseconds, the rate-limit cache is refreshed. Defaults to `60000`. | `60000` |
29+
| `STRIPE_SECRET_KEY` | **Yes** | Secret key used to call the Stripe API. | `sk_test_...` |
30+
| `STRIPE_SYNC_INTERVAL_MS` | No | How often, in milliseconds, Stripe subscription state is synced. Defaults to `600000` (10 minutes). | `600000` |
31+
| `SENTRY` | No | Whether Sentry error reporting should be enabled. | `1` (enabled) or `0` (disabled) |
32+
| `SENTRY_DSN` | No | The DSN for reporting errors to Sentry. Required when `SENTRY=1`. | `https://dooobars@o557896.ingest.sentry.io/12121212` |
33+
| `PROMETHEUS_METRICS` | No | Whether Prometheus metrics should be enabled. | `1` (enabled) or `0` (disabled) |
34+
| `PROMETHEUS_METRICS_LABEL_INSTANCE` | No | The instance label added for the prometheus metrics. Defaults to `rate-limit`. | `commerce` |
35+
| `PROMETHEUS_METRICS_PORT` | No | Port on which prometheus metrics are exposed. Defaults to `10254`. | `10254` |
36+
| `REQUEST_LOGGING` | No | Log http requests. Defaults to `1`. | `1` (enabled) or `0` (disabled) |
37+
| `LOG_LEVEL` | No | The verbosity of the service logs. One of `trace`, `debug`, `info`, `warn`, `error`, `fatal` or `silent`. Defaults to `info`. | `info` |
38+
| `OPENTELEMETRY_COLLECTOR_ENDPOINT` | No | OpenTelemetry Collector endpoint. The expected traces transport is HTTP (port `4318`). | `http://localhost:4318/v1/traces` |

0 commit comments

Comments
 (0)