Repository navigation
Conversation
Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7344
Pull Request Type
Relevant Issues
resolves #7344
Description
Prisma used a hardcoded path under
/app/server/storage. Docker deployments with a customSTORAGE_DIRmount wrote their SQLite database to the container filesystem and lost access to it when the container was recreated.The standard Docker entrypoint resolves
STORAGE_DIRfrom the environment or the mounted server.envand passes one database URL to Prisma migrations and the server. The schema-local fallback uses the original path for direct Prisma commands and startup with an unsetSTORAGE_DIR.Visuals (if applicable)
Additional Information
An existing database still present in an older container can be copied into the configured storage directory before upgrading a deployment with a custom mount.
Developer Validations
yarn lintfrom the root of the repo & committed changesTests:
npm run test -- --runInBand --runTestsByPath server/__tests__/prisma/dockerStorage.test.js.Result: npm run test -- --runInBand --runTestsByPath server/tests/prisma/dockerStorage.test.js (base sources with the final regression file): exit 1, two wrong-path assertions and two passing default cases. See OSSCOUT_BASE.log.
Result: npm run test -- --runInBand --runTestsByPath server/tests/prisma/dockerStorage.test.js (patched): exit 0, all four cases passed. See OSSCOUT_PATCHED.log.
Result: npm run test -- --runInBand --silent --runTestsByPath server/tests/models/systemPromptVariables.test.js server/tests/models/memory.test.js server/tests/utils/chats/chatHistoryReset.test.js server/tests/endpoints/mobile/utils/index.test.js (patched): 96 tests across four suites passed.
Result: npm run test -- --runInBand --silent --runTestsByPath server/tests/models/systemPromptVariables.test.js server/tests/models/modelRouter.test.js server/tests/models/memory.test.js server/tests/utils/chats/chatHistoryReset.test.js server/tests/endpoints/mobile/utils/index.test.js (base): 96 tests across four suites passed. ModelRouter failed to load because the scoped dependency install lacked openai.
Result: docker build --build-context deps=../osscout-deps --build-context probe=../osscout-container -f ../osscout-container/Dockerfile -t anythingllm-osscout-7344 .: passed and verified that the Prisma fallback file was included in the build context.
Result: docker run --rm --mount "type=bind,src=$osscout_mount,dst=/data/anythingllm" -e STORAGE_DIR=/data/anythingllm anythingllm-osscout-7344: passed twice using a shared temporary bind mount. The database file existed on the host. The first container reported previous=null and the second reported previous=persisted from /data/anythingllm/anythingllm.db.
Result: docker run --rm --entrypoint bash anythingllm-osscout-7344 -c 'cd /app/server && CHECKPOINT_DISABLE=1 npx prisma generate && CHECKPOINT_DISABLE=1 npx prisma migrate deploy && CHECKPOINT_DISABLE=1 npx prisma db seed && test -s storage/anythingllm.db': passed.
Result: npm exec --yes --package=prettier@3.2.5 -- prettier --check server/prisma/dockerDatabaseUrl.js server/tests/prisma/dockerStorage.test.js: passed.
Result: bash -n docker/docker-entrypoint.sh && git diff --check: passed.
Regression coverage:
server/__tests__/prisma/dockerStorage.test.js.