DEV Community

RelytONE
RelytONE

Posted on

How to configure Relyt ONE in Dify?

Relyt ONE is a Serverless PostgreSQL database, providing built-in high performance extensions for vectors, full-text search and analytics (pg_duckdb).We believe in technological equality and inclusive support for all developers. All features and services are included in the free plan. We welcome you to give it a thorough try!


Press enter or click to view image in full size

Dify self-hosting
Dify is an open-source platform for developing LLM applications. Its intuitive interface combines agentic AI workflows, RAG pipelines, agent capabilities, model management, observability features, and more — allowing you to quickly move from prototype to production. (Reference)In this guide, we’ll walk you through setting up Dify with Relyt ONE (All In One Serverless PostgreSQL) to build a knowledge base Q&A workflow.​

Quick start
The easiest way to get Dify up and running is through Docker Compose. Before we dive in, make sure you have Docker and Docker Compose installed on your machine.​

Clone Dify
You can visit the GitHub repository (https://github.com/langgenius/dify) to clone it manually, or simply run the following command:


git clone https://github.com/langgenius/dify.git​
Enter fullscreen mode Exit fullscreen mode

Prepare Docker Compose
Head to https://www.docker.com/ to download Docker Desktop. Make sure to select the correct version for your system.Run this command to verify Docker is properly installed:

docker --version​
Enter fullscreen mode Exit fullscreen mode

Get a Relyt ONE Serverless PostgreSQL
Relyt ONE provides free PostgreSQL service. Visit our website (https://data.cloud/relytone) to get started for free.​

Create a Project
Once you’re logged in, create a new project on the Projects page. (Reference)

Press enter or click to view image in full size

​Check Project Connect Info
Once you’re in the project, click the ‘Connect’ button to open the Connect dialog, then switch to the ‘GUI Client Application Tab’ to view your connection details. You’ll see information like host, port, database, and user. (Reference)

Press enter or click to view image in full size


Configure DB connect parameters in Dify
Head to your Dify project’s root directory and find the ‘docker’ folder. Inside, rename ‘.env.example’ to ‘.env’ and open it. Jump to the ‘Vector Database Configuration’ section, then select ‘pgvecto-rs configurations’ to set up your parameters.

VECTOR_STORE=pgvecto-rs
...
# pgvecto-rs configurations, only available when VECTOR_STORE is `pgvecto-rs`
PGVECTO_RS_HOST=[your database host]
PGVECTO_RS_PORT=[your database port]
PGVECTO_RS_USER=[your database role name]
PGVECTO_RS_PASSWORD=[your database password]
PGVECTO_RS_DATABASE=[your database name]

Enter fullscreen mode Exit fullscreen mode

Then you can initialize Dify with docker compose.

docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Now, you can access the Dify dashboard in your browser at http://localhost/install and start the initialization process.​

Become a member
Create Knowledge on Dify
Visit Dify at http://localhost/install, navigate to the Knowledge Tab in the header, and click the ‘Create Knowledge’ button.

Press enter or click to view image in full size

Select your source — for this demo, I’ll upload content from a local Markdown document. Next, configure the chunk settings. Pay special attention to the ‘maximum chunk length’ setting, as different lengths can produce varying results. You’ll want to adjust this based on your specific use case.

Press enter or click to view image in full size

​Verify DB connection
Follow the guided steps to create your knowledge base. Once it’s created, you can verify everything worked by checking your database schema — you should see the knowledge records appear in the table.

Press enter or click to view image in full size

​Create Knowledge Base Workflow
​Create workflow
Head back to Dify’s Studio Tab and click ‘Create App’ to start building your workflow:

Create App
Select ‘Create from Blank’
Choose an App Type
Select ‘Chatflow’ type
Press enter or click to view image in full size

After following the guide to create your workflow, you’ll enter the workflow builder interface. Now, click the add button between the ‘Start’ node and the ‘LLM’ node to add a new ‘Knowledge Retrieval’ node.

Press enter or click to view image in full size

Press enter or click to view image in full size

In the Knowledge Retrieval node’s settings panel, click the ‘Add’ button and select the knowledge base you created earlier.

Press enter or click to view image in full size


LLM Provider API Key Configuration
Next up is the LLM node. First, you need to configure the LLM provider API key. Follow this path:

LLM Node Panel
> Settings
> Model
> Model selection popup menu
> Model Provider Settings
Press enter or click to view image in full size

Press enter or click to view image in full size

Then navigate to the configuration page and set up your API key. You can refer to Dify’s documentation (https://platform.openai.com/api-keys) for detailed instructions.

Press enter or click to view image in full size

​Finish and Run
Once you complete all the setup steps above, you can test your workflow. Congratulations — your knowledge base Q&A system is now ready to go!

Top comments (0)