TAAR-lite webservice
Перейти к файлу
dependabot[bot] 76e0eb678b
Bump jinja2 from 2.10 to 2.11.3
Bumps [jinja2](https://github.com/pallets/jinja) from 2.10 to 2.11.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/2.10...2.11.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-19 21:55:47 +00:00
.circleci remove docker layer caching from circleci 2018-05-23 09:10:09 -04:00
bin Configure threads on gunicorn 2018-04-30 17:15:20 -04:00
taar_api import weirdness in circleci 2018-05-23 09:01:20 -04:00
tests Added an enforcement that results are limited to 4 items 2018-04-23 10:52:08 -04:00
.coveragerc Initial commit 2017-08-03 16:42:33 +01:00
.dockerignore Initial commit 2017-08-03 16:42:33 +01:00
.gitignore Added more artifacts during build to gitignore 2018-03-20 14:21:20 -05:00
Dockerfile Force pip to be version 9 and use python3.6 for tox 2018-04-17 15:07:26 +02:00
LICENSE Initial commit 2017-08-03 16:42:33 +01:00
Makefile reworked hashin freezing to use a shellscript 2018-04-09 23:43:00 +02:00
README.md updated cache expiry docs in README 2018-05-24 17:06:21 -04:00
contribute.json Update contribute.json 2017-08-15 10:38:36 -04:00
docker-compose.yml tagged 0.4.6 release with configurable cache timeouts 2018-05-24 15:37:15 -04:00
requirements.txt Bump jinja2 from 2.10 to 2.11.3 2021-03-19 21:55:47 +00:00
setup.cfg Replaced Django implementation with Flask implementation 2018-03-20 14:21:20 -05:00
setup.py tagged 0.4.6 release with configurable cache timeouts 2018-05-24 15:37:15 -04:00
tox.ini Force pip to be version 9 and use python3.6 for tox 2018-04-17 15:07:26 +02:00

README.md

TAAR API-lite

CircleCI codecov

Instructions for development

The only special thing you will need to do is to export your AWS keys as enviroment variables to run the dev server. The docker-compose.yml file specifies two keys AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID. These keys are required to access the S3 buckets which host the data models used by TAARlite.

  1. Make sure you have docker and docker-compose
  2. export AWS_SECRET_ACCESS_KEY=
  3. export AWS_ACCESS_KEY_ID=
  4. make up

Instructions for deployment

The target environment for this project follows the dockerflow conventions. In order to run it correctly, a number of environment variables needs to be set up. The full list of variables can be found in the web section of the docker-compose.yml file. From a services standpoint, this project requires:

  • an optional Redis cache service, defined by CACHE_URL
  • redis cache expiry in seconds defined by TAAR_CACHE_EXPIRY

Updating Taar

The core of taar-service lives in the mozilla-taarlite python package. These are the steps required to deploy a new version of mozilla-taarlite on taar-api-lite using hashin:

From the root of the repository:

hashin mozilla-taarlite==<major>.<minor>.<patch>

Then open a pull request with the changes to requirements.txt. Once it's merged to master, the service will automatically update.

Web API

The dev service is hosted at: htps://taar.dev.mozaws.net

You must include a single GUID as the last segment of a URL encoded path.

The TAARlite service currently exposes a single URL that can be called with HTTP GET on the URL path :

    /taarlite/api/v1/addon_recommendations/<your_guid_here>/

A sample invocation for the GUID {some_addon_guid} using curl would look like this:

curl https://taar.dev.mozaws.net/taarlite/api/v1/addon_recommendations/%7Bsome_addon_guid%7D/

You should get JSON output that appears in this format:

{"results": ["guid1", "guid2", "guid3", "guid4"]}

You may specify an optional normalization mode by passing in a CGI argument normalize using one of the following choices:

  • rownorm_sum
  • row_count
  • row_sum

Generally - you should get the best results using rownorm_sum.

Passing in an invalid normalization type will yield an empty results list.

Example :

curl http://localhost:8000/taarlite/api/v1/addon_recommendations/%7Bsome_addon_guid%7D/?normalize=rownorm_sum