localstorage plugin, permission issue
-
I am setting up a new app in python using the localstorage plugin. I can access the /app/data folder, but it has these permissions:
drwxr-xr-x 2 root root 4096 Apr 30 05:37 /app/dataI believe, this explains why I am having a permission issue when my app tries to write into it? I could probably ssh into the server and change it there, but do I have to or can I set up my app in a certain way to get it right from the beginning, for example, when I re-install the app?
The CloudronManifest references the addon:
"addons": { "localstorage": {}, -
@ekevu123 said in localstorage plugin, permission issue:
I believe, this explains why I am having a permission issue when my app tries to write into it?
Since you are running a custom python application, how do you start the python application inside the app?
If there is a permission issue, I assume the user who starts the python process is notroot, thus the permission issue.If you could share your custom applications code, that be very useful.
But, if the app is already running on a Cloudron server, use the Web Terminal andps uaxand check what user is running the python process. -
Yes, that could be it.
ps uax USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND cloudron 1 0.3 0.5 778012 176572 pts/0 Ssl+ 11:33 0:08 /usr/bin/python3.12 /usr/local/bin/uvicorn main:app --host 0.0.0.0 --port 4000 --limit-co cloudron 26 0.3 0.0 5044 3968 pts/1 Ss 12:17 0:00 /bin/bash cloudron 38 0.0 0.0 7480 3072 pts/1 R+ 12:17 0:00 ps uaxThe startup script runs exec uvicorn main:app with arguments.
The Dockerfile defines
USER cloudronwhich was a guess after different options didn't work before.
How is it supposed to look? I am assuming my app shouldn't run in root, so how do I align these?
-
You could simply add a chown in your Dockerfile:
RUN chown -R cloudron:cloudron /app/data/This way
/app/data/is owned by user and groupcloudronand should have RWX access. -
So the
chownin the docker image will not help here, since/app/datais mounted as a read+write volume and will thus not be part of the image itself. Hence things done in theDockerfilewill not affect the permissions of files in/app/dataTo change permissions or ownership, the
chownhas to be done in the app startup script. Usuallystart.sh. -
Ah yes, I mix that up again and again

-
J joseph marked this topic as a question on
-
J joseph has marked this topic as solved on