1 unstable release
new 0.0.1 | Oct 30, 2024 |
---|
#112 in #report
145KB
3.5K
SLoC
OpenADR 3.0 in Rust
This is a work-in-progress implementation of the OpenADR 3.0 specification. OpenADR is a protocol for automatic demand-response in electricity grids, like dynamic pricing or load shedding.
Limitations
This repository contains only OpenADR 3.0, older versions are not supported.
Currently, only the /programs
, /reports
, /events
endpoints are supported.
Also no authentication is supported yet.
Database setup
Startup a postgres database. For example, using docker compose:
docker compose up -d db
Run the migrations:
cargo sqlx migrate run
How to use
Running the VTN using cargo:
RUST_LOG=trace cargo run --bin openleadr-vtn
Running the VTN using docker-compose:
docker compose up -d
Note on prepared SQL
This workspace uses SQLX macro to type check SQL statements. In order to build the crate without a running SQL server (such as in the docker), SQLX must be run in offline mode. In this mode type checking is done via a cached variant of the DB (the .sqlx directory). For this to work as intended, each time a change is made to SQL schemas or queries, please run
cargo sqlx prepare --workspace
This will update the cached SQL in the .sqlx
directory which should be committed to GitHub.
Invalidating the docker build cache
To expedite the slow cargo release builds, the Dockerfile uses a multi-stage build. If changes have been made and are not being reflected in the binary running inside docker, try
docker compose up --force-recreate --build --no-deps vtn
This will force a rebuild
Running the client
cargo run --bin openleadr
Dependencies
~13–28MB
~448K SLoC