pkp / docker-ojs

Open Journal Systems (OJS) is a journal management and publishing system.
GNU General Public License v3.0
60 stars 45 forks source link

Error: The directory specified for uploaded files does not exist or is not writable. #343

Open mehran-tarif opened 9 months ago

mehran-tarif commented 9 months ago

I am encountering an issue while trying to install OJS (Open Journal Systems) using Docker. I have followed the installation instructions and made no changes to the .env file (except PROJECT_DOMAIN=localhost). However, I am getting an error message that says, "The directory specified for uploaded files does not exist or is not writable."

I have reviewed the docker-compose.yml file and noticed that there is a volume named volumes/private bind to /var/www/files which exists in volumes by default. Despite this, I am still experiencing this error.

I would appreciate any assistance or guidance on how to resolve this issue and successfully install OJS using Docker. Thank you!

Screenshot 2023-10-14 at 16-48-50 OJS Installation

marcbria commented 8 months ago

Sorry for the delay in my answer. This is a side project and I don't have much time.

Did you manage to make it work?

This usually happens when you don't have the right permissions in the volume folder in host. I recommend check the user and group of your apache in you container (usually is 100) and change the permissions properly.

Normally something like this will work: $ chown 100:100 volumes/private * -R

If this fails, as a temporary solution till you discover how to set the permisions to the apache user, you can try with a "chmod 666 volumes/private" to make the folder pubically accessible.

Cheers, m.

MartinPaulEve commented 5 months ago

Just to say that I had this exact problem and had to exec into the container and set ownership of apache:apache on several dirs that were set only to root:root.

marcbria commented 5 months ago

Thanks for your freeback @MartinPaulEve Just to be sure: With the propper permissions all works fine to you, isn't it?

If yes, I will close it as is not an issue, it's the way docker works and probably highlight the chown 100:101 volumes/private in README.

MartinPaulEve commented 5 months ago

Hmm, I cannot confirm that setting 100:101 on volumes/private fixes this as I haven't looked.

Indeed, my fix was to change permissions inside the container, which seemed to work. If the external host volume prohibited writing, I assume this would not have worked. So I am unsure that the fix is the external change.

marcbria commented 5 months ago

If all works as expected, there is no difference between changing ownership inside the container (with apache:apache) or outside it (with 101:101)... but I usually suggest the second because login inside the container requires more explanations/knowledge.

Do you mind to confirm your private folder is with user 100 and group 101 from outside the container running:

$ ls -n volumes/private

Thanks for your help Martin.

MartinPaulEve commented 5 months ago

` [martin@v2 testJournal] (main)$ ls -n volumes/private Permissions Size User Group Date Modified Name drwxr-xr-x - 100099 100100 23 Feb 17:56 journals drwxr-xr-x - 100099 100100 26 Feb 00:00 scheduledTaskLogs drwxr-xr-x - 100099 100100 23 Feb 17:43 site drwxr-xr-x - 100099 100100 23 Feb 17:58 usageStats

`

marcbria commented 5 months ago

Wired. In my debian is 100:101. :-(

Let's keep it open just in case somebody else can offer us more information... and modify the README to ensure permisions are set even in the TL;DR; verison.