dify installation and upgrade
installation command
helm repo add douban https://douban.github.io/charts/
helm upgrade dify douban/dify -n dify -f dify/dify-values.us1.yaml --installMust run this migration command after upgrade
kubectl exec -it dify-pod-name -- flask db upgradeupgrade command
helm diff upgrade dify douban/dify -n dify -f dify/dify-values.us1.yamlhelm upgrade dify douban/dify -n dify -f dify/dify-values.us1.yamlMust run this migration command after upgrade
make kexec # select dify namespace and a worker pod
## when inside worker pod
flask db upgradeCommon Issues
Database Migration Conflicts
Issue: Flask migrations fail with "relation already exists" errors for sequences like task_id_sequence, taskset_id_sequence.
Root Cause: Celery workers start simultaneously with the API container and create database sequences before Flask migrations can run. The Helm chart lacks migration coordination.
Solution: If migrations fail, drop the entire database schema in dify_db databsae
psql -h <psql-host> -U dify_user -d dify_dbDROP SCHEMA public CASCADE; CREATE SCHEMA public;kubectl -n dify exec -it dify-worker-pod -- flask db upgradePrevention: Run migrations on existing pods before helm upgrades, or implement proper init containers for migration coordination.
Plugin Daemon SSL Connection Issue
Issue: Plugin daemon fails with no pg_hba.conf entry error when connecting to external PostgreSQL.
Root Cause: Plugin daemon requires SSL connection to external databases but defaults to non-SSL mode.
Solution: Add DB_SSL_MODE: "require" to plugin daemon environment variables.