openculinary / backend

The RecipeRadar backend implements data persistence and modeling for the RecipeRadar service
GNU Affero General Public License v3.0
13 stars 0 forks source link
celery flask opensearch postgresql

RecipeRadar Backend

The RecipeRadar backend provides data persistence and modeling services.

It provides endpoints to support the following functionality:

The service is composed of two Kubernetes deployments:

Install dependencies

Make sure to follow the RecipeRadar infrastructure setup to ensure all cluster dependencies are available in your environment.

Development

To install development tools and run linting and tests locally, execute the following commands:

$ make lint tests

Local Deployment

To deploy the service to the local infrastructure environment, execute the following commands:

$ make
$ make deploy

Operations

Recipe index configuration

For the search engine to correctly index recipe data, an OpenSearch mapping needs to be configured for the recipe index. This can be done using the update-recipe-index.py script:

# For an OpenSearch instance running on 'localhost' on the default port
$ venv/bin/python scripts/update-recipe-index.py --hostname localhost --index recipes

Pausing background workers

Sometimes -- for example, during schema upgrades or other changes which need careful co-ordination between the search engine, API, and background task workers, it can be useful to pause the workers temporarily.

Since the workers are a Kubernetes deployment, a straightforward way to do this is to scale the deployment down to zero temporarily:

$ kubectl scale deployments/backend-worker-deployment --replicas 0