Layer 4 · self-hosting reality check
What it actually takes to self-host Dify
The docs say 4 GiB (Dify's stated minimum: 2 CPU cores, 4 GiB RAM). In practice you want 8 GB. The default compose file starts 16 containers — api, api_websocket, worker, worker_beat, web, plugin_daemon, agent_backend, Weaviate, PostgreSQL, Redis, nginx, two SSRF proxies, two sandboxes and a one-shot init job — and Dify's own macOS instructions ask for a Docker VM with 8 GiB. More if a local model shares the box.. Here is the honest version — real requirements, real monthly cost, what you will be maintaining, and the one thing that catches people out.
Usually reached from OpenAI AgentKit alternatives, where Dify is one of the picks.
Wondering whether you need to at all? Is OpenAI AgentKit free? — what the free tier actually allows, and where the wall is.
| RAM — documented minimum | 4 GiB (Dify's stated minimum: 2 CPU cores, 4 GiB RAM) |
|---|---|
| RAM — what it really needs | 8 GB. The default compose file starts 16 containers — api, api_websocket, worker, worker_beat, web, plugin_daemon, agent_backend, Weaviate, PostgreSQL, Redis, nginx, two SSRF proxies, two sandboxes and a one-shot init job — and Dify's own macOS instructions ask for a Docker VM with 8 GiB. More if a local model shares the box. |
| CPU | 2 vCPU minimum (stated); 4 vCPU is more comfortable once workers and the vector store share the box. No GPU unless you also host the models. |
| Disk | Not stated by the project. PostgreSQL, Redis, Weaviate and uploaded files live under docker/volumes, and the vector index grows with every document chunk you embed into a knowledge base — size the disk from your document corpus, not from the app. |
| Monthly cost | $24–48/mo for a 4–8 GB VPS at DigitalOcean list prices (less on budget hosts), plus whatever LLM API or GPU your workflows call — Dify itself does not run the model |
| Setup time | 30–60 minutes with Docker Compose; an afternoon once a domain, HTTPS and SMTP are involved |
| How you install it | git clone the latest release, cd docker, cp .env.example .env, docker compose up -d (Docker Compose 2.24.0+), then finish setup at /install |
| Ongoing maintenance | Frequent releases. After every upgrade, compare each .env.example against your .env for new variables and reapply your customisations to the new docker-compose.yaml rather than keeping the old one — releases add services. Back up the PostgreSQL and vector-store volumes first. |
| Where it stops scaling | One 8 GB box serves a team's internal apps. Past that, point DB_HOST, REDIS_HOST and VECTOR_STORE at external services (Postgres, Qdrant, Milvus, pgvector and others are supported) and run more api and worker containers. Serving many tenants needs a commercial licence, not more hardware. |
The thing that catches people out
The licence is not plain Apache 2.0. The Dify Open Source License adds two conditions: you may not use the source to operate a multi-tenant environment without Dify's written authorisation — and it defines one tenant as one workspace — and you may not remove or modify the logo or copyright information in the console or apps. Internal use is fine; if the plan is to host it for several customers or white-label it, get a commercial licence first or pick a builder under a standard OSI licence.
When not to self-host Dify
You intend to resell it as a hosted, multi-workspace service or ship it under your own brand — the licence forbids both without a commercial agreement. A builder under a standard OSI licence, such as Langflow (MIT), avoids that problem entirely.
Every guide here carries this section. A site that only ever tells you to self-host is selling something — the useful answer is sometimes no.
Other Layer 4 self-hosting guides
- Self-hosting Ollama8 GB VRAM for a 7B model at usable speed; 24 GB for 30B-class
- Self-hosting vLLM24 GB VRAM minimum for useful production serving
- Self-hosting QdrantVectors × dimensions × 4 bytes, in RAM, plus overhead — 1M × 768d is roughly 3 GB
- Self-hosting pgvector8 GB — the HNSW index wants to be resident
- Self-hosting LlamaIndex4 GB for the app; your vector store is the real cost
- Self-hosting faster-whisper5 GB VRAM for large-v3 in float16; 2 GB with int8
Common questions
- How much RAM does Dify actually need?
- 8 GB. The default compose file starts 16 containers — api, api_websocket, worker, worker_beat, web, plugin_daemon, agent_backend, Weaviate, PostgreSQL, Redis, nginx, two SSRF proxies, two sandboxes and a one-shot init job — and Dify's own macOS instructions ask for a Docker VM with 8 GiB. More if a local model shares the box. in practice. The documented minimum is 4 GiB (Dify's stated minimum: 2 CPU cores, 4 GiB RAM), which is the figure at which the process starts rather than the figure at which it works under real use. 2 vCPU minimum (stated); 4 vCPU is more comfortable once workers and the vector store share the box. No GPU unless you also host the models. alongside it.
- What does self-hosting Dify cost per month?
- $24–48/mo for a 4–8 GB VPS at DigitalOcean list prices (less on budget hosts), plus whatever LLM API or GPU your workflows call — Dify itself does not run the model This is commodity VPS pricing and excludes your time, which is the larger cost for most people — budget for frequent releases. After every upgrade, compare each .env.example against your .env for new variables and reapply your customisations to the new docker-compose.yaml rather than keeping the old one — releases add services. Back up the PostgreSQL and vector-store volumes first.
- How long does it take to set up Dify?
- 30–60 minutes with Docker Compose; an afternoon once a domain, HTTPS and SMTP are involved, via git clone the latest release, cd docker, cp .env.example .env, docker compose up -d (Docker Compose 2.24.0+), then finish setup at /install.
- When should I NOT self-host Dify?
- You intend to resell it as a hosted, multi-workspace service or ship it under your own brand — the licence forbids both without a commercial agreement. A builder under a standard OSI licence, such as Langflow (MIT), avoids that problem entirely.
- What is the most common mistake when self-hosting Dify?
- The licence is not plain Apache 2.0. The Dify Open Source License adds two conditions: you may not use the source to operate a multi-tenant environment without Dify's written authorisation — and it defines one tenant as one workspace — and you may not remove or modify the logo or copyright information in the console or apps. Internal use is fine; if the plan is to host it for several customers or white-label it, get a commercial licence first or pick a builder under a standard OSI licence.