This is the "Elite: Dangerous Trade Ear", a service that subscribes to EDDN, and ingests nightly dumps from EDSM, and sends that all to a PostgreSQL database with PostGIS enabled. It also allows you to see some interesting statistics about the Elite: Dangerous trade universe, once the data has been collected.
EDTear is used to create the data for Kural, my other project to build a high-performance trade-route calculator based on integer linear programming.
Parts of the SQL queries are based on Galos by Nathan Lilienthal.
Requires a recent Rust version (I'm using 1.82), PostgresSQL 16+ with PostGIS, and the Rust sqlx
CLI.
Setup database:
sqlx database create
sqlx migrate run
Import EDSM data:
cargo run --release -- ingest-edsm --systems-json-path systemsPopulated.json --stations-json-path stations.json --url postgres://postgres:password@localhost/edtear
Listen to data from EDDN:
cargo run --release -- listen --url postgres://postgres:password@localhost/edtear
See some interesting statistics about the data, once collected:
cargo run --release -- stats --url postgres://postgres:password@localhost/edtear
Once you've set up the database locally, you can also run EDTear through Docker Compose, which may be useful for server deployments.
Make a file named postgres.env
in this directory (and on the server) with the contents:
POSTGRES_PASSWORD=<password>
On your host system, dump the local database:
sudo -u postgres pg_dump -Fc edtear > edtear.dump
On the server, run docker compose up -d postgres
to spawn a Postgres instance.
Import the data on the server (should prompt you for your password):
pg_restore -U postgres -h localhost -p 6543 -d edtear edtear.dump
Shutdown the current Postgres: docker compose down
And now deploy with the imported data: docker compose up -d
Copyright (c) 2024 Matt Young.
EDTear is available under the ISC licence.