Self-Hosted AI Workflow Infrastructure Checklist: NAS, VPS, Docker, Tailscale, and n8n Deployment
这篇文章归入 XBSTACK 的生活现场记录,用真实物件、地点、身体感受和复盘动作连接长期资产系统。
What This Guide Covers
The most common mistake in self-hosted AI workflows is reducing the architecture to “buy a NAS and run n8n.” In practice, deployment is far more complex: how do you handle incoming public Webhooks? How do you keep internal databases secure? How do you manage certificates and reverse proxies? How do you clean up Postgres logs? And how do workflows recover after container restarts?
My recommendation is that individual developers should not aim for an all-encompassing private cloud in the early stages. Instead, build a well-defined infrastructure that supports recovery, backups, and observability. Let each tool—NAS, VPS, Docker, Tailscale, and n8n—do what it does best.
Architecture at a Glance
- NAS: Stores data, handles backups, runs internal databases, provides object storage, and hosts local model services.
- VPS: Acts as the sole public entry point, handling reverse proxying, Webhook reception, and lightweight forwarding.
- Docker Compose: Locks down service versions, ports, volume mounts, and startup order.
- Tailscale: Connects the VPS and NAS, allowing internal services to remain hidden from the public internet.
- n8n: Serves as the workflow orchestration layer, managing triggers, nodes, task states, and failure retries.
The core value of this structure isn’t cost savings; it’s risk isolation. The public-facing machine can be rebuilt if compromised, but NAS data must never be lost. Workflows can fail and be retried, but credentials and databases must never be exposed carelessly.
NAS: More Than Just a Network Drive
In this architecture, the NAS serves three distinct roles.
First, it is the central data asset repository. n8n binaries, exported workflows, Postgres backups, and log archives should all follow a clear directory structure. Do not dump everything into a single docker folder; debugging will become a nightmare later on.
Second, it acts as an internal compute node. If your NAS uses an x86 platform, it can handle lightweight OCR, file conversion, vector indexing, and local model testing. However, avoid overloading the NAS with every AI service. Machines like the Intel N100 are suitable for stable background tasks but ill-suited for sustained high-concurrency inference.
Third, it serves as the backup destination. Anything that can be reinstalled on the VPS shouldn’t be stored long-term there. What truly needs preservation are database dumps, configuration files, key backups, and exported workflows.
VPS: Expose Only What Is Necessary
The VPS’s role should be strictly limited.
It is well-suited for acting as the public entry point for:
- Receiving Webhooks from Stripe, GitHub, Gmail, Slack, Feishu, etc.
- Running reverse proxies like Nginx, Caddy, or Traefik.
- Hosting lightweight health checks and status pages.
- Acting as a Tailscale node to access internal NAS services securely.
It is not suited for long-term data storage or hosting the full workflow database. The most common risk for individual developers is convenience-driven exposure: putting Postgres, Redis, and the n8n admin panel directly on the public internet. It might work short-term, but it creates significant security debt in the long run.
Docker Compose: Focus on Recovery, Not Just Startup
A usable Compose file must explicitly define four key aspects.
services:
n8n:
image: n8nio/n8n:stable
restart: unless-stopped
environment:
- N8N_HOST=automation.example.com
- WEBHOOK_URL=https://automation.example.com/
- DB_TYPE=postgresdb
volumes:
- ./data/n8n:/home/node/.n8n
depends_on:
- postgres
postgres:
image: postgres:16
restart: unless-stopped
volumes:
- ./data/postgres:/var/lib/postgresql/data
This is a structural diagram only; do not copy it directly for production. When deploying, store the secret in .env, rotate database passwords regularly, verify permissions on volume mount directories, and plan a separate backup directory.
Tailscale: Isolating Public Entry Points from Private Services
The value of Tailscale isn’t “magic penetration”; it’s that your VPS can access your NAS without exposing the NAS’s database ports to the public internet.
I recommend this boundary setup:
- External requests hit the VPS first.
- The VPS accesses NAS services within the Tailnet via a reverse proxy or workflow node.
- Postgres, MinIO, Ollama, and internal APIs on the NAS listen only on internal or Tailnet IPs.
- Enable login, two-factor authentication, IP restrictions, or an additional gateway for the n8n admin interface.
This boundary mitigates a real-world risk: if the VPS gets port-scanned, the attack surface is contained at the entry layer rather than directly hitting your home data center.
Common Errors and Troubleshooting Steps
Permission denied
Permission denied: /home/node/.n8n/binaryData
First, check the host machine’s directory permissions, then verify the user running inside the container. The common UID/GID for n8n containers is 1000:1000; don’t use chmod 777 just to cut corners.
Webhook Access 404 or 502
Check three things first: whether WEBHOOK_URL is a complete public address, if the reverse proxy is forwarding correctly, and if n8n knows it’s running behind a proxy. Many 404 issues aren’t workflow problems at all, but rather inconsistencies in the entry-level paths.
Postgres Growing Larger Over Time
If full execution saving is enabled, n8n’s execution records will continue to expand. You must configure retention periods, schedule regular vacuums, establish backup strategies, and set up alert thresholds.
Self-Hosted vs. SaaS: Don’t Just Look at Price
| Dimension | Self-Hosted (NAS + VPS) | Make / Zapier / Managed n8n |
|---|---|---|
| Data Control | Data stays on your own machines or a designated VPS | Relies on platform hosting |
| Maintenance Cost | Requires maintaining the system, backups, and security | Mostly handled by the platform |
| Scalability | Can write code and connect to internal network services | Limited by platform nodes and quotas |
| Stability | Depends on your operational capabilities | Depends on the platform’s SLA |
| Target Audience | Developers comfortable with Docker and willing to maintain | Those looking for quick business delivery |
My advice is simple: if you’re just running a few lightweight automations, SaaS is the hassle-free choice. If you already have a NAS, need to connect to internal network data, and are sensitive to costs and data boundaries, then consider self-hosting.
Pre-launch Checklist
- The n8n admin panel is not exposed without protection.
- Webhook domains, certificates, and reverse proxy paths have all been tested.
- Postgres has automated backups and a recovery drill in place.
.envis excluded from Git.- Tailscale ACLs do not grant excessive permissions to the entire subnet.
- Execution logs have a retention policy.
- Critical workflows have failure notifications configured.
- Both the VPS and NAS have auto-recovery strategies after a reboot.
Continue Reading
下一步阅读
返回专题入口 →Outdoor EDC: What Actually Matters in a Programmer's Pack Isn't Style—It's Getting Home Safe
Gear review breakdown: usage scenarios, specs and weight, pros and cons, price alternatives, and real-world issues.
HHKB In-Depth Review: The 2026 Programmer's Ultimate Productivity Contract
In 2026, if you're still chasing flashy RGB and complex switches, you haven't grasped the 'compound interest' of coding. This deep dive breaks down the HHKB Professional Hybrid Type-S. It's not your typical unboxing post; it's a guide to productivity optimization, electrostatic capacitance logic, and...
继续探索
XBSTACK Paths
Xiaobai
Full-Stack AI Engineer
Xiaobai, a full-stack AI engineer building production Agent systems, product tools and independent software assets.
About Xiaobai & XBSTACK →