cd contracts/
cargo run --bin vendor --features bin
Start a server by:
cargo run --bin orderbook
The tests that require postgres connect to the default database of locally running postgres instance on the default port. There are several ways to set up postgres:
# Docker
docker run -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_USER=$USER -p 5432:5432 postgres
# Service
sudo systemctl start postgresql.service
sudo -u postgres createuser $USER
sudo -u postgres createdb $USER
# Manual setup in local folder
mkdir postgres && cd postgres
initdb data # Arbitrary directory that stores the database
# In data/postgresql.conf set unix_socket_directories to the absolute path to an arbitrary existing
# and writable directory that postgres creates a temporary file in.
# Run postgres
postgres -D data
# In another terminal, only for first time setup
createdb -h localhost $USER
# Finally for all methods to test that the server is reachable and to set the schema for the tests.
docker build --tag ido-migrations -f docker/Dockerfile.migration .
# If you are running postgres in locally, your URL is `localhost` instead of `host.docker.internal`
docker run -ti -e FLYWAY_URL="jdbc:postgresql://host.docker.internal/?user=$USER" -v $PWD/database/sql:/flyway/sql ido-migrations migrate