fix: respect NODE_DB_PATH environment variable in Docker (fixes #40)
- Fixed docker-entrypoint.sh to use NODE_DB_PATH instead of hardcoded paths - Added log_message() helper to prevent stdio mode output corruption - Fixed directory creation race condition with proper ownership - Added path validation to ensure NODE_DB_PATH ends with .db - Updated rebuild.ts to respect NODE_DB_PATH environment variable - Added comprehensive documentation for custom database paths - Bumped version to 2.7.16 The bug was caused by hardcoded /app/data/nodes.db paths in the Docker entrypoint script that ignored the NODE_DB_PATH environment variable. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,7 @@ docker run -d \
|
||||
| `PORT` | HTTP server port | `3000` | No |
|
||||
| `NODE_ENV` | Environment: `development` or `production` | `production` | No |
|
||||
| `LOG_LEVEL` | Logging level: `debug`, `info`, `warn`, `error` | `info` | No |
|
||||
| `NODE_DB_PATH` | Custom database path (v2.7.16+) | `/app/data/nodes.db` | No |
|
||||
|
||||
*Either `AUTH_TOKEN` or `AUTH_TOKEN_FILE` must be set for HTTP mode. If both are set, `AUTH_TOKEN` takes precedence.
|
||||
|
||||
@@ -342,6 +343,28 @@ docker run --rm \
|
||||
alpine tar xzf /backup/n8n-mcp-backup.tar.gz -C /target
|
||||
```
|
||||
|
||||
### Custom Database Path (v2.7.16+)
|
||||
|
||||
You can specify a custom database location using `NODE_DB_PATH`:
|
||||
|
||||
```bash
|
||||
# Use custom path within mounted volume
|
||||
docker run -d \
|
||||
--name n8n-mcp \
|
||||
-e MCP_MODE=http \
|
||||
-e AUTH_TOKEN=your-token \
|
||||
-e NODE_DB_PATH=/app/data/custom/my-nodes.db \
|
||||
-v n8n-mcp-data:/app/data \
|
||||
-p 3000:3000 \
|
||||
ghcr.io/czlonkowski/n8n-mcp:latest
|
||||
```
|
||||
|
||||
**Important Notes:**
|
||||
- The path must end with `.db`
|
||||
- For data persistence, ensure the path is within a mounted volume
|
||||
- Paths outside mounted volumes will be lost on container restart
|
||||
- The directory will be created automatically if it doesn't exist
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
@@ -506,4 +529,4 @@ services:
|
||||
|
||||
---
|
||||
|
||||
*Last updated: June 2025 - Docker implementation v1.0*
|
||||
*Last updated: July 2025 - Docker implementation v1.1*
|
||||
@@ -5,6 +5,7 @@ This guide helps resolve common issues when running n8n-mcp with Docker, especia
|
||||
## Table of Contents
|
||||
- [Common Issues](#common-issues)
|
||||
- [502 Bad Gateway Errors](#502-bad-gateway-errors)
|
||||
- [Custom Database Path Not Working](#custom-database-path-not-working-v27160)
|
||||
- [Container Name Conflicts](#container-name-conflicts)
|
||||
- [n8n API Connection Issues](#n8n-api-connection-issues)
|
||||
- [Docker Networking](#docker-networking)
|
||||
@@ -13,6 +14,41 @@ This guide helps resolve common issues when running n8n-mcp with Docker, especia
|
||||
|
||||
## Common Issues
|
||||
|
||||
### Custom Database Path Not Working (v2.7.16+)
|
||||
|
||||
**Symptoms:**
|
||||
- `NODE_DB_PATH` environment variable is set but ignored
|
||||
- Database always created at `/app/data/nodes.db`
|
||||
- Custom path setting has no effect
|
||||
|
||||
**Root Cause:** Fixed in v2.7.16. Earlier versions had hardcoded paths in docker-entrypoint.sh.
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Update to v2.7.16 or later:**
|
||||
```bash
|
||||
docker pull ghcr.io/czlonkowski/n8n-mcp:latest
|
||||
```
|
||||
|
||||
2. **Ensure path ends with .db:**
|
||||
```bash
|
||||
# Correct
|
||||
NODE_DB_PATH=/app/data/custom/my-nodes.db
|
||||
|
||||
# Incorrect (will be rejected)
|
||||
NODE_DB_PATH=/app/data/custom/my-nodes
|
||||
```
|
||||
|
||||
3. **Use path within mounted volume for persistence:**
|
||||
```yaml
|
||||
services:
|
||||
n8n-mcp:
|
||||
environment:
|
||||
NODE_DB_PATH: /app/data/custom/nodes.db
|
||||
volumes:
|
||||
- n8n-mcp-data:/app/data # Ensure parent directory is mounted
|
||||
```
|
||||
|
||||
### 502 Bad Gateway Errors
|
||||
|
||||
**Symptoms:**
|
||||
|
||||
Reference in New Issue
Block a user