Manual deployment
50
https://www.aliyun.com/solution/tech-solution/rapidly-deploy-dify-to-accelerate-ai-application-development
Overview
Dify lets you quickly build AI applications without coding. However, a local Dify deployment is limited by fixed hardware specifications and lacks business elasticity. Dify Cloud does not support custom development and lacks operations and maintenance (O&M) capabilities. Alibaba Cloud Container Service for Kubernetes (ACK) provides high-performance elastic computing resources. It supports rapid elastic scaling and multi-zone deployment. It also offers out-of-the-box logging, monitoring, and load balancing capabilities. This lets you upgrade your Dify application to a production-grade system without any modifications.
Benefits
|
Local Dify deployment |
Dify Cloud |
ACK Dify deployment |
|
|
Flexible scaling |
|
|
|
|
Suitable for custom development |
|
|
|
|
Suitable for production environments |
|
|
|
|
One-stop monitoring and O&M |
|
|
|
Workflow
-
Deploy Dify
Use ACK to quickly deploy a private, high-availability version of Dify (version 1.11.4) for production.
-
Build an AI application with Dify
Experience the powerful features of Dify by building an AI assistant for customer service.
Use your Alibaba Cloud account for the following operations to ensure that you have full permissions for the related products.
Architecture
After you deploy with the default settings, the Dify runtime environment on Alibaba Cloud is configured as shown in the following figure. You can modify the configuration based on your resources, but the final setup should be similar to the one shown.
The architecture includes the following infrastructure and cloud services:
-
One Virtual Private Cloud (VPC): A private network built on the cloud for resources such as Elastic Compute Service (ECS) instances and ACK clusters.
-
Two vSwitches: Connect resources, such as ECS instances and ACK clusters, to the same network. This enables communication between them and provides basic network segmentation and isolation.
-
One security group: Restricts inbound and outbound network traffic for ECS instances within the VPC.
-
One Server Load Balancer (SLB) instance: Provides load balancing for Dify. It distributes traffic to different backend servers to increase the service throughput of the application.
-
One Tair (Redis OSS-compatible) instance: Provides a cache service for Dify.
-
One Tablestore instance (multi-zone disaster recovery): Provides a vector search service for Dify and supports 2 or 3 zones by default.
-
One ApsaraDB RDS for PostgreSQL instance: Provides a relational database service for Dify.
-
One Apsara File Storage NAS (NAS) file system: Stores data for Dify's internal applications.
-
Container Service for Kubernetes (ACK): Used to deploy the Dify platform and related applications.
Deploy Dify
45
Quickly deploy a high-availability version of Dify to a production environment.
Deploy Dify
1. Create a VPC and vSwitches
2. Create a security group
3. Create a Tair (Redis OSS-compatible) instance
4. Create a Tablestore instance
5. Create an ApsaraDB RDS for PostgreSQL instance
6. Create an ACK managed cluster
7. Deploy Dify
8. Initialize Dify
Create a Dify application
Next, you can use an E-commerce assistant as an example to create the following two types of advanced applications on Dify:
Build an AI assistant for e-commerce customer service: Focuses on handling common user inquiries and uses an AI model to provide intelligent responses, helping users quickly obtain information and resolve simple issues.
Build an AI assistant for e-commerce customer service with retrieval-augmented generation (RAG): By integrating an internal corporate knowledge base, this assistant aims to improve the accuracy and contextual relevance of its answers, providing users with more reliable solutions.
Clean up resources
5
If you do not need to create Dify applications later, clean up the resources to avoid unnecessary fees.
Before you start cleaning up, carefully check all the created resources to ensure that you do not accidentally delete resources from your production environment.
Delete the NAS file system.
NoteWhen you install the ack-dify application in ACK using Helm, a NAS file system is automatically created. You must delete this resource to avoid incurring fees.
Log on to the ACK console. On the Clusters page, find the target ACK cluster instance and click Cluster Name to go to the Cluster Information page.
In the navigation pane on the left, choose . Find the CNFS whose storage type is nas and copy the name from the Storage Name column.
Log on to the NAS console. In the navigation pane on the left, click . In the list, find the target file system based on the Storage Name from the previous step. Then, in the Actions column, choose
> Delete. In the panel that appears, perform the operations in the following order.Delete all mount targets: In the Mount Target list, click Delete in the Actions column for each row and follow the on-screen instructions to complete the deletion.
Disable and empty the recycle bin: In the Recycle Bin section, click Disable and Empty on the right and follow the on-screen instructions.
Delete the file system: Click Delete in the lower-right corner of the panel and follow the on-screen instructions to complete the deletion.
Release the ACK cluster:
Log on to the ACK console. On the Clusters page, find the ACK cluster that you want to release and choose in the Actions column.
Choose More > Delete in the Actions column to release the cluster. By default, the ALB instance (cluster Ingress) is not deleted. You must select it from the menu that appears.
The ECS instance is automatically released along with the ACK cluster. You can log on to the ECS console to check whether the ECS instance is released on the Instances page. If it is not released, choose
> Release in the Actions column to release it.
Release the ALB instance:
Log on to the ALB console. On the Instances page, find the instance that you want to release and choose
> Release in the Actions column. Releases the Tair (Redis OSS-compatible) instance:
Log on to the Tair (Redis OSS-compatible) console. On the Instances page, find the instance that you want to release and choose
> Release in the Actions column. -
Release the Tablestore instance:
For more information, see Release a CU mode instance.
Release the ApsaraDB RDS for PostgreSQL instance:
Log on to the ApsaraDB RDS console. In the left-side navigation pane, click Instances. On the Instances page, find the instance that you want to release and choose More > Release Instance in the Actions column.
Delete the security group:
Log on to the ECS console. On the Security Groups page, find the security group that you want to delete and click Delete in the Operation column.
Delete the vSwitch:
Log on to the VPC console. On the vSwitch page, find the vSwitch that you want to delete and click Delete in the Actions column.
Delete the VPC:
Log on to the VPC console. On the VPC page, find the VPC that you want to delete and click Delete in the Actions column.
One-click deployment
20
https://www.aliyun.com/solution/tech-solution/rapidly-deploy-dify-to-accelerate-ai-application-development
Overview
Dify lets you quickly build AI applications without coding. However, a local Dify deployment is limited by fixed hardware specifications and lacks business elasticity. Dify Cloud does not support custom development and lacks operations and maintenance (O&M) capabilities. Alibaba Cloud Container Service for Kubernetes (ACK) provides high-performance elastic computing resources. It supports rapid elastic scaling and multi-zone deployment. It also offers out-of-the-box logging, monitoring, and load balancing capabilities. This lets you upgrade your Dify application to a production-grade system without any modifications.
Benefits
|
Local Dify deployment |
Dify Cloud |
ACK Dify deployment |
|
|
Flexible scaling |
|
|
|
|
Suitable for custom development |
|
|
|
|
Suitable for production environments |
|
|
|
|
One-stop monitoring and O&M |
|
|
|
Workflow
-
Deploy Dify
Use ACK to quickly deploy a private, high-availability version of Dify (version 1.11.4) for production.
-
Build an AI application with Dify
Experience the powerful features of Dify by building an AI assistant for customer service.
Use your Alibaba Cloud account for the following operations to ensure that you have full permissions for the related products.
Architecture
The following figure shows the default Dify running environment on Alibaba Cloud after deployment. You can customize the configuration based on your resources, but the final setup should resemble the architecture shown in the figure.
The architecture includes the following infrastructure and cloud services:
-
One VPC: A private network built on the cloud for ECS instances and ACK clusters.
-
Two vSwitches: Connect resources, such as ECS instances and ACK clusters, to the same network. This enables communication between them and provides basic network segmentation and isolation.
-
One security group: Restricts inbound and outbound network traffic for ECS instances within the VPC.
-
One SLB instance: Provides load balancing for Dify. It distributes traffic to different backend servers to increase the service throughput of the application.
-
One Tair (Redis OSS-compatible) instance: Provides a cache service for Dify.
-
One Tablestore instance (multi-zone disaster recovery): Provides a vector search service for Dify and supports 2 or 3 zones by default.
-
One ApsaraDB RDS for PostgreSQL instance: Provides a relational database service for Dify.
-
Object Storage Service (OSS): Stores data for Dify's internal applications.
-
ACK: Used to deploy the Dify platform and related applications.
Deploy Dify
30
Use one-click deployment to deploy a high-availability version of Dify to a production environment.
Deploy Dify
Create a Dify application
Next, you can use an E-commerce assistant as an example to create the following two types of advanced applications on Dify:
Build an AI assistant for e-commerce customer service: Focuses on handling common user inquiries and uses an AI model to provide intelligent responses, helping users quickly obtain information and resolve simple issues.
Build an AI assistant for e-commerce customer service with retrieval-augmented generation (RAG): By integrating an internal corporate knowledge base, this assistant aims to improve the accuracy and contextual relevance of its answers, providing users with more reliable solutions.
Clean up resources
5
If you do not need to create Dify applications later, clean up the resources to avoid unnecessary fees.
Before you start cleaning up, carefully check all the created resources to ensure that you do not accidentally delete resources from your production environment.
-
Release the Tablestore instance:
For more information, see Release a CU mode instance.
-
Release all new Dify-related cloud resources that were created during this Compute Nest deployment:
Log on to the Compute Nest console. In the navigation pane on the left, select Service Instances. Find the target instance, click Delete in the Actions column, and follow the on-screen instructions to release the instance.










