Closed trailfog closed 6 months ago
sed: cannot rename /conf/sedzNSKsq: Device or resource busy
SQLSTATE[HY000] [1044] Access denied for user 'lychee'@'%' to database '/va
r/www/html/Lychee/database/database.sqlite'
It looks like there may be an issue with your /conf
volume, though it does seem able to access it once it's running to get the settings for diagnostics.
I have set up a minimal working example of the issue here: trailfog/lychee-migration-issue
I can reproduce the issue~ish with your MWE but ... I noticed that when I do the way I update myself :
docker compose down
# edit to change tag.
docker compose pull
docker compose up -d
It works totally fine on my prod and with your MWE it brings me back to re-install step (I guess there are no SQL persistence in your docker compose).
It works totally fine on my prod and with your MWE it brings me back to re-install step (I guess there are no SQL persistence in your docker compose).
You are correct, that my minimal setup does not use persistence, as I was not tearing down the entire setup. I have updated my example repo with a volume to make the DB persistent.
Running your exact commands unfortunately still gives me the same upgrade error.
It looks like there may be an issue with your
/conf
volume, though it does seem able to access it once it's running to get the settings for diagnostics.
@d7415 I disabled write access to the conf file during the upgrade to v5, basically to eliminate the lychee setup from messing with my config.
I should have posted the diagnostics from the MWE and not those from my actual server to avoid some confusion.
Found it. That is because the cli does not have the environment variables to run the migration. if you add DB_HOST etc (as below) it will work.
lychee:
image: lycheeorg/lychee:v5.1.0
container_name: lychee
ports:
- 8080:80
networks:
- backend
volumes:
- ./lychee/.env:/conf/.env
environment:
- PUID=1000
- PGID=100
- STARTUP_DELAY=5
- DB_CONNECTION=mysql
- DB_HOST=mariadb
- DB_PORT=3306
- DB_DATABASE=lychee
- DB_USERNAME=lychee
- DB_PASSWORD=supersecret
I can confirm that this fixed it on my side as well.
In fact, only the DB_CONNECTION=mysql
env variable needed to be set.
Thanks for your help @ildyria
Maybe as a suggestion, the README of the lychee-Docker repo should probably include a note that the DB_CONNECTION
env variable must be set, regardless if it has been set in the config file.
Currently, it only states, that lychee may be configured from an env file or the env variables.
Thanks for your help @ildyria
My pleasure. :)
Maybe as a suggestion, the README of the lychee-Docker repo should probably include a note that the
DB_CONNECTION
env variable must be set, regardless if it has been set in the config file. Currently, it only states, that lychee may be configured from an env file or the env variables.
Feel free to open a pull request too :)
Found it. That is because the cli does not have the environment variables to run the migration.
Shouldn't it be getting that from .env
? Otherwise how does it work for non-Docker installations?
It seems to me, that this line is the culprit of (my) problems.
If the $DB_CONNECTION
variable is either sqlite
or not set/zero length, it will choose sqlite, irrelevant of what has been configured in the env file.
Probably it is better to fix that line than to update the readme with a workaround.
If the
$DB_CONNECTION
variable is eithersqlite
or not set/zero length, it will choose sqlite, irrelevant of what has been configured in the env file.
That's somewhat required to handle the default case, but yes, it does set DB_DATABASE
. From testing (ages ago) this was fine for the installer, but it's possible Laravel will choose that value over what's in .env
. Which isn't especially helpful in this case.
Detailed description of the problem
When using the docker image and mariadb as a database, and upgrading to the version
5.0.3
, the migration fails with the errorBranch is not master
. I was upgrading from version5.0.2
. Downgrading to the old version works and the lychee page displays correctly.Looking at the attached logs, it seems like lychee is trying to access a sqlite DB to perform the migration, even if it was configured to access a mysql/mariadb database.
Steps to reproduce the issue
I am using the docker image of lychee. I have set up a minimal working example of the issue here: https://github.com/trailfog/lychee-migration-issue
docker compose up -d
lychee
tolycheeorg/lychee:v5.0.3
docker compose up -d
Branch is not master
If a new instance of lychee is set up using version
5.0.3
, the migration issue does not show up.Output of the diagnostics
Browser and system
Workaround
Downgrading to version
v5.0.2
worked just fine, full site functionality restored.