- docker
- sqlx-cli (cargo install sqlx-cli)
- in the
infrastructurerepository runmake up COMPOSE_FILE:=docker-compose-db-only.yml->make migrate->make add-test-datato populate the test database - run
make update-schema- Install sqlx-cli (
cargo install sqlx-cli) if it is not installed already - After there has been a change to the database schema or queries, this command will need to be run again.
- Install sqlx-cli (
- build docker image:
make build_img, defaults tag to: wiki_search_api:0.1
- run the image
$ docker run -p 8000:8000 --rm -a stdin -a stdout <image name>:<image version>- or
make run_imgfor default tags --rmmakes sure image closes after you quit the shell-pbinds the port 8000 in the container to port 8000 on your machine (localhost)-aoptions bind the console output and input to your shell for debugging
- The API server should now be available under
localhost:8000
-
Install rust 1.58.1: https://www.rust-lang.org/learn/get-started
- running
cargo buildshould automatically install this version
- running
-
Install docker: https://docs.docker.com/
-
make buildormake run -
./target/release/search
- Tests are found in
src/tests - To run simply use:
make test
make docs(opens in browser)
SEARCH_PORT: sets the port at which search API listens (default 8000)SEARCH_IP: setst the ip address to which the search API binds (default 127.0.0.1)SQLX_OFFLINE: if true reads sqlx-data.json at compile time to verify queriesDATABASE_URL: the sql connection stringRUST_LOG: level of logging