map-room / README.md
calintgx's picture
Update README.md
0379fe4 verified
metadata
title: Room API
emoji: πŸš€
colorFrom: indigo
colorTo: pink
python_version: 3.8
pinned: true
short_description: Room API
sdk: docker

Environment

Set environment variables in .env file or via shell:

export API_KEY="APIKEY TO USE THIS API"
export HUGGINGFACE_ACCESS_TOKEN="HF READ ACCESS TOKEN"

Consul environment

To use the enviroment variables from Consul, set variables in consul.env file or via shell:

TGX_CONSUL_AUTH_USER="CONSUL AUTH USER"
TGX_CONSUL_AUTH_PASS="CONSUL AUTH PASSWORD"
TGX_CONSUL_TOKEN="CONSUL TOKEN"
TGX_CONSUL_NODES="CONSUL_URLS_SEPARTEDBY_;"

Development

Dependencies and run is managed by Poetry

Dependencies

Use Poetry to Update and install dependencies:

poetry update
poetry install

Build

Using docker compose

docker compose build --no-cache
docker compose up -d

NOTE Docker compose is set to run on port 8080, change the port in docker-compose.yml if needed.

Docker API

Check if docker daemon is running:

sudo systemctl start docker

Build docker:

docker build -t mappingservice .

Run

Console

poetry run uvicorn mappingservice.main:app --reload

Site runs at http://127.0.0.1:8000/ml-api

Docker

docker run -d --name mycontainer -p 80:80 mappingservice
Run

Send Consul variables on Docker run

API
docker run -e TGX_CONSUL_NODES='URL_NODES' -e TGX_CONSUL_TOKEN='TOKEN' -e TGX_CONSUL_AUTH_USER='USER' -e TGX_CONSUL_AUTH_PASS='PWD' -d --name mycontainer -p 80:80 mappingservice

Benchmark

Use Poetry to Update and install Locust dependencies:

poetry update --only benchmark
poetry install --only benchmark

Run Locust in terminal

locust -f ./benchmark/

Site runs at http://localhost:8089/