This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from openmeterio/database-example
refactor: generic database example instead of clickhouse
- Loading branch information
Showing
10 changed files
with
164 additions
and
68 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
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
6 changes: 3 additions & 3 deletions
6
examples/clickhouse/config.yaml → examples/database/config.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: "3.9" | ||
|
||
services: | ||
collector: | ||
image: ghcr.io/openmeterio/benthos-openmeter | ||
pull_policy: always | ||
command: benthos -c /etc/benthos/config.yaml | ||
restart: always | ||
env_file: | ||
- .env | ||
volumes: | ||
- ./config.yaml:/etc/benthos/config.yaml:ro | ||
|
||
seeder: | ||
image: ghcr.io/openmeterio/benthos-openmeter | ||
pull_policy: always | ||
command: benthos -c /etc/benthos/config.yaml | ||
restart: always | ||
volumes: | ||
- ./seed/config.yaml:/etc/benthos/config.yaml:ro |
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,94 @@ | ||
version: "3.9" | ||
|
||
services: | ||
postgres: | ||
profiles: | ||
- postgres | ||
image: postgres:15.3 | ||
ports: | ||
- 127.0.0.1:5432:5432 | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: chat | ||
healthcheck: | ||
test: pg_isready -U postgres -d chat | ||
interval: 5s | ||
timeout: 3s | ||
retries: 100 | ||
|
||
postgres-collector: | ||
profiles: | ||
- postgres | ||
extends: | ||
file: docker-compose.common.yaml | ||
service: collector | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
environment: | ||
DATABASE_DRIVER: postgres | ||
DATABASE_DSN: postgres://postgres:postgres@postgres:5432/chat?sslmode=disable | ||
|
||
postgres-seeder: | ||
profiles: | ||
- postgres | ||
extends: | ||
file: docker-compose.common.yaml | ||
service: seeder | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
environment: | ||
DATABASE_DRIVER: postgres | ||
DATABASE_DSN: postgres://postgres:postgres@postgres:5432/chat?sslmode=disable | ||
volumes: | ||
- ./seed/init.postgres.sql:/etc/benthos/init.sql:ro | ||
|
||
clickhouse: | ||
profiles: | ||
- clickhouse | ||
image: clickhouse/clickhouse-server:23.8.9.54-alpine | ||
ports: | ||
- 127.0.0.1:8123:8123 | ||
- 127.0.0.1:9000:9000 | ||
- 127.0.0.1:9009:9009 | ||
environment: | ||
CLICKHOUSE_USER: default | ||
CLICKHOUSE_PASSWORD: default | ||
CLICKHOUSE_DB: chat | ||
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1 | ||
|
||
healthcheck: | ||
test: wget --no-verbose --tries=1 --spider http://clickhouse:8123/ping || exit 1 | ||
interval: 5s | ||
timeout: 3s | ||
retries: 100 | ||
|
||
clickhouse-collector: | ||
profiles: | ||
- clickhouse | ||
extends: | ||
file: docker-compose.common.yaml | ||
service: collector | ||
depends_on: | ||
clickhouse: | ||
condition: service_healthy | ||
environment: | ||
DATABASE_DRIVER: clickhouse | ||
DATABASE_DSN: clickhouse://default:default@clickhouse:9000/chat?dial_timeout=200ms&max_execution_time=60 | ||
|
||
clickhouse-seeder: | ||
profiles: | ||
- clickhouse | ||
extends: | ||
file: docker-compose.common.yaml | ||
service: seeder | ||
depends_on: | ||
clickhouse: | ||
condition: service_healthy | ||
environment: | ||
DATABASE_DRIVER: clickhouse | ||
DATABASE_DSN: clickhouse://default:default@clickhouse:9000/chat?dial_timeout=200ms&max_execution_time=60 | ||
volumes: | ||
- ./seed/init.clickhouse.sql:/etc/benthos/init.sql:ro |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE | ||
IF NOT EXISTS messages ( | ||
message_id UUID, | ||
account_id String, | ||
sender String, | ||
recipient String, | ||
message String, | ||
time DateTime('UTC') | ||
) ENGINE = MergeTree() PRIMARY KEY (message_id); |
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,9 @@ | ||
CREATE TABLE | ||
IF NOT EXISTS messages ( | ||
message_id UUID PRIMARY KEY, | ||
account_id TEXT, | ||
sender TEXT, | ||
recipient TEXT, | ||
message TEXT, | ||
time TIMESTAMPTZ | ||
); |