[n8n] Add n8n service with host-mounted backups path#30
Conversation
Adds n8n following the 3-file service convention (docker-compose.yml, .env.example, README.md). SQLite storage with a configurable backups folder bind-mounted at /backups using rslave propagation, so the same compose file can run on a host with NFS-backed storage or on a plain local directory, switching only via N8N_BACKUPS_PATH. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds an n8n Docker Compose deployment: an example Changesn8n Docker Compose Deployment
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
n8n/README.md (1)
30-32:⚠️ Potential issue | 🟠 MajorDocumentation inconsistency with docker-compose.yml.
The README states the service "Connects to
dokploy-network", but the docker-compose.yml file does not include anetworks:key under the service definition, so the container will not actually connect to dokploy-network. This inconsistency was flagged in the docker-compose.yml review.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@n8n/README.md` around lines 30 - 32, The README claims the service connects to "dokploy-network" but the docker-compose.yml service is missing a networks: declaration; update the docker-compose.yml service block for the n8n service to include networks: - dokploy-network and ensure a top-level networks: dokploy-network: external: true (or alternatively update n8n/README.md to remove/adjust the network claim) so the docs and compose file match; reference "dokploy-network", "docker-compose.yml" and the n8n service name when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@n8n/docker-compose.yml`:
- Around line 9-17: Service is missing a networks key so it won't attach to
dokploy-network and property order violates guidelines; add a networks: entry
referencing dokploy-network above ports (i.e., place networks before ports and
volumes) in the service definition so the container attaches to dokploy-network
and follows the required property order; ensure the networks key lists
dokploy-network exactly (matching the top-level dokploy-network declaration).
---
Duplicate comments:
In `@n8n/README.md`:
- Around line 30-32: The README claims the service connects to "dokploy-network"
but the docker-compose.yml service is missing a networks: declaration; update
the docker-compose.yml service block for the n8n service to include networks: -
dokploy-network and ensure a top-level networks: dokploy-network: external: true
(or alternatively update n8n/README.md to remove/adjust the network claim) so
the docs and compose file match; reference "dokploy-network",
"docker-compose.yml" and the n8n service name when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 313bbae6-5a75-4363-8637-99ac041bc7e4
📒 Files selected for processing (3)
n8n/.env.examplen8n/README.mdn8n/docker-compose.yml
| ports: | ||
| - "${N8N_PORT}:5678" | ||
| volumes: | ||
| - ${N8N_DATA}/data:/data | ||
| - type: bind | ||
| source: ${N8N_BACKUPS_PATH} | ||
| target: /backups | ||
| bind: | ||
| propagation: rslave |
There was a problem hiding this comment.
Missing networks: key causes the service to ignore dokploy-network.
The dokploy-network is declared at the file level (lines 38-40) but the service definition lacks a networks: key, so the container will connect to the default bridge network instead of dokploy-network as intended by the PR and documented in the README.
Additionally, the coding guidelines require the property order: networks > ports > volumes, but here ports and volumes appear before any networks key.
🔧 Proposed fix
security_opt:
- no-new-privileges:true
+ networks:
+ - dokploy-network
ports:
- "${N8N_PORT}:5678"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ports: | |
| - "${N8N_PORT}:5678" | |
| volumes: | |
| - ${N8N_DATA}/data:/data | |
| - type: bind | |
| source: ${N8N_BACKUPS_PATH} | |
| target: /backups | |
| bind: | |
| propagation: rslave | |
| networks: | |
| - dokploy-network | |
| ports: | |
| - "${N8N_PORT}:5678" | |
| volumes: | |
| - ${N8N_DATA}/data:/data | |
| - type: bind | |
| source: ${N8N_BACKUPS_PATH} | |
| target: /backups | |
| bind: | |
| propagation: rslave |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@n8n/docker-compose.yml` around lines 9 - 17, Service is missing a networks
key so it won't attach to dokploy-network and property order violates
guidelines; add a networks: entry referencing dokploy-network above ports (i.e.,
place networks before ports and volumes) in the service definition so the
container attaches to dokploy-network and follows the required property order;
ensure the networks key lists dokploy-network exactly (matching the top-level
dokploy-network declaration).
Source: Coding guidelines
There was a problem hiding this comment.
Pull request overview
Adds a new n8n self-hosted stack to this repository, intended to be deployed as an independent Dokploy application while bind-mounting a host backups directory (optionally backed by an OS-level NFS automount).
Changes:
- Added
n8n/docker-compose.ymldefining the n8n container, host port mapping, and bind mounts for/dataand/backups(withrslavepropagation for backups). - Added
n8n/.env.exampledocumenting required configuration (data path, user, host/protocol, encryption key, backups path). - Added
n8n/README.mddescribing deployment model (two hosts differing only by env) and the NFS automount approach.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
n8n/docker-compose.yml |
Introduces the n8n Compose stack, volumes, env, and external network declaration. |
n8n/.env.example |
Provides example environment variables for configuring the stack on different hosts. |
n8n/README.md |
Documents configuration, volumes, and the OS-level NFS automount design rationale. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| security_opt: | ||
| - no-new-privileges:true | ||
| ports: | ||
| - "${N8N_PORT}:5678" | ||
| volumes: |
| # n8n | ||
|
|
||
| Deploys [n8n](https://n8n.io/), a workflow automation tool. | ||
| Uses SQLite for storage and bind-mounts a host folder at | ||
| `/backups`. |
- Remove the dokploy-network declaration; Dokploy attaches its own network automatically on deploy (resolves the docs/compose mismatch flagged in review). - Add a language to the fstab fenced code block (MD040) and realign the env vars table (MD060). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Overview
Adds n8n (workflow automation) as a new self-hosted service, following the repo's 3-file convention (
docker-compose.yml,.env.example,README.md).Design
/data./backupsvia${N8N_BACKUPS_PATH}, withrslavemount propagation.N8N_BACKUPS_PATHpoints to an OS-level NFS automount.N8N_BACKUPS_PATHpoints to a local directory.Why OS-level NFS automount instead of a Docker NFS volume
Mounting NFS via the OS (fstab with
x-systemd.automount,nofail) decouples n8n's startup from storage availability: after a power outage the container boots immediately even if the storage server is slower to come up, andrslavepropagation makes the on-demand mount visible inside the running container. While the share is down, backups fail cleanly rather than writing to local disk and being silently lost.Notes
dokploy-network(external),restart: unless-stopped, Watchtower opt-in label, and the standard compose property order..env(not committed).🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Chores