justxuewei / cloudreve-docker

Source code of Docker image for Cloudreve V3
https://hub.docker.com/r/xavierniu/cloudreve
MIT License
220 stars 52 forks source link

[upgrade issue] from old version, entrypoint.sh mistakenly initialized database #49

Closed kmahyyg closed 3 years ago

kmahyyg commented 3 years ago

I've correctly mounted my config file to /cloudreve/conf.ini and also use docker-compose to start my whole application cluster.

However, after upgrade from an old version which I can't remember detailed version number, the whole container cannot start.

After analysis, the entrypoint.sh seems is not correctly interpreted by /bin/bash -> /bin/sh inside alpine-based. Even the CLOUDREVE_DEFAULT_CONF exists, it still tries to move and create config file by using echo command in the sh file.

My configuration file personally configured to use MySQL as backend. So this operation will cause fatal panic to the program.

Solution: completely rewrite the entrypoint command in your docker-compose file by using:

entrypoint: ["cloudreve", "-c", "/cloudreve/conf.ini"]

You should not do those dirty works for the user. Just write a manual, let them read and fly.

justxuewei commented 3 years ago

Sorry for the inconvenience. The works are aimed to help users, who use SQLite as database, bump version seamlessly. However, I did not take care of all cases. The solution you mentioned looks good for me, I will update the image ASAP.

justxuewei commented 3 years ago

UPDATE: I've pushed the code in develop branch, you could pull the latest image with unstable tag once the CI is finished. Please note that the image is not tested yet, and the changes including code and docs will be available on the next release.

kmahyyg commented 3 years ago

The implementation in commit 1a18668 seems just solved this problem (but only for this specific situation). You should modify the README file and tell use to mount ini to correct path and make sure you've told them how to initialize and configure the application (also the SQLite database, if in use) correctly.

justxuewei commented 3 years ago

Of course, this issue will not be closed until all stuff are ready.

justxuewei commented 3 years ago

The README is updated, and the image is tested as well. Please let me know if the bug has been fixed in the latest image. (Please wait for https://github.com/xavier-niu/cloudreve-docker/actions/runs/1153841665 to finish)