You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/releases/os_upgrading/2.51.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,46 @@ _Note: If you are using a bound volume, the path has changed for Postgres18. It
84
84
> This has been fixed in 2.55.4 by explicitly setting `PGDATA: /var/lib/postgresql/data` in `docker-compose.yml`.
85
85
>
86
86
> If you customise the postgres service in your own `docker-compose.override.yml`, make sure `PGDATA` is set to the path where your volume is mounted.
87
+
>
88
+
> **Important for existing installations**
89
+
>
90
+
> If you previously ran DefectDojo with PostgreSQL 18 using the old default `docker‑compose.yml`, your PostgreSQL data may be stored inside a nested directory such as `/var/lib/postgresql/data/18/docker`
91
+
> In that case, the root of the volume (`/var/lib/postgresql/data`) is non‑empty but is *not* itself a valid Postgres cluster root. After applying the fix that sets `PGDATA: /var/lib/postgresql/data` PostgreSQL may fail to start with an error like `initdb: error: directory "/var/lib/postgresql/data" exists but is not empty` because the existing cluster files still live under the nested versioned path.
92
+
>
93
+
> To fix this problem you can migrate the existing cluster files into the volume root:
94
+
>
95
+
> 1.**Stop the Postgres service**
96
+
> ```sh
97
+
> docker compose stop postgres
98
+
>```
99
+
>
100
+
> 2. **Verify where your cluster currently lives**
101
+
>```sh
102
+
> docker run --rm -it -v <your_volume_name>:/data alpine sh
103
+
> ls -la /data
104
+
>```
105
+
> Look for a directory such as `18/docker` that contains `PG_VERSION`, `base/`, etc.
106
+
>
107
+
> 3. **Move the cluster files into the volume root**
108
+
>```sh
109
+
> docker run --rm \
110
+
> -v <your_volume_name>:/data alpine \
111
+
> sh -c "mv /data/18/docker/* /data/"
112
+
>```
113
+
>
114
+
> 4. **Clean up empty folders (optional)**
115
+
>```sh
116
+
> docker run --rm \
117
+
> -v <your_volume_name>:/data alpine \
118
+
> sh -c "rm -rf /data/18 /data/data"
119
+
>```
120
+
>
121
+
> 5. **Start Postgres again**
122
+
>```sh
123
+
> docker compose up -d postgres
124
+
>```
125
+
>
126
+
> After this, the database should start using `PGDATA: /var/lib/postgresql/data`, and your existing data will be preserved.
0 commit comments