Hey @mcc37,
I am really sorry for you. There is no chance that you get your data back.
The configuration of the postgres DB is not correct to store data persistently.
Every data in docker containers is lost after restarting them. That is a core concept of docker. That’s why it is crucial to store all important data in docker volumes. This is missing in your compose file for the postgres service.
volumes:
# In this example, we share the folder `db-data` in our root repository, with the default PostgreSQL data path
# It means that every time the repository is modifying the data inside
# of `/var/lib/postgresql/data/`, automatically the change will appear in `db-data`
# You don't need to create the `db-data` folder. Docker Compose will do it for you
- ./db-data/:/var/lib/postgresql/data/
This is from the official postgres documentation. And it is missing in your config.
It is always good to create a full backup before updating any system. You’ll find backup workflow in the template section of n8n.
I know this, but this configuration (docker-compose.yml) was the one recommended 2 years ago by N8N, and I have been upgrading quite a lot of time with no issue at all, including postgresql container image upgrade and migrating to 1.x version of N8N.
So it means something has changed at a moment on N8N side ?
Also, I do have backup of PostreSQL backup, is there an easy way to extract workflow and credentials ? I don’t matter about past execution.
I am not aware of any changes our side but if your database container updated at the same time it will remove your data. From what I can see our examples include the binary data option for the database although we also still use Postgres 11 in most of out examples.
Do you have a link to the guide you followed so I can make sure it is updated? As for your workflows if you have a backup of the databse you could try restoring that and you should be good to go.
I suspect someone changed the postgres version in your docker compose file, I have done some digging and we have used version 11 since 2019 and the volume was only added in 2022 which should have been there from the start.
If your postgres version changed that would have resulted in the data being lost when the new version of postgres was downloaded, Sadly this wouldn’t have been a change that we made but I would recommend taking some time now to configure your postgres database to use a volume to store the data so this doesn’t happen again in the future.
I did not change the version in my docker file, so pretty strange. But I think the issue is about this original file from 2019, I did start using the solution in 2021, so it matches.
It could be with that file but I would suggest double checking your server as looking at the history of that file we have not used version 14 for Postgres so that change could have been something you initially did or someone else has done it.
Not that it matters though it looks like Postgres was not correctly configured from the start and we have now fixed that in our examples which will prevent it from happening in the future, As long as your backup is good a restore should get you back up and running.
Another question @Jon, with the new docker file in queue mode, I can not connect anymore via the network to the PostgreSQL server, is there any reason ? I would like to backup the new one too