Overview
Dify is an open-source builder for LLM applications: chatbots, agents and visual workflows with RAG knowledge bases. You build an app in the browser, then publish it as a web page, call it through the REST service API or expose it as an MCP server. This template runs Dify on a bundled PostgreSQL with pgvector and a bundled Redis. A login is always required.What Gets Created
*.cpln.app URL is on by default and every page needs a Dify login. Each Dify tier accepts connections only from the tiers that call it.
Prerequisites
Create the Dify keys secret
initPassword to at most 30 characters:dify.secretName to this name.Create the code sandbox key secret
codeExecution.apiKeySecretName to this name.Create the database credentials secret
username, password and database, letters and digits only:postgres.config.credentialsSecretName to this name (or postgresHA.config.credentialsSecretName with the HA database).Create the Redis password secret
password key, letters and digits only. A password is required because user code runs inside this GVC:redis.redis.auth.fromSecret.name to this name.Installation
The required values are the names of the four secrets from Prerequisites:--set postgres.enabled=false --set postgresHA.enabled=true --set postgresHA.config.credentialsSecretName=DB_CREDENTIALS_SECRET_NAME.
To install with the CLI, UI, Terraform or Pulumi, follow the instructions for your preferred method:
UI
CLI
Terraform
Pulumi
Configuration
Dify
resources shape under dify.resources.
SQLALCHEMY_POOL_SIZE 5 plus SQLALCHEMY_MAX_OVERFLOW 3), which allows about 8 concurrent runs per API replica. To allow more, set both in dify.extraEnv, staying within PostgreSQL’s 100 connections:
Code Execution and Network
Database
Redis
Connecting
dify.publicUrl empty it is the gateway’s *.cpln.app endpoint. Behind a custom domain, route the domain to the RELEASE_NAME-dify workload and set dify.publicUrl to it. With publicAccess.enabled: false, set dify.publicUrl to the address users open, such as http://localhost:8080 for port-forward.
To check the gateway, forward the port and read its health:
dify.requestTimeoutSeconds; calls from inside the GVC over cpln.local are not subject to it.
First Run
Open the public URL. Dify asks for theinitPassword from the Dify keys secret, then lets you create the admin account on the /install page. Read the password with cpln secret reveal DIFY_SECRET_NAME -o yaml. Self sign-up and creating more workspaces are turned off; invite members from Settings → Members, which shows an invite link to copy because the template sends no email.
Operations
Backing Up
All state lives in PostgreSQL and the file storage volume. Enablepostgres.backup.enabled (or postgresHA.backup.enabled with the HA database) and fill in the provider block; the keys and defaults are in the chart’s values.yaml. The bucket, cloud account and IAM policy are set up as described in the postgres or postgres-highly-available template, and a MinIO provider needs a dictionary secret with the keys accessKey and secretKey. Restore steps are in those templates’ pages. The backup covers the database only; uploaded files and the keys that decrypt saved provider credentials on the file storage volume are not included.
Backup retention
The backup job only uploads; it never deletes old backups. To keep a fixed window, add a lifecycle rule on the bucket that expires objects under the backup prefix. Each backup is a complete, standalone copy, so expiring old ones never affects restoring a newer one. Set the window to at least your retention plus one backup interval, and note that an age rule keeps no minimum: if backups stop running, the last ones expire too. Inwal-g mode (postgresHA.backup.mode: wal-g), a restore needs the newest full base backup plus the WAL files written after it, all under the same prefix and never rewritten. Older base backups and the WAL before them are not needed, so the same rule is safe as long as the window is longer than two base-backup intervals (postgresHA.backup.walg.intervalSeconds). If base backups stop while WAL archiving continues, the rule eventually expires the last base backup, so check that new basebackups_005/ entries keep appearing.
The rules below use the default prefix postgres/backups/; change it if you changed postgres.backup.<provider>.prefix (or postgresHA.backup.<provider>.prefix in HA mode).
AWS S3. put-bucket-lifecycle-configuration replaces every existing rule on the bucket, so check for existing rules first and add them to the file:
--lifecycle-file also replaces the bucket’s existing rules; check with gcloud storage buckets describe gs://BUCKET_NAME --format='json(lifecycle_config)' first:
s3:PutLifecycleConfiguration, which the built-in readwrite policy grants):
Noncurrent parts matter only on a versioned bucket, where expiry otherwise just adds a delete marker.
Upgrading from 1.x
The single-instance database of 2.0.0 runs PostgreSQL 19. A 1.x release’s data directory is PostgreSQL 18, and a data directory only starts under the major version that created it: on a PostgreSQL 19 image the database container does not start PostgreSQL and changes nothing on the volume.RELEASE_NAME-postgres stays not ready, Dify waits for it, and the database logs repeat a [pg-guard] REFUSING TO START message:
cpln helm upgrade does not reuse the release’s values). Use the pgvector image (the database log names it), because Dify’s knowledge bases need the extension:
--set postgres.image=pgvector/pgvector:0.8.7-pg18; the database comes back on its data. The Console upgrade wizard keeps the installed image and warns before a change to another major version.
Move to PostgreSQL 19 (a dump and restore into a new release in the same GVC; Dify gets a new endpoint and cannot write while the copy runs):
-
Install 2.0.0 as a new release with the same
dify.secretName,postgres.config.credentialsSecretNameandcodeExecution.apiKeySecretName. Wait untilNEW_RELEASE-dify-apiandNEW_RELEASE-dify-plugin-daemonare ready (they create empty schemas); do not open its/installpage. -
Copy the file storage (uploads and the keys that decrypt saved model credentials) and the installed plugins through your machine while the old release still runs (
./cwd, the plugins’ Python environments, is left out: the plugin daemon rebuilds it):cpln cpmay end withCannot change mode ... Operation not permittedand exit 2: the volume’s root directory belongs to root, so its mode cannot be copied. The files themselves arrive; check withcpln workload exec NEW_RELEASE-dify-api --gvc GVC_NAME --container api -- ls -la /app/api/storage. -
Stop writes on both releases:
-
Stream both databases (Dify’s own and the plugin daemon’s
dify_plugin) into the new release, inside its database container (--cleanreplaces the empty schemas; nothing binary crossescpln workload exec): -
Start the new release (for the first few minutes the plugin daemon rebuilds the plugins’ environments, and knowledge bases and the plugin list return errors until it finishes), sign in with your existing account, check your apps, knowledge bases and model providers, and point your users at the new URL (or move your custom domain and
dify.publicUrl): - Uninstall the old release.
postgresHA). The upgrade is in place: an existing cluster keeps the PostgreSQL major it was created with (17 for a 1.x release) on the new patroni-postgres:0.9 image, and only a new cluster starts on PostgreSQL 18. To move an existing cluster to 18, follow Upgrading an existing cluster to PostgreSQL 18 in the postgres-highly-available template, with a new Dify 2.0.0 release (postgresHA.enabled: true, the same secrets) as the second release. This chart names its database workloads RELEASE_NAME-postgres-ha and RELEASE_NAME-postgres-ha-proxy, so those commands apply as written, and pg_dumpall copies both of Dify’s databases. Copy the file storage and plugins as in step 2, and stop both releases’ Dify workloads as in step 3 while the copy runs. The backup identity no longer carries cpln-connector; your bucket-scoped IAM policy needs no change.
Scaling and Availability
Setdify.replicas from 1 to 3 for the gateway, web, API, code sandbox and SSRF proxy, and worker.replicas from 1 to 3 for the worker. The scheduler and the plugin daemon always run one replica. When several API replicas start together, one applies the database migrations and the others wait for it.
For near-zero-downtime upgrades and failover, set dify.replicas: 2, worker.replicas: 2 and postgresHA.enabled: true. Redis stays a single node.
After changing a secret a workload reads, redeploy the workloads that use it:
Clearing a Login Lockout
Dify locks an email address out for 24 hours after 6 failed logins, from any address. To clear it, delete the lock from Redis:Troubleshooting
The deployment is stuck and cpln logs returns nothing
The deployment is stuck and cpln logs returns nothing
status.versions[].message with cpln workload get-deployments RELEASE_NAME-dify-api --gvc GVC_NAME -o yaml, create the secret, then run cpln workload force-redeployment WORKLOAD_NAME --gvc GVC_NAME on each Dify workload.The API, worker or scheduler stops at start with a log line naming a key
The API, worker or scheduler stops at start with a log line naming a key
secretKey is empty, or initPassword is longer than 30 characters. Fix the secret and redeploy the Dify workloads.Login fails or the console loops back to the sign-in page
Login fails or the console loops back to the sign-in page
dify.publicUrl. For a private install or a custom domain, set dify.publicUrl to the address users open, without a trailing slash.An HTTP Request node cannot reach a service in my GVC
An HTTP Request node cannot reach a service in my GVC
*.cpln.local) for HTTP Request nodes, tools and Python HTTP calls. Set ssrfProxy.enabled: false to lift it, knowing that flows can then call any service in the GVC. Model-provider plugins run in the plugin daemon, not through the proxy, so Ollama, vLLM and LiteLLM providers can use in-GVC URLs.Runs fail with QueuePool limit of size 5 overflow 3 reached
Runs fail with QueuePool limit of size 5 overflow 3 reached
SQLALCHEMY_POOL_SIZE and SQLALCHEMY_MAX_OVERFLOW in dify.extraEnv, as shown in Configuration.Long runs are cut off on the public URL
Long runs are cut off on the public URL
dify.requestTimeoutSeconds (default 600, maximum 3600). Raise it for longer calls.An email is locked out after failed logins
An email is locked out after failed logins
The chart refuses to render
The chart refuses to render
redis.mode other than dev, and extraEnv names that the chart sets itself.Important Notes
- The Dify license allows one workspace per install, not a multi-tenant service, and forbids removing or changing the Dify logo and copyright in the console.
- Never rotate
secretKey(it signs every login and shared link) and never delete the file storage volume (it holds the keys that decrypt the model-provider credentials saved in Dify). - Anyone who can edit an app can run Python and JavaScript in the code sandbox, and that code can open direct connections to the internet. The Dify API, web and plugin daemon refuse the sandbox, but the other services in this GVC, including the bundled PostgreSQL and Redis, are guarded only by their passwords. Give accounts only to people you trust.
- With the SSRF proxy on, HTTP Request nodes, tools and Python
requestscalls in Code nodes go through it. JavaScript code gets no proxy. - Plugins install from the Dify marketplace or an uploaded package, and only signed plugins are accepted.
- Use a single-location GVC: the database, Redis, both volumes and the plugin daemon run in one location.
- The first
helm upgradeafter an install can restart the bundled database, which briefly interrupts Dify. - Uninstalling deletes the database and both volumes, and with them every app, user, knowledge base and installed plugin.
- Upgrading a 1.x release with the single-instance database needs
postgres.image: pgvector/pgvector:0.8.7-pg18in your values on that and every later upgrade, or the database refuses to start (data untouched); moving the data to PostgreSQL 19 is a dump and restore into a new release. The file storage and installed plugins are copied separately from the database. See Upgrading from 1.x.