Skip to content

Instantly share code, notes, and snippets.

@mwylde
Created November 8, 2023 18:01
Show Gist options
  • Save mwylde/3d35b078158eeb245252709818e9c1c4 to your computer and use it in GitHub Desktop.
Save mwylde/3d35b078158eeb245252709818e9c1c4 to your computer and use it in GitHub Desktop.
Arroyo with docker compose
version: '3'
services:
arroyo:
image: ghcr.io/arroyosystems/arroyo-single:latest
ports:
- '8000:8000'
- '8001:8001'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/ping"]
interval: 10s
timeout: 10s
retries: 5
start_period: 5s
startup:
image: badouralix/curl-jq:latest
depends_on:
arroyo:
condition: service_healthy
volumes:
- ./query.sql:/tmp/query.sql
command: >
sh -c 'curl -vvv -XPOST http://arroyo:8000/api/v1/pipelines \
-H "Content-Type: application/json" \
-d "{\"name\": \"my_pipeline\", \"parallelism\": 1, \"query\": $(jq -Rs . < /tmp/query.sql)}"'
CREATE TABLE coinbase (
type TEXT,
price TEXT
) WITH (
connector = 'websocket',
endpoint = 'wss://ws-feed.exchange.coinbase.com',
subscription_message = '{
"type": "subscribe",
"product_ids": [
"BTC-USD"
],
"channels": ["ticker"]
}',
format = 'json'
);
SELECT avg(CAST(price as FLOAT)) from coinbase
WHERE type = 'ticker'
GROUP BY hop(interval '5' second, interval '1 minute');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment