Skip to content

Commit

Permalink
add feldera to docker compose
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinav Gyawali <[email protected]>
  • Loading branch information
abhizer committed Jan 27, 2025
1 parent f3fa37c commit 54ad31e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 5 deletions.
37 changes: 32 additions & 5 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
services:
feldera:
tty: true
image: ghcr.io/feldera/pipeline-manager:${FELDERA_VERSION:-latest}
ports:
- "8080:8080"
- "8081:8081"
stop_grace_period: 0s
environment:
- RUST_LOG=info,actix_web=error,tokio_postgres=info
- RUST_BACKTRACE=1
- AUTH_CLIENT_ID
- AUTH_ISSUER
security_opt:
# The default seccomp profile disables the `io_uring_*` syscalls that we need.
# Ideally, we would minimally relax the default profile, which is usually in
# /usr/share/container/seccomp.json, but we often start via `curl` of just this
# `docker-compose.yml`, so there's no way to grab the specific file at the
# same time, so instead we just use `seccomp:unconfined`.
#
#- seccomp:seccomp.json
- seccomp:unconfined
healthcheck:
# TODO: add `/status` endpoint.
test:
[
"CMD-SHELL",
"curl --fail --request GET --url http://localhost:8080/healthz"
]
interval: 10s
timeout: 5s
retries: 5

grafana:
user: root
container_name: 'feldera-feldera-datasource'
Expand Down Expand Up @@ -30,8 +62,3 @@ services:
GF_DATAPROXY_LOGGING: 1
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: feldera-feldera-datasource

network_mode: 'host'
# networks:
# default:
# name: opentelemetry-demo
# external: true
20 changes: 20 additions & 0 deletions grafana.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE TABLE times (
count INT NOT NULL,
ts TIMESTAMP NOT NULL
) with (
'connectors' = '[{
"transport": {
"name": "datagen",
"config": {
"plan": [{
"rate": 100,
"fields": {
"ts": { "range": ["2025-01-22T00:00:00Z", "2025-01-31T00:00:02Z"], "scale": 1000 }
}
}]
}
}
}]'
);

CREATE MATERIALIZED VIEW v0 AS SELECT * FROM times;
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feldera
12 changes: 12 additions & 0 deletions start_feldera_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This script uses the Feldera API to create and start a pipeline using SQL
# program in 'test.sql'.

from feldera import FelderaClient, PipelineBuilder

sql = open("grafana.sql").read()

client = FelderaClient('http://localhost:8080')

print('Starting pipeline')
pipeline = PipelineBuilder(client, 'grafana', sql).create_or_replace()
pipeline.start()

0 comments on commit 54ad31e

Please sign in to comment.