Dify is an open-source platform for building LLM applications — a visual workflow editor, RAG pipeline, and agent builder in one interface. It self-hosts via Docker Compose on a standard VPS: clone the repo, copy the env file, run docker compose up, and you have a working instance. Budget at least 2 vCPUs and 4 GB RAM, more if you plan to index large document sets for retrieval.
What Is Dify?
Dify is an open-source LLM application development platform that combines a visual workflow canvas, a built-in retrieval-augmented generation (RAG) pipeline, agent orchestration, and prompt management in a single tool. Instead of writing separate scripts to chain a document lookup, an LLM call, and a formatted response together, you build the pipeline visually and Dify handles the plumbing — vector indexing, model routing, and API exposure for whatever you build.
Why Self-Host Dify Instead of Dify Cloud?
- Data privacy: documents, prompts, and API keys stay on your server instead of a vendor’s infrastructure.
- No per-seat or per-credit pricing: your only recurring cost is the VPS itself.
- Full model flexibility: connect any API-based model (OpenAI, Anthropic, DeepSeek) or a locally hosted model via Ollama.
- GDPR-friendly: deploying on an EU-based VPS keeps document and prompt data inside the geographic boundaries many compliance regimes require.
VPS Requirements for Dify
VPS requirements for Dify: a minimum of 2 vCPUs and 2 GB RAM will run Dify, but 4–8 GB RAM and 2–4 vCPUs are recommended for production use, since embedding generation and vector storage for RAG scale with document volume.
| Component | Minimum | Recommended |
|---|---|---|
| vCPU | 2 | 2–4 |
| RAM | 2 GB | 4–8 GB |
| Storage | 20 GB SSD/NVMe | 40 GB+ NVMe (scales with document volume) |
| Docker Compose | v2.24.0+ | Latest stable |
Specs reflect Dify’s documented Docker Compose requirements; actual RAM usage scales with indexed document/embedding volume.
Dify runs as a multi-container stack — the web frontend, API backend, a worker process, Postgres, Redis, and a vector store (Weaviate by default, swappable for Milvus or others) all run alongside each other. That’s why it needs more headroom than a single-container tool: more RAM if you’re indexing large document sets for RAG, since embedding generation and vector storage are the heaviest parts of the stack.
How to Install Dify on a VPS with Docker Compose
- Provision a VPS meeting the specs above and update the system:
sudo apt update && sudo apt upgrade -y - Install Docker and the Docker Compose plugin (v2.24.0 or later — check with docker compose version)
- Clone the latest Dify release: git clone –branch “
$(curl -s https://api.github.com/repos/langgenius/dify/releases/latest | jq -r .tag_name)” https://github.com/langgenius/dify.git - Move into the docker directory:
cd dify/docker - Copy the example environment file:
cp .env.example .env - Edit
.envto set your domain, secret key, and any model provider API keys you already have - Start the stack:
docker compose up -d - Confirm every container shows Up or healthy:
docker compose ps(an Exited status oninit_permissionsis expected and normal) - Open http://your_server_ip/install in a browser to create the admin account
- Log in at http://your_server_ip and connect your first model provider
- Add a reverse proxy (Caddy or Nginx) with a Let’s Encrypt certificate to serve Dify over HTTPS before exposing it beyond local testing
Why Run Dify on a Contabo VPS
Dify’s multi-container footprint — Postgres, Redis, and a vector store running alongside the app — makes RAM the resource that matters most. A Cloud VPS 8 gives you 24 GB of RAM for 14 €/month, comfortable headroom for a production Dify instance with room to index a meaningful document set. If your RAG workload grows into large-scale embedding storage, the NVMe-backed Cloud VPS Performance line adds faster disk I/O for vector search at a similar RAM-per-Euro value. EU data centers keep the documents you’re indexing — and the prompts your users send — inside GDPR-friendly infrastructure.
FAQ: Self-Hosting Dify
2 GB is the documented minimum, but 4–8 GB is realistic for anything beyond a quick test — the multi-container stack (Postgres, Redis, vector store, worker) adds up quickly, and embedding generation for RAG document indexing is the heaviest part of the workload.
Yes, for internal and commercial use. Dify’s license is a modified Apache 2.0: you can run it commercially as a backend for your own applications without paying anything. The one restriction is operating it as a multi-tenant hosted service for other customers, which requires written permission from the maintainers.
Yes, as long as you’re calling an external model API (OpenAI, Anthropic, DeepSeek) rather than hosting the LLM yourself. A standard CPU-only VPS handles the orchestration, RAG pipeline, and vector search fine. A GPU is only needed if you also want to run the language model itself locally via Ollama or a similar tool.