📝(backend) add fulltext search documentation
Add documentation for env & Find+Docs configuration in dev mode Signed-off-by: Fabre Florian <ffabre@hybird.org>
This commit is contained in:
committed by
Quentin BEY
parent
4644bb4f47
commit
65d572ccd6
@@ -12,6 +12,7 @@ flowchart TD
|
|||||||
Back --> DB("Database (PostgreSQL)")
|
Back --> DB("Database (PostgreSQL)")
|
||||||
Back <--> Celery --> DB
|
Back <--> Celery --> DB
|
||||||
Back ----> S3("Minio (S3)")
|
Back ----> S3("Minio (S3)")
|
||||||
|
Back -- REST API --> Find
|
||||||
```
|
```
|
||||||
|
|
||||||
### Architecture decision records
|
### Architecture decision records
|
||||||
|
|||||||
11
docs/env.md
11
docs/env.md
@@ -7,7 +7,7 @@ Here we describe all environment variables that can be set for the docs applicat
|
|||||||
These are the environment variables you can set for the `impress-backend` container.
|
These are the environment variables you can set for the `impress-backend` container.
|
||||||
|
|
||||||
| Option | Description | default |
|
| Option | Description | default |
|
||||||
|-------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
|
|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
|
||||||
| AI_ALLOW_REACH_FROM | Users that can use AI must be this level. options are "public", "authenticated", "restricted" | authenticated |
|
| AI_ALLOW_REACH_FROM | Users that can use AI must be this level. options are "public", "authenticated", "restricted" | authenticated |
|
||||||
| AI_API_KEY | AI key to be used for AI Base url | |
|
| AI_API_KEY | AI key to be used for AI Base url | |
|
||||||
| AI_BASE_URL | OpenAI compatible AI base url | |
|
| AI_BASE_URL | OpenAI compatible AI base url | |
|
||||||
@@ -42,9 +42,9 @@ These are the environment variables you can set for the `impress-backend` contai
|
|||||||
| DJANGO_ALLOWED_HOSTS | Allowed hosts | [] |
|
| DJANGO_ALLOWED_HOSTS | Allowed hosts | [] |
|
||||||
| DJANGO_CELERY_BROKER_TRANSPORT_OPTIONS | Celery broker transport options | {} |
|
| DJANGO_CELERY_BROKER_TRANSPORT_OPTIONS | Celery broker transport options | {} |
|
||||||
| DJANGO_CELERY_BROKER_URL | Celery broker url | redis://redis:6379/0 |
|
| DJANGO_CELERY_BROKER_URL | Celery broker url | redis://redis:6379/0 |
|
||||||
| DJANGO_CORS_ALLOW_ALL_ORIGINS | Allow all CORS origins | false |
|
|
||||||
| DJANGO_CORS_ALLOWED_ORIGIN_REGEXES | List of origins allowed for CORS using regulair expressions | [] |
|
|
||||||
| DJANGO_CORS_ALLOWED_ORIGINS | List of origins allowed for CORS | [] |
|
| DJANGO_CORS_ALLOWED_ORIGINS | List of origins allowed for CORS | [] |
|
||||||
|
| DJANGO_CORS_ALLOWED_ORIGIN_REGEXES | List of origins allowed for CORS using regulair expressions | [] |
|
||||||
|
| DJANGO_CORS_ALLOW_ALL_ORIGINS | Allow all CORS origins | false |
|
||||||
| DJANGO_CSRF_TRUSTED_ORIGINS | CSRF trusted origins | [] |
|
| DJANGO_CSRF_TRUSTED_ORIGINS | CSRF trusted origins | [] |
|
||||||
| DJANGO_EMAIL_BACKEND | Email backend library | django.core.mail.backends.smtp.EmailBackend |
|
| DJANGO_EMAIL_BACKEND | Email backend library | django.core.mail.backends.smtp.EmailBackend |
|
||||||
| DJANGO_EMAIL_BRAND_NAME | Brand name for email | |
|
| DJANGO_EMAIL_BRAND_NAME | Brand name for email | |
|
||||||
@@ -95,9 +95,12 @@ These are the environment variables you can set for the `impress-backend` contai
|
|||||||
| OIDC_USERINFO_SHORTNAME_FIELD | OIDC token claims to create shortname | first_name |
|
| OIDC_USERINFO_SHORTNAME_FIELD | OIDC token claims to create shortname | first_name |
|
||||||
| POSTHOG_KEY | Posthog key for analytics | |
|
| POSTHOG_KEY | Posthog key for analytics | |
|
||||||
| REDIS_URL | Cache url | redis://redis:6379/1 |
|
| REDIS_URL | Cache url | redis://redis:6379/1 |
|
||||||
|
| SEARCH_INDEXER_BATCH_SIZE | Size of each batch for indexation of all documents | 100000 |
|
||||||
|
| SEARCH_INDEXER_COUNTDOWN | Minimum debounce delay of indexation jobs (in seconds) | 1 |
|
||||||
|
| SEARCH_INDEXER_SECRET | Token for indexation queries | |
|
||||||
| SENTRY_DSN | Sentry host | |
|
| SENTRY_DSN | Sentry host | |
|
||||||
| SESSION_COOKIE_AGE | duration of the cookie session | 60*60*12 |
|
| SESSION_COOKIE_AGE | duration of the cookie session | 60*60*12 |
|
||||||
| SIGNUP_NEW_USER_TO_MARKETING_EMAIL | Register new user to the marketing onboarding. If True, see env LASUITE_MARKETING_* system | False
|
| SIGNUP_NEW_USER_TO_MARKETING_EMAIL | Register new user to the marketing onboarding. If True, see env LASUITE_MARKETING_* system | False |
|
||||||
| SPECTACULAR_SETTINGS_ENABLE_DJANGO_DEPLOY_CHECK | | false |
|
| SPECTACULAR_SETTINGS_ENABLE_DJANGO_DEPLOY_CHECK | | false |
|
||||||
| STORAGES_STATICFILES_BACKEND | | whitenoise.storage.CompressedManifestStaticFilesStorage |
|
| STORAGES_STATICFILES_BACKEND | | whitenoise.storage.CompressedManifestStaticFilesStorage |
|
||||||
| THEME_CUSTOMIZATION_CACHE_TIMEOUT | Cache duration for the customization settings | 86400 |
|
| THEME_CUSTOMIZATION_CACHE_TIMEOUT | Cache duration for the customization settings | 86400 |
|
||||||
|
|||||||
39
docs/search.md
Normal file
39
docs/search.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Setup the Find search for Impress
|
||||||
|
|
||||||
|
This configuration will enable the fulltext search feature for Docs :
|
||||||
|
- Each save on **core.Document** or **core.DocumentAccess** will trigger the indexer
|
||||||
|
- The `api/v1.0/documents/search/` will work as a proxy with the Find API for fulltext search.
|
||||||
|
|
||||||
|
## Create an index service for Docs
|
||||||
|
|
||||||
|
Configure a **Service** for Docs application with these settings
|
||||||
|
|
||||||
|
- **Name**: `docs`<br>_request.auth.name of the Docs application._
|
||||||
|
- **Client id**: `impress`<br>_Name of the token audience or client_id of the Docs application._
|
||||||
|
|
||||||
|
See [how-to-use-indexer.md](how-to-use-indexer.md) for details.
|
||||||
|
|
||||||
|
## Configure settings of Docs
|
||||||
|
|
||||||
|
Add those Django settings the Docs application to enable the feature.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
SEARCH_INDEXER_CLASS="core.services.search_indexers.FindDocumentIndexer"
|
||||||
|
SEARCH_INDEXER_COUNTDOWN=10 # Debounce delay in seconds for the indexer calls.
|
||||||
|
|
||||||
|
# The token from service "docs" of Find application (development).
|
||||||
|
SEARCH_INDEXER_SECRET="find-api-key-for-docs-with-exactly-50-chars-length"
|
||||||
|
SEARCH_INDEXER_URL="http://find:8000/api/v1.0/documents/index/"
|
||||||
|
|
||||||
|
# Search endpoint. Uses the OIDC token for authentication
|
||||||
|
SEARCH_INDEXER_QUERY_URL="http://find:8000/api/v1.0/documents/search/"
|
||||||
|
```
|
||||||
|
|
||||||
|
We also need to enable the **OIDC Token** refresh or the authentication will fail quickly.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Store OIDC tokens in the session
|
||||||
|
OIDC_STORE_ACCESS_TOKEN = True # Store the access token in the session
|
||||||
|
OIDC_STORE_REFRESH_TOKEN = True # Store the encrypted refresh token in the session
|
||||||
|
OIDC_STORE_REFRESH_TOKEN_KEY = "your-32-byte-encryption-key==" # Must be a valid Fernet key (32 url-safe base64-encoded bytes)
|
||||||
|
```
|
||||||
@@ -97,6 +97,17 @@ Production deployments differ significantly from development environments. The t
|
|||||||
| 5433 | PostgreSQL (Keycloak) |
|
| 5433 | PostgreSQL (Keycloak) |
|
||||||
| 1081 | MailCatcher |
|
| 1081 | MailCatcher |
|
||||||
|
|
||||||
|
**With fulltext search service**
|
||||||
|
|
||||||
|
| Port | Service |
|
||||||
|
| --------- | --------------------- |
|
||||||
|
| 8081 | Find (Django) |
|
||||||
|
| 9200 | Opensearch |
|
||||||
|
| 9600 | Opensearch admin |
|
||||||
|
| 5601 | Opensearch dashboard |
|
||||||
|
| 25432 | PostgreSQL (Find) |
|
||||||
|
|
||||||
|
|
||||||
## 6. Sizing Guidelines
|
## 6. Sizing Guidelines
|
||||||
|
|
||||||
**RAM** – start at 8 GB dev / 16 GB staging / 32 GB prod. Postgres and Keycloak are the first to OOM; scale them first.
|
**RAM** – start at 8 GB dev / 16 GB staging / 32 GB prod. Postgres and Keycloak are the first to OOM; scale them first.
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ OIDC_OP_JWKS_ENDPOINT=http://nginx:8083/realms/impress/protocol/openid-connect/c
|
|||||||
OIDC_OP_AUTHORIZATION_ENDPOINT=http://localhost:8083/realms/impress/protocol/openid-connect/auth
|
OIDC_OP_AUTHORIZATION_ENDPOINT=http://localhost:8083/realms/impress/protocol/openid-connect/auth
|
||||||
OIDC_OP_TOKEN_ENDPOINT=http://nginx:8083/realms/impress/protocol/openid-connect/token
|
OIDC_OP_TOKEN_ENDPOINT=http://nginx:8083/realms/impress/protocol/openid-connect/token
|
||||||
OIDC_OP_USER_ENDPOINT=http://nginx:8083/realms/impress/protocol/openid-connect/userinfo
|
OIDC_OP_USER_ENDPOINT=http://nginx:8083/realms/impress/protocol/openid-connect/userinfo
|
||||||
|
OIDC_OP_INTROSPECTION_ENDPOINT=http://nginx:8083/realms/impress/protocol/openid-connect/token/introspect
|
||||||
|
|
||||||
OIDC_RP_CLIENT_ID=impress
|
OIDC_RP_CLIENT_ID=impress
|
||||||
OIDC_RP_CLIENT_SECRET=ThisIsAnExampleKeyForDevPurposeOnly
|
OIDC_RP_CLIENT_SECRET=ThisIsAnExampleKeyForDevPurposeOnly
|
||||||
|
|||||||
Reference in New Issue
Block a user