From 04ff66ad8b420f6ad640667268555c20dce03ccd Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Sat, 2 Dec 2023 18:55:19 -1000 Subject: [PATCH] chore: Add docs for Meilisearch setup --- README.md | 9 +++++++++ docker-compose.yml | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 47f174ba..f531dae2 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ Lysand is extremely fast and can handle tens of thousands of HTTP requests per s - The [Bun Runtime](https://bun.sh), version 1.0.5 or later (usage of the latest version is recommended) - A PostgreSQL database - (Optional but recommended) A Linux-based operating system +- (Optional if you want search) A working Meiliseach instance > **Note**: We will not be offerring support to Windows or MacOS users. If you are using one of these operating systems, please use a virtual machine or container to run Lysand. @@ -125,6 +126,10 @@ RUN chmod +x /docker-entrypoint-initdb.d/init.sh bun migrate ``` +6. (If you want search) +Create a Meilisearch instance (using Docker is recommended). For a [`docker-compose`] file, copy the `meilisearch` service from the [`docker-compose.yml`](docker-compose.yml) file. + +Set up Meiliseach's API key by passing the `MEILI_MASTER_KEY` environment variable to the server. Then, enale and configure search in the config file. ### Running To run the server, simply run the following command: @@ -149,6 +154,10 @@ Some CLI commands that return data as tables can be used in scripts. To do so, y Flags can be used in any order and anywhere in the script (except for the `bun cli` command itself). The command arguments themselves must be in the correct order, however. +### Rebuilding the Search Index + +You may use the `bun cli index rebuild` command to automatically push all posts and users to Meilisearch, if it is configured. This is useful if you have just set up Meilisearch, or if you accidentally deleted something. + ### Using Database Commands The `bun prisma` commands allows you to use Prisma commands without needing to add in environment variables for the database config. Just run Prisma commands as you would normally, replacing `bunx prisma` with `bun prisma`. diff --git a/docker-compose.yml b/docker-compose.yml index e8100507..c0cf5c38 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,17 @@ services: restart: unless-stopped networks: - lysand-net + meilisearch: + stdin_open: true + environment: + - MEILI_MASTER_KEY=add_your_key_here + tty: true + networks: + - lysand-net + volumes: + - ./meili-data:/meili_data + image: getmeili/meilisearch:v1.5 + container_name: lysand-meilisearch networks: lysand-net: