diff --git a/.env.example b/.env.example index ae55dc5..76959b8 100644 --- a/.env.example +++ b/.env.example @@ -24,4 +24,4 @@ PGDATA="/var/lib/postgresql/data" OPDATA="/var/openproject/assets" COLLABORATIVE_SERVER_URL=ws://localhost:8080/hocuspocus COLLABORATIVE_SERVER_SECRET=secret12345 -POSTGRES_VERSION=17 # Note for existing setups: make sure this is the same version you are using right now, or upgrade your database +POSTGRES_VERSION=18 # Existing installations must follow the PostgreSQL 18 migration guide before upgrading diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4eb8f62 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release notes + +## PostgreSQL 18 + +New databases use `pgvector/pgvector:pg18-bookworm` and enable vector. The container storage mount changes to `/var/lib/postgresql`; the host-side `PGDATA` setting keeps its meaning. + +Existing databases require an explicit upgrade. To stay on PostgreSQL 17, use the [image and mount override](README.md#postgresql-18-upgrade). Setting `POSTGRES_VERSION=17` alone is insufficient. + +Follow the [migration guide](https://www.openproject.org/docs/installation-and-operations/misc/migration-to-postgresql18/) before upgrading. diff --git a/README.md b/README.md index f5a5354..273a52d 100644 --- a/README.md +++ b/README.md @@ -235,3 +235,23 @@ worker: dns: - "Your DNS IP" # OR add a public DNS resolver like 8.8.8.8 ``` + +## PostgreSQL 18 upgrade + +The database now defaults to `pgvector/pgvector:pg18-bookworm`. Fresh databases enable `vector` automatically. Existing databases require an explicit major-version upgrade; changing the image tag does not upgrade their data. + +Follow the [PostgreSQL 18 migration guide](https://www.openproject.org/docs/installation-and-operations/misc/migration-to-postgresql18/) before updating. + +The host-side `PGDATA` setting still selects the persistent volume or directory. The container mount is now `/var/lib/postgresql`, with the cluster stored in `18/docker` below it. + +To retain an existing PostgreSQL 17 database, set `POSTGRES_VERSION=17` and add this `docker-compose.override.yml` (Compose 2.24.4 or newer): + +```yaml +services: + db: + image: postgres:17 + volumes: !override + - "${PGDATA:-pgdata}:/var/lib/postgresql/data" +``` + +This retains the previous image and storage layout. The version variable alone does not restore the old layout. See the migration guide for adding pgvector to an existing database. diff --git a/docker-compose.yml b/docker-compose.yml index 5433221..129f630 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,17 +33,12 @@ x-op-app: &app services: db: - # The default here should really be 17 but is still 13 as to not break existing setups. - # New installations using the provided .env.example will use 17 to begin with. - # The default here will change to 17 as well with the next major update (18). - # - # Refer to the docs on how to upgrade to postgres 17 before then: - # https://www.openproject.org/docs/installation-and-operations/misc/migration-to-postgresql17/ - image: postgres:${POSTGRES_VERSION:-13} + image: pgvector/pgvector:pg${POSTGRES_VERSION:-18}-bookworm <<: *restart_policy stop_grace_period: "3s" volumes: - - "${PGDATA:-pgdata}:/var/lib/postgresql/data" + - "${PGDATA:-pgdata}:/var/lib/postgresql" + - "./postgres/init-vector.sql:/docker-entrypoint-initdb.d/vector.sql:ro" environment: POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-p4ssw0rd} POSTGRES_DB: openproject diff --git a/postgres/init-vector.sql b/postgres/init-vector.sql new file mode 100644 index 0000000..c4b40d7 --- /dev/null +++ b/postgres/init-vector.sql @@ -0,0 +1,28 @@ +---- copyright +-- OpenProject is an open source project management software. +-- Copyright (C) the OpenProject GmbH +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License version 3. +-- +-- OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +-- Copyright (C) 2006-2013 Jean-Philippe Lang +-- Copyright (C) 2010-2013 the ChiliProject Team +-- +-- This program is free software; you can redistribute it and/or +-- modify it under the terms of the GNU General Public License +-- as published by the Free Software Foundation; either version 2 +-- of the License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- See COPYRIGHT and LICENSE files for more details. +--++ + +CREATE EXTENSION IF NOT EXISTS vector;