Running API
Dependencies
Installation Instructions for Mac/Linux
brew install rustup postgres brew cask install docker
cargo install sqlx-cli ./scripts/init_db.sh ./scripts/init_collector.sh cargo run
cargo install sqlx-cli cargo install bunyan
cargo doc --open cargo test
cargo r | bunyan TEST_LOG=true cargo t | bunyan
./scripts/stop_containers.sh
sqlx mig add YOUR_MIGRATION_NAME sqlx mig run cargo sqlx prepare -- --lib cargo sqlx prepare --check -- --lib
docker build -t hermod_api . docker run -p 8000:8000 hermod_api
brew install cloc
cloc configuration src tests migrations scripts
cargo llvm-cov --open --ignore-filename-regex "build.rs|src\/main.rs"
cargo tarpaullin
ulimit -n 10000
Project Architecture
- configurations contains three files - base.yaml, local.yaml, and production.yaml. Base.yaml contains default configuration shared between local and production, and local and production specify configuration settings that differ between the two environments.
- migrations contains SQL files that, when executed in order, produce the schema for the Hermod database. This can be accomplished by running
sqlx migrate run
.
- scripts contains build-tools used for local environment setup.
- src contains application source code.
- tests contains dependency tests.
- .env contains an environment variables with a database URL for sqlx.
- Cargo.toml contains package metadata and dependencies
- Dockerfile contains instructions for building a Docker image for this project
- sqlx-data.json contains the data used to represent Hermod's database schema. Used for building Hermod when a database connection is not available.