Weaviate Dependency Update
Weaviate Dependency Update
Intro
The built-in Weaviate dependency update was updated to meet the upstream requirement since Dify 1.9.2+. It's strongly advised evaluate the process and back up existing data before upgrading.
Heads up
Version Requirement
The update requires Weaviate>=1.25 by default for built-in Weavaite as weaviate-helm 17.3.3 changes podManagementPolicy to Parallel. Refer to the RAFT consensus model update for more detail.
gRPC connection issue in Dify 1.9.2
A known issue in Dify 1.9.2 where WEAVIATE_GRPC_ENDPOINT weren't implemented. The incompatibility can only be workaround in some cases.
Built-in Weaviate
Patch the weaviate service to expose 50051:
kubectl patch svc -n $NAMESPACE weaviate --type='json' -p='[{"op": "add", "path": "/spec/ports/-", "value": {"name": "grpc", "protocol": "TCP", "port": 50051, "targetPort": 50051}}]'
External Weaviate
In Dify 1.9.2 gRPC endpoint is on the same domain as WEAVIATE_ENDPOINT with hard-coded port. Refer to the source code or skip Dify 1.9.2.
Weaviate Down Time
Weaviate Restart (Built-in Weaviate Only)
The later versions of weaviate-helm introduces immutable objects modification on Statefulset adopting the Helm standard labels brings incompatibility for helm upgrade. To resolve the issue, delete the existing Weaviate Statefulset with kubectl delete statefulset -n $YOUR_NAMESPACE weaviate or temporarily setting weaviate.enable=false before upgrading.
Metadata Migration
User should take into account the time for cluster metadata (referred to as schema in the previous version) migration to complete after Weaviate restarts, refer to docs.
Dify Specific Data Migration
Further migration should be expected for existing data to work with new versions of Dify. Refer to https://docs.dify.ai/en/development/migration/weaviate-v4-migration and https://github.com/langgenius/dify/issues/27291.
[!IMPORTANT]
Vectors imported in the previous version may NOT work new version of Dify and there's no proper, fully tested solution for now. Only the vectors created in the new versions works as expected given our test.
There are caveats that the migration guide from Dify didn't mention. The sections below serves as as additional reference for trouble shooting yet won't cover the whole process.
No curl command in weaviate container
kubectl port-forward -n $NAMESPACE $WEAVIATE_PORT $LOCAL_PORT:$WEAVIATE_CONTAINER_PORT_HTTP, or change .Values.weaviate.service.type (ClusterIP by default) to expose service beyond the cluster.
HTTP401 Access denied with curl
Supply API key (the first element in Values.weaviate.authentication.apiKey.allowed_keys by default) as -H "Authorization: Bearer $WEAVIATE_API_KEY" for weaviate API calls
backup: filesystem not found upon calling /v1/backups/filesystem
Temporarily set .Values.weaviate.backups.filesystem.enabled=true