A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
feature: Allow specifying a specific redis db to use. Fixes #13
MohamedBasseme22a3dcac76f
diff --git a/docs/docs/03-configuration.md b/docs/docs/03-configuration.mdindex bba81b70..2557deb4 100644--- a/docs/docs/03-configuration.md+++ b/docs/docs/03-configuration.md@@ -2,23 +2,24 @@The app is mainly configured by environment variables. All the used environment variables are listed in [packages/shared/config.ts](https://github.com/MohamedBassem/hoarder-app/blob/main/packages/shared/config.ts). The most important ones are:-| Name | Required | Default | Description |-| ---------------- | ------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------- |-| DATA_DIR | Yes | Not set | The path for the persistent data directory. This is where the db and the uploaded assets live. |-| NEXTAUTH_SECRET | Yes | Not set | Random string used to sign the JWT tokens. Generate one with `openssl rand -base64 36`. |-| REDIS_HOST | Yes | localhost | The address of redis used by background jobs |-| REDIS_POST | Yes | 6379 | The port of redis used by background jobs |-| MEILI_ADDR | No | Not set | The address of meilisearch. If not set, Search will be disabled. E.g. (`http://meilisearch:7700`) |-| MEILI_MASTER_KEY | Only in Prod and if search is enabled | Not set | The master key configured for meilisearch. Not needed in development environment. Generate one with `openssl rand -base64 36` |+| Name | Required | Default | Description |+| ---------------- | ------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------- |+| DATA_DIR | Yes | Not set | The path for the persistent data directory. This is where the db and the uploaded assets live. |+| NEXTAUTH_SECRET | Yes | Not set | Random string used to sign the JWT tokens. Generate one with `openssl rand -base64 36`. |+| REDIS_HOST | Yes | localhost | The address of redis used by background jobs |+| REDIS_POST | Yes | 6379 | The port of redis used by background jobs |+| REDIS_DB_IDX | No | Not set | The db idx to use with redis. It defaults to 0 (in the client) so you don't usually need to set it unless you explicitly want another db. |+| MEILI_ADDR | No | Not set | The address of meilisearch. If not set, Search will be disabled. E.g. (`http://meilisearch:7700`) |+| MEILI_MASTER_KEY | Only in Prod and if search is enabled | Not set | The master key configured for meilisearch. Not needed in development environment. Generate one with `openssl rand -base64 36` |## Inference Configs (For automatic tagging)Either `OPENAI_API_KEY` or `OLLAMA_BASE_URL` need to be set for automatic tagging to be enabled. Otherwise, automatic tagging will be skipped.-| Name | Required | Default | Description |-| --------------------- | -------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| OPENAI_API_KEY | No | Not set | The OpenAI key used for automatic tagging. More on that in [here](/openai). |+| Name | Required | Default | Description |+| --------------------- | -------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| OPENAI_API_KEY | No | Not set | The OpenAI key used for automatic tagging. More on that in [here](/openai). || OPENAI_BASE_URL | No | Not set | If you just want to use OpenAI you don't need to pass this variable. If, however, you want to use some other openai compatible API (e.g. azure openai service), set this to the url of the API. |-| OLLAMA_BASE_URL | No | Not set | If you want to use ollama for local inference, set the address of ollama API here. |-| INFERENCE_TEXT_MODEL | No | gpt-3.5-turbo-0125 | The model to use for text inference. You'll need to change this to some other model if you're using ollama. |-| INFERENCE_IMAGE_MODEL | No | gpt-4-vision-preview | The model to use for image inference. You'll need to change this to some other model if you're using ollama and that model needs to support vision APIs (e.g. llava). |+| OLLAMA_BASE_URL | No | Not set | If you want to use ollama for local inference, set the address of ollama API here. |+| INFERENCE_TEXT_MODEL | No | gpt-3.5-turbo-0125 | The model to use for text inference. You'll need to change this to some other model if you're using ollama. |+| INFERENCE_IMAGE_MODEL | No | gpt-4-vision-preview | The model to use for image inference. You'll need to change this to some other model if you're using ollama and that model needs to support vision APIs (e.g. llava). |diff --git a/packages/shared/config.ts b/packages/shared/config.tsindex ff077147..edc96627 100644--- a/packages/shared/config.ts+++ b/packages/shared/config.ts@@ -17,6 +17,7 @@ const allEnv = z.object({INFERENCE_IMAGE_MODEL: z.string().default("gpt-4-vision-preview"),REDIS_HOST: z.string().default("localhost"),REDIS_PORT: z.coerce.number().default(6379),+ REDIS_DB_IDX: z.coerce.number().optional(),CRAWLER_HEADLESS_BROWSER: stringBool("true"),BROWSER_EXECUTABLE_PATH: z.string().optional(), // If not set, the system's browser will be usedBROWSER_USER_DATA_DIR: z.string().optional(),@@ -46,6 +47,7 @@ const serverConfigSchema = allEnv.transform((val) => {bullMQ: {redisHost: val.REDIS_HOST,redisPort: val.REDIS_PORT,+ redisDBIdx: val.REDIS_DB_IDX,},crawler: {headlessBrowser: val.CRAWLER_HEADLESS_BROWSER,diff --git a/packages/shared/queues.ts b/packages/shared/queues.tsindex a2cbeceb..b264e2c4 100644--- a/packages/shared/queues.ts+++ b/packages/shared/queues.ts@@ -5,6 +5,7 @@ import serverConfig from "./config";export const queueConnectionDetails = {host: serverConfig.bullMQ.redisHost,port: serverConfig.bullMQ.redisPort,+ db: serverConfig.bullMQ.redisDBIdx,};// Link Crawler