From 0ca9099d313bb6a06d4f499bc179344b65199caa Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 24 Dec 2023 22:45:49 -0500 Subject: [PATCH] feat: add melli db init to docker services --- docker-compose.yml | 6 ++++++ package.json | 1 + scripts/melli-init.mts | 7 +++++++ 3 files changed, 14 insertions(+) create mode 100644 scripts/melli-init.mts diff --git a/docker-compose.yml b/docker-compose.yml index 325ab18..2433eb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,3 +15,9 @@ services: image: getmeili/meilisearch:v1.5 volumes: - ./melli_data:/meili_data + melli_init: + build: . + command: ["npm", "run", "melli-init"] + volumes: + - ./data/app.db:/app/prisma/dev.db + profiles: ["mellisearch_init"] diff --git a/package.json b/package.json index ee029d4..9710ee3 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "start": "remix-serve ./build/server/index.js", "typecheck": "tsc", "bridge": "bun run scripts/bridge.mts", + "melli-init": "bun run scripts/melli-init.mts", "postinstall": "patch-package" }, "dependencies": { diff --git a/scripts/melli-init.mts b/scripts/melli-init.mts new file mode 100644 index 0000000..a070ec2 --- /dev/null +++ b/scripts/melli-init.mts @@ -0,0 +1,7 @@ +import search from "../app/lib/search"; + +await search.createIndex("articles", { primaryKey: "id" }); + +const index = search.index("articles"); + +await index.updateFilterableAttributes(["site", "createdTimestamp"]);