LinkAce
LinkAce copied to clipboard
Missing write permissions for SQLite database
While setting up LinkAce I wanted to try SQLite, so I could skip the big db-server. When everything was running I got an error stating that the database is read only. After some searching I found this post which states:
The problem, as it turns out, is that the PDO SQLite driver requires that if you are going to do a write operation (INSERT,UPDATE,DELETE,DROP, etc), then the folder the database resides in must have write permissions, as well as the actual database file. I found this information in a comment at the very bottom of the PDO SQLite driver manual page.
Since the server (I'm using the simple version right now) is run with the uid/gid 82 and the whole filesytem structure is owned by root:root this only works, when you mount a directory with write access for 82 (or write access for others) and the database.sqlite inside with write access as well instead of just the database.sqlite.
So you would either need to fix the folder permissions in the docker image (or at least the database folder) or change the documentation. Something along those lines should work:
mkdir db
touch db/database.sqlite
chown 82:82 -R db
and then the docker mount would be:
volumes:
- ./db:/app/database/db
and in the .env
file it should state DB_DATABASE=/app/database/db/database.sqlite
.
I wrote this from the top of my head and didn't test it again! So please verify it again :)
Should also be the solution to #327
I am also facing this problem.
Did my workaround work for you?
I will attempt your steps and post update here. @TheFrazer
@TheFrazer Your suggestion seems to be working. Thanks again.
@TheFrazer With your instructions I have successfully deployed LinkAce with SQLite. Please check this.
https://github.com/cinetube/linkace-docker-sqlite
Please suggest any changes.
That's how my SQLite Setup looks like as well 👍
I tried to run this : sh -c "chown 82:82 -R /app/database/"
inside the container and then LinkAce works, but this has to be done manual after rebuild.
When i add : command: /bin/sh -c "chown 82:82 -R /app/database/"
to my docker-compose.yml the container won't start (No log line matching the '' filter) i have no idea why!?
Perhaps RUN chown 82:82 -R /app/database/
should go into Dockerfile?
When you add the command:
to the docker-compose.yml
you overwrite the default command (reference). So that won't work.
Have you tried to change the ownership on the host system. So not inside the container?
But I have to agree with you that the permissions should ideally be checked and corrected in the Dockerfile
.
@TheFrazer Only chown 82:82 on the local file system is not enough, the root database where database.sqlite sits also needed www-data as user:group before I can write to the database?
@Kovah
Perhaps RUN chown 82:82 -R /app/database/
should go in at line 88 in
../dockerfiles/release-multiplatform-simple.Dockerfile ?