Crescendo Lab

Self-host Dify · Agent Lab Deploy

Self-host Dify.
In one sentence.

Skip the ten-service docker compose: say one sentence and Agent Lab runs Dify as apps on PostgreSQL (pgvector) and Redis.

Set up DifySee the architecture

Why self-host

Dify Cloud caps by plan. Self-hosted follows your usage.

Self-hosted, quotas, knowledge size and seats follow your resources.

No docker compose to babysit

API, worker, web and plugin daemon are separate apps that restart independently.

pgvector as the vector store

Vectors live in the same PostgreSQL. No separate Weaviate.

Your own model keys

Model keys stay in your database; the platform generates SECRET_KEY.

Upgrades roll back

New releases run on a preview URL first; one action rolls back.

Choosing

Dify Cloud vs a VPS vs Agent Lab

The table scrolls sideways.

Three ways to run Dify compared
What matters to youAgent Lab DeployDify CloudYour own VPS
QuotasYour resourcesCapped per planYour server
Who runs itThe platformDifyYou
Vector storePostgreSQL pgvectorManaged by DifyWeaviate, yours to run
Where the data livesYour Agent Lab organizationDify's cloudYour server
SetupOne sentence to an AI toolSign updocker compose, ten services

How

Connect → one sentence → storage keys → open Dify

Starts on Pro.

  1. Connect Agent Lab

    One MCP line in your AI tool, one sign-in.

  2. Say one sentence

    The agent creates four apps, PostgreSQL (pgvector) and Redis, all connected.

  3. Set file storage

    Put your S3-compatible bucket keys in the console's project secrets.

  4. Open Dify

    Open dify-web's URL, set the admin, add model keys.

Architecture

Four apps, one database, one Redis

api serves, worker indexes, web is the UI, plugin runs plugins; add a sandbox for code nodes.

Dockerfile

Dockerfile

# 一個 Dify 由幾個 App 組成,每個一份 Dockerfile
# One Dify is several apps, one Dockerfile each

# dify-api
FROM langgenius/dify-api:latest
ENV MODE=api \
    DB_TYPE=postgresql \
    VECTOR_STORE=pgvector \
    STORAGE_TYPE=s3
EXPOSE 5001

# dify-worker:  same image, ENV MODE=worker
# dify-web:     FROM langgenius/dify-web:latest   (EXPOSE 3000)
# dify-plugin:  FROM langgenius/dify-plugin-daemon:latest-local
  • DB_HOST / DB_PORT / DB_DATABASE / DB_USERNAME / DB_PASSWORD written by databases_connect_app; needs pgvector
  • REDIS_HOST / REDIS_PORT / REDIS_PASSWORD written by caches_binding_connect
  • SECRET_KEY from sites_secrets_generate, shared by all four
  • S3_BUCKET_NAME / S3_ACCESS_KEY / S3_SECRET_KEY upload storage; set as console secrets
PROMPT

Say this to your AI tool

Read https://app.agentlab.cresclab.com/agent/deploy.md and deploy Dify to Agent Lab following agentlab.cresclab.com/en/deploy/dify: create the dify-api, dify-worker, dify-web and dify-plugin apps; create and connect a PostgreSQL (with pgvector) and a Redis; generate SECRET_KEY on the platform; store files in my S3 bucket and tell me where in the console to enter its keys. Give me Dify's URL when it's up.

FAQ

Before you self-host Dify

How much does it cost to self-host Dify?
It starts on Pro: US$29 a month before tax with US$14 of monthly usage credit that apps and databases draw on. Use an L database or larger.
Self-hosted Dify vs Dify Cloud?
Self-hosted, quotas follow your resources and data and keys stay in your organization, with your own settings and plugins; Dify Cloud is managed by Dify with per-plan caps.
Do I have to use docker compose for Dify?
The official example is docker compose, but every Dify service is its own image; on Agent Lab each is an app (dify-api, dify-worker, dify-web, dify-plugin) that builds and restarts on its own.
Which vector database should Dify use?
PostgreSQL's pgvector: set VECTOR_STORE to pgvector. No separate Weaviate or Qdrant, one backup.
Can I use Claude, GPT or Gemini?
Yes. Enter your API keys under Settings › Model providers; they are stored encrypted in your database.