From ade82f57761d33390cfb3ce44277194e561cae66 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Tue, 19 Dec 2023 11:02:50 -0800 Subject: [PATCH] wip storage workarounds --- docker/render-entrypoint.sh | 14 +++++++------- server/prisma/schema.prisma | 2 +- server/utils/files/multer.js | 5 +---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/docker/render-entrypoint.sh b/docker/render-entrypoint.sh index 95865587e..2f1a8cbf6 100755 --- a/docker/render-entrypoint.sh +++ b/docker/render-entrypoint.sh @@ -2,13 +2,13 @@ # This is the entrypoint for Render.com docker builds. Do not use for targeting # in other service docker builds -if test -f "$STORAGE_DIR/.env"; then - export $(xargs < "$STORAGE_DIR/.env") - echo $STORAGE_DIR - - # Copy pre-built assets into storage dir. - cp -r /app/server/storage/assets/ "$STORAGE_DIR/assets" -fi +# Copy pre-built assets into storage dir. +cp -r /app/server/storage/assets/ "$STORAGE_DIR/assets" +mkdir -p "$STORAGE_DIR/documents" +mkdir -p "$STORAGE_DIR/models" +mkdir -p "$STORAGE_DIR/vector-cache" +mkdir -p "$STORAGE_DIR/assets" +touch "$STORAGE_DIR/anythingllm.db" { cd /app/server/ &&\ npx prisma generate --schema=./prisma/schema.prisma &&\ diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma index e9aa8a8a5..579859d27 100644 --- a/server/prisma/schema.prisma +++ b/server/prisma/schema.prisma @@ -12,7 +12,7 @@ generator client { // } datasource db { provider = "sqlite" - url = "file:../storage/anythingllm.db" + url = "file:/storage/anythingllm.db" } model api_keys { diff --git a/server/utils/files/multer.js b/server/utils/files/multer.js index b0a595b7b..7aad119f4 100644 --- a/server/utils/files/multer.js +++ b/server/utils/files/multer.js @@ -7,10 +7,7 @@ function setupMulter() { // Handle File uploads for auto-uploading. const storage = multer.diskStorage({ destination: function (_, __, cb) { - const uploadOutput = - process.env.NODE_ENV === "development" - ? path.resolve(__dirname, `../../../collector/hotdir`) - : path.resolve(process.env.STORAGE_DIR, `../../collector/hotdir`); + const uploadOutput = path.resolve(__dirname, `../../../collector/hotdir`); cb(null, uploadOutput); }, filename: function (_, file, cb) {