Starting from version 0.21, AFFiNE added support for local vector indexing, so the backend database container was replaced from the official PostgreSQL container to the pgvector container.
This document aims to guide users in upgrading the AFFiNE Self Hosted server previously deployed based on the Self-host AFFiNE guide.
If you deploy using other methods, only part of this article applies. You can refer to the content of this document to make corresponding adjustments to your configuration, or visit our Discord / Telegram community for help.
In this version update, the default database container for the AFFiNE Self Hosted backend has been changed from postgres:16
to pgvector/pgvector:pg16
to support the storage and querying of vector data types.
If you redeploy the server, simply follow the steps in the Self-Hosted deployment documentation.
If you are upgrading from an existing server, you need to follow the steps in this tutorial.
Important Information for Major Version Upgrades
If the current version of PostgreSQL you are using does not match the major version of the target pgvector container (for example, upgrading from 15 to 16 or 17), be sure to perform a manual intervention upgrade.
For replacement within the same major version (e.g., 15 to 15), you can directly replace the container image without additional operations.
How to check the current PostgreSQL major version
Execute the following command to confirm the current version information of the database:
Based on the output information, confirm the major version of the database (15, 16, or 17), and select the corresponding version of the pgvector container.
If you have modified the container name of postgres, please change "postgres" in the command line to the corresponding container name.
This upgrade supports two deployment methods: using the Docker Compose script we provide and self-deployment.
Please choose the appropriate solution based on your actual situation.
Edit the .env
file, add the DB_VERSION
variable, and set its value to the major version number of the PostgreSQL server used by the AFFiNE service, for example:
Be noticed that the major version of replacer pgvector/pgvector:pg{version}
must be the same as old postgres image postgres:{version}
For users deploying their own PostgreSQL instances, please install pgvector
extension to your postgres instance.