matze / wastebin

wastebin is a pastebin
MIT License
250 stars 25 forks source link

[HELP] need help making the database writeable by user 10001 #56

Closed back-lacking closed 3 weeks ago

back-lacking commented 3 weeks ago

So im trying to get wastebin running using docker compose. the main part im having trouble with is trying to make the data base writable. i tried running these commands to make the data base file writable, but all have failed

chmod 755 data/
sudo chown 10001 ./data/
sudo chmod 644 ./data/

trying to run docker compose up -d to get it up, but it wouldnt start and the logs would report that the database was read only. can I know the proper command in order to get this up and running?

matze commented 3 weeks ago

I personally don't use docker compose but could it be that 10001 is not the correct user?

back-lacking commented 3 weeks ago

I personally don't use docker compose but could it be that 10001 is not the correct user?

im not sure, i was just following the default docker compose you gave. and there was a note saying "make sure ./data is writable by user 10001."

back-lacking commented 3 weeks ago

i tried just looking up how to make a folder writable by a certain user, and the sudo chown command was what i did

matze commented 3 weeks ago

I did not write those instructions but perhaps @NiFNi can help out :-)

NiFNi commented 3 weeks ago

The UID in the Dockerfile is 10001 as you can see here: https://github.com/matze/wastebin/blob/f13fcd077b15c974c1e145cfb19534fa8be85964/Dockerfile#L10 Permissions like this work for me: image

In case the database file is already created make sure it is also owned by 10001. Best is to just run these commands to get the default permissions:

chmod 755 data
chmod 644 data/state.db
chown -R 10001:10001 data

One hint: keep in mind that a user needs executable permissions of a folder to view the content of the folder in UNIX systems. So the user 10001 has to have the read+executable permission of the data folder and the read+write permissions of the state.db file which will be achieved by the commands above.

back-lacking commented 3 weeks ago

Running those commands fixed the issue