feat: implement typesense container

This commit is contained in:
petitminion 2023-05-17 15:48:02 +00:00
commit 2db8c585ad
8 changed files with 73 additions and 2 deletions

View file

@ -13,7 +13,7 @@ RUN set -eux; \
COPY pyproject.toml poetry.lock /
RUN set -eux; \
poetry export --without-hashes > requirements.txt; \
poetry export --without-hashes --extras typesense > requirements.txt; \
poetry export --without-hashes --with dev > dev-requirements.txt;
FROM alpine:3.17 as builder

View file

@ -1458,3 +1458,21 @@ instead of request header.
HASHING_ALGORITHM = "sha256"
HASHING_CHUNK_SIZE = 1024 * 100
"""
Typenses Settings
"""
TYPESENSE_API_KEY = env("TYPESENSE_API_KEY", default=None)
""" Typesense API key. This need to be defined in the .env file for Typenses to be activated."""
TYPESENSE_PORT = env("TYPESENSE_PORT", default="8108")
"""Typesense listening port"""
TYPESENSE_PROTOCOL = env("TYPESENSE_PROTOCOL", default="http")
"""Typesense listening protocol"""
TYPESENSE_HOST = env(
"TYPESENSE_HOST",
default="typesense" if IS_DOCKER_SETUP else "localhost",
)
"""
Typesense hostname. Defaults to `localhost` on non-Docker deployments and to `typesense` on
Docker deployments.
"""

19
api/poetry.lock generated
View file

@ -3563,6 +3563,20 @@ all = ["twisted (>=20.3.0)", "zope.interface (>=5.2.0)"]
dev = ["pep8 (>=1.6.2)", "pyenchant (>=1.6.6)", "pytest (>=2.6.4)", "pytest-cov (>=1.8.1)", "sphinx (>=1.2.3)", "sphinx-rtd-theme (>=0.1.9)", "sphinxcontrib-spelling (>=2.1.2)", "tox (>=2.1.1)", "tox-gh-actions (>=2.2.0)", "twine (>=1.6.5)", "wheel"]
twisted = ["twisted (>=20.3.0)", "zope.interface (>=5.2.0)"]
[[package]]
name = "typesense"
version = "0.15.1"
description = "Python client for Typesense, an open source and typo tolerant search engine."
category = "main"
optional = true
python-versions = ">=3"
files = [
{file = "typesense-0.15.1-py2.py3-none-any.whl", hash = "sha256:4e87e66049e863187b5115d4743371edd5db75c80795f35a8ffe632bb407f075"},
]
[package.dependencies]
requests = "*"
[[package]]
name = "typing-extensions"
version = "4.5.0"
@ -4132,7 +4146,10 @@ docs = ["Sphinx", "repoze.sphinx.autointerface"]
test = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[extras]
typesense = ["typesense"]
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
content-hash = "3725c7f5bebac81c9e7024b4d6c1918cd91fd600634c01b5bd5bc14aa52638ac"
content-hash = "21ed086d4caa2b2a8679e8fdfc11b630f9494871aa4c48b66bae2f44cd946180"

View file

@ -85,6 +85,9 @@ requests-http-message-signatures = "==0.3.1"
sentry-sdk = "==1.19.1"
watchdog = "==2.2.1"
# Typesense
typesense = { version = "==0.15.1", optional = true }
# Dependencies pinning
ipython = "==7.34.0"
pluralizer = "==1.2.0"
@ -118,6 +121,9 @@ requests-mock = "==1.10.0"
pylint = "==2.17.2"
pylint-django = "==2.5.3"
[tool.poetry.extras]
typesense = ["typesense"]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"