fix: use absolute path for OM_DB_PATH to ensure Docker volume persistence #127
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.
📋 Description
Currently, the database of OpenMemory is not persistent because of the relative path in .env.example.
This PR fixes Docker database persistence issues and improves development environment setup. The primary change updates OM_DB_PATH to use an absolute path (/data/openmemory.sqlite) instead of a relative path (./data/openmemory.sqlite), ensuring the database persists across container restarts when using Docker volumes.
Key Changes
- Changed OM_DB_PATH from ./data/openmemory.sqlite to /data/openmemory.sqlite
- Ensures database persists across container restarts when using Docker volume
- Aligns with Docker best practices (data in /data, not /app/data)
- Code fallbacks remain unchanged for local development compatibility
- Updated migrate.ts to use env.db_path instead of duplicating path logic
- Improves code maintainability and consistency
- Added backend symlink pointing to packages/openmemory-js
- Maintains compatibility with VS Code extension and documentation that reference backend/ directory
- Fixes issues after backend directory was removed in Beta 1.3.0
- Added nodemon@^3.1.11 to devDependencies
- Fixes missing dependency that was already used in the dev script since Dec 9, 2025
- Ensures npm run dev works on fresh installs without global nodemon
Updated Files
Database Path Changes:
Other Changes:
🔄 Type of Change
🧪 Testing
Testing Steps
git clone https://github.com/CaviraOSS/OpenMemory.git
cd OpenMemory
cp .env.example .env
cd backend
npm install
npm run dev # default :8080
Start containers
docker compose up -d
Add some test memories (use API or dashboard)
curl -X POST http://localhost:8080/api/memories
-H "Content-Type: application/json"
-d '{"content": "test memory"}'
Stop containers
docker compose down
Restart containers
docker compose up -d
Verify memories persist
curl http://localhost:8080/api/memories
🔍 Code Review Checklist
📚 Related Issues
Fixes database persistence issue in Docker deployments where data was lost on container restart.
🚀 Deployment Notes
Docker Users:
Local Development:
📋 Additional Context
Why Absolute Path?
The relative path ./data/openmemory.sqlite resolves to /app/data/openmemory.sqlite inside the Docker container (since the working directory is /app). This directory is not mounted to a volume, so data is lost when the container is removed.
The absolute path /data/openmemory.sqlite points to the Docker volume mount, ensuring persistence.
Backward Compatibility
Thank you!