dify icon indicating copy to clipboard operation
dify copied to clipboard

when upgrading from a lower version to a higher version, all existing account data, AI assistant app data, and custom tool data were lost.

Open mfjiang opened this issue 10 months ago • 19 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Upgrading from Dify 0.15.1 to 0.15.3 was performed strictly in accordance with the official guidelines.

Executing docker compose down followed by docker compose up -d successfully launched the new version. Upon accessing Dify, I was prompted to create a new account, and after logging in, all existing data was lost.

✔️ Expected Behavior

I understand that the issue stems from the version upgrade causing the PostgreSQL database to be reinitialized. However, I hope to modify this upgrade logic to ensure that user data is preserved.

❌ Actual Behavior

No response

mfjiang avatar Feb 17 '25 01:02 mfjiang

It is easy. Please copy all the volumes in the docker folder in the original version of dify to the corresponding volume folder of the upgraded version, and then run docker-compose up -d. Please use git checkout tags/v0.15.3 to switch to the corresponding one to prevent errors. such as: cp -r docker/old_folder_volume docker/new_folder_volume then: docker-compose up -d

SusuDOS avatar Feb 17 '25 11:02 SusuDOS

Image

ImageIt worked for me.

SusuDOS avatar Feb 17 '25 11:02 SusuDOS

I also encountered the same problem. Before and after the upgrade, the path was volumes/db/data/pgdata?

SpecterHi avatar Feb 17 '25 13:02 SpecterHi

It is easy. Please copy all the volumes in the docker folder in the original version of dify to the corresponding volume folder of the upgraded version, and then run docker-compose up -d. Please use git checkout tags/v0.15.3 to switch to the corresponding one to prevent errors. such as: then:cp -r docker/old_folder_volume docker/new_folder_volume docker-compose up -d

thank you, if the upgrade process can auto keep user's data will be better.

mfjiang avatar Feb 17 '25 14:02 mfjiang

it must be a build in feature.

mfjiang avatar Feb 17 '25 14:02 mfjiang

解决了么?我更新后数据也没了 咋搞的啊?

jiake55 avatar Feb 17 '25 15:02 jiake55

解决了么?我更新后数据也没了 咋搞的啊?

Image

ImageIt worked for me.

Error response from daemon: error while creating mount source path '/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/46e58b4b6f6fbe071072f72717bd56c8a6296268846bc44be85613700456f155': mkdir /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/46e58b4b6f6fbe071072f72717bd56c8a6296268846bc44be85613700456f155: file exists

mfjiang avatar Feb 18 '25 00:02 mfjiang

According to your operation instructions, I replaced the old and new data directories, but after restarting the dify service, it still requires re-creating the manager account, and all user data has not been restored.

It is easy. Please copy all the volumes in the docker folder in the original version of dify to the corresponding volume folder of the upgraded version, and then run docker-compose up -d. Please use git checkout tags/v0.15.3 to switch to the corresponding one to prevent errors. such as: cp -r docker/old_folder_volume docker/new_folder_volume then: docker-compose up -d

mfjiang avatar Feb 18 '25 00:02 mfjiang

No problem, it works normally. https://www.youtube.com/watch?v=gwma_wbK41U

SusuDOS avatar Feb 18 '25 08:02 SusuDOS

I'll reiterate that generally, you need to do that.

git checkout tags/0.15.3

# use your older docker volume folder
cp -r docker/old_folder_volume docker/new_folder_volume

docker-compose up -d

SusuDOS avatar Feb 18 '25 08:02 SusuDOS

According to your operation instructions, I replaced the old and new data directories, but after restarting the dify service, it still requires re-creating the manager account, and all user data has not been restored.

It is easy. Please copy all the volumes in the docker folder in the original version of dify to the corresponding volume folder of the upgraded version, and then run docker-compose up -d. Please use git checkout tags/v0.15.3 to switch to the corresponding one to prevent errors. such as: cp -r docker/old_folder_volume docker/new_folder_volume then: docker-compose up -d

Please see my latest reply.

SusuDOS avatar Feb 18 '25 08:02 SusuDOS

解决了么?我更新后数据也没了 咋搞的啊?

Please see my latest reply.

SusuDOS avatar Feb 18 '25 08:02 SusuDOS

I still can't get it

The thing is, the project was running normally in /root/dify/docker. The data then appears to be in /root/dify/docker/volumes/db/data. What should I do now?

I'm running in /root/dify/docker

git checkout main
git pull origin main

no problem

But run what you said git checkout tags/0.15.3 or git checkout tags/v0.15.3

Will report an error error: pathspec 'tags/0.15.3' did not match any file(s) known to git

and, in my case, the so-called old_folder_volume and new_folder_volume

What exactly is it?

Thanks

SpecterHi avatar Feb 18 '25 10:02 SpecterHi

I still can't get it

The thing is, the project was running normally in /root/dify/docker. The data then appears to be in /root/dify/docker/volumes/db/data. What should I do now?

I'm running in /root/dify/docker

git checkout main
git pull origin main

no problem

But run what you said git checkout tags/0.15.3 or git checkout tags/v0.15.3

Will report an error error: pathspec 'tags/0.15.3' did not match any file(s) known to git

and, in my case, the so-called old_folder_volume and new_folder_volume

What exactly is it?

Thanks

Because there may be issues with the code in the latest library, which has not been fixed, all you need to do is download the code and switch to v0.15.3, then mount your previous dify version of the data. If you modify the port, please pay attention to matching. The complete process is as follows:

# To obtain the code, you need to ensure that there is no dify in the path. If it exists, git will fail
git clone https://github.com/langgenius/dify.git && cd dify

# switch v0.15.3
git checkout tags/0.15.3

# you can del then config file,of course,it is same as older version,your can jump it
rm -rf docker/volumes

# copy older dify data,such as your whole path is:/usr/local/etc/dify;newer folder is:/usr/local/etc/difyUpgrade/dify
cp -r /usr/local/etc/dify/docker/volumes /usr/local/etc/difyUpgrade/dify/docker/volumes

# then restart you docker service
docker-compose  down && docker-compose  up -d

SusuDOS avatar Feb 18 '25 12:02 SusuDOS

I followed all your steps, but still get the /install page... I used the old volumes folder, even used a early backup, They are all the same.

SpecterHi avatar Feb 18 '25 13:02 SpecterHi

I followed all your steps, but still get the /install page... I used the old volumes folder, even used a early backup, They are all the same.

oh oh ~

mfjiang avatar Feb 18 '25 14:02 mfjiang

I followed all your steps, but still get the /install page... I used the old volumes folder, even used a early backup, They are all the same.

it's ok,please wait for a while...

SusuDOS avatar Feb 19 '25 00:02 SusuDOS

I followed all your steps, but still get the /install page... I used the old volumes folder, even used a early backup, They are all the same.我按照你的所有步骤操作,但仍然看到 /install 页面... 我使用了旧的 volumes 文件夹,甚至使用了早期的备份,它们都是一样的。

it's ok,please wait for a while...没关系,请稍等一会儿...

What exactly do you mean?

Will it return to normal after a while? Will the data come back on its own? But no matter how long I waited, I was still asked to create a new administrator account. I also looked into the container and found that the database volume was indeed mounted, but the corresponding tables, such as users or workflows, were also empty.

Or is it finally confirmed that this problem does exist, please wait for a solution?

In fact, if I just follow what you said, many variables such as database connection information will be missing, so I actually used the original .env. Is this the wrong thing to do?

SpecterHi avatar Feb 24 '25 02:02 SpecterHi

Same issue, Tried everything, followed the official instructions to back up, but still couldn't restore the previous data.

I followed all your steps, but still get the /install page... I used the old volumes folder, even used a early backup, They are all the same.我按照你的所有步骤操作,但仍然看到 /install 页面... 我使用了旧的 volumes 文件夹,甚至使用了早期的备份,它们都是一样的。

it's ok,please wait for a while...没关系,请稍等一会儿...没关系,请稍等一会儿...

What exactly do you mean?你到底是什么意思?

Will it return to normal after a while? Will the data come back on its own? But no matter how long I waited, I was still asked to create a new administrator account. I also looked into the container and found that the database volume was indeed mounted, but the corresponding tables, such as users or workflows, were also empty.过一段时间会恢复正常吗?数据会自己回来吗?但无论我等了多久,仍然被要求创建一个新的管理员账户。我还查看了容器,发现数据库卷确实挂载了,但相应的表,比如 users 或 workflows,也是空的。

Or is it finally confirmed that this problem does exist, please wait for a solution?或者最终确认这个问题确实存在,请等待解决方案?

In fact, if I just follow what you said, many variables such as database connection information will be missing, so I actually used the original .env. Is this the wrong thing to do?事实上,如果我完全按照您说的做,很多变量比如数据库连接信息将会缺失,所以我实际上使用了原来的.env。这样做是错误的吗?

twoheartliu avatar Mar 19 '25 08:03 twoheartliu