flexpool

Getting started

Run flexpoold in three minutes with Docker, then from source.

With Docker (three minutes)πŸ”—

git clone https://github.com/hupe1980/flexpool && cd flexpool
docker compose up -d --wait
curl -s localhost:8080/healthz
# {"status":"ok","version":"0.5.0","service":"flexpoold"}

The daemon listens on 127.0.0.1:8080 only. Every response carries an x-request-id; every error is a problem document whose type links to the page that explains it.

curl -si localhost:8080/does-not-exist
# HTTP/1.1 404 Not Found
# content-type: application/problem+json
# {"type":".../problems/not-found/","title":"Not found","status":404,"code":"not-found",...}
docker compose down

The demo stack replays a market day on a test clock β€” see Sandbox and scenarios.

Overview: the open alarm, the connection to flexpoold, the sandbox scenario, the next gate with the time remaining, and the portfolio's feed-in, consumption and stored energy.

From sourceπŸ”—

With Rust 1.100 and just:

just run                 # flexpoold on 127.0.0.1:8080
just ci                  # the full gate

Two binariesπŸ”—

BinaryWhat it does
flexpooldThe daemon: flexpoold (or flexpoold serve), flexpoold check-config, flexpoold health
flexpoolOffline tools: portfolio check, portfolio demo, scenario check, scenario run, alarms verify, alarms secret, token new, health

just install puts flexpool on your path. It reads files only and never starts the daemon.

ConfigurationπŸ”—

Settings come from defaults, an optional TOML file and FLEXPOOL_* environment variables, in that order. check-config lists every setting with its value and where it came from, and reports every problem at once:

flexpoold check-config --config flexpoold.example.toml
FLEXPOOL_LOG_LEVEL=debug flexpoold check-config
KeyDefaultMeaning
http.listen127.0.0.1:8080Listen address
http.body_limit_bytes1048576Maximum request body
http.request_timeout_secs30Maximum request duration
http.header_read_timeout_secs10Maximum time to read request headers
http.max_in_flight256Requests in flight before answering 503
shutdown.grace_secs10Graceful shutdown window
log.formatprettypretty or json
log.levelinfoLog filter
docs.base_urlhttps://hupe1980.github.io/flexpoolBase of problem page links
portfolio.dirβ€”Directory with portfolio.toml and assets.csv (Portfolio)
desk.dirβ€”The built desk to serve at / (Desk)
sandbox.scenarioβ€”Scenario file to replay on a test clock (Sandbox)
sandbox.allow_remotefalseAllow clock control when listening beyond loopback
auth.trusted_networks127.0.0.0/8,::1/128Peers that need no token (unless the request was forwarded)
auth.token_hashesβ€”SHA-256 of accepted bearer tokens, comma-separated (secret)
auth.proxy_user_headerβ€”Identity header set by a trusted reverse proxy
http.allowed_hostslocalhost,127.0.0.1,::1Host names answered to β€” add the public name behind a proxy (guards against DNS rebinding)
alarms.journalβ€”Alarm journal file, kept across restarts (Alarms)
alarms.webhooksβ€”Webhook URLs for paging, comma-separated (Alarms)
alarms.webhook_secretβ€”Standard Webhooks secret whsec_… (secret)
alarms.webhook_priority2Page priorities up to this number
alarms.desk_urlβ€”Desk URL for links in pages
events.sourceβ€”CloudEvents source: a URI naming this deployment; required once events are sent (Events)
events.webhooksβ€”Webhook URLs for market events (offers, erasure confirmations), comma-separated
events.webhook_secretβ€”Standard Webhooks secret signing them (secret)
events.inbound_secretsβ€”Secrets that may sign events sent to POST /api/v1/events (secret)
flex.domainβ€”Our UFTP domain; empty: no offers (Flexibility market)
flex.price_eur_per_mwh150Offer price per MWh of offered flexibility
flex.min_activation_factor1Smallest share the grid operator may order
erasure.consumerflexpoolName in erasure confirmations (Data protection)
erasure.pending_fileβ€”Keeps erasures that wait for a person across restarts
plan.round_trip_percent88Battery round-trip efficiency, 50–100 % (Plan)
plan.cycle_cost0Cost per MWh discharged, 0–1,000 €/MWh
book.max_order_mw0Pre-trade limit: largest order, MW (0: rated power) (Book)
book.max_day_buy_eur0Pre-trade limit: largest worst-case purchase per day, € (0: none)

Exit codes: 0 success Β· 1 unhealthy Β· 2 configuration problems Β· 3 the listen address is taken.

Edit this page