Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing write permissions for SQLite database #332

Closed
TheFrazer opened this issue Dec 7, 2021 · 10 comments
Closed

Missing write permissions for SQLite database #332

TheFrazer opened this issue Dec 7, 2021 · 10 comments
Labels
Bug Something isn't working
Milestone

Comments

@TheFrazer
Copy link

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

@TheFrazer TheFrazer added the Bug Something isn't working label Dec 7, 2021
@cinetube
Copy link

I am also facing this problem.

@TheFrazer
Copy link
Author

Did my workaround work for you?

@cinetube
Copy link

I will attempt your steps and post update here. @TheFrazer

@cinetube
Copy link

@TheFrazer Your suggestion seems to be working. Thanks again.

@cinetube
Copy link

@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.

@TheFrazer
Copy link
Author

That's how my SQLite Setup looks like as well 👍

@Drallas
Copy link

Drallas commented Jan 9, 2022

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?

@TheFrazer
Copy link
Author

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.

@Drallas
Copy link

Drallas commented Jan 9, 2022

@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 ?

@Kovah
Copy link
Owner

Kovah commented Aug 26, 2024

Should be solved with the release of LinkAce 2.0

@Kovah Kovah closed this as completed Aug 26, 2024
@Kovah Kovah added this to the v2.0.0 milestone Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants