Cant upload data

Using docker Farm OS 3.4.5 as non root user it appears that I can’t upload data (kml, pictures) to FarmOS. I also can’t export/ write out CSV files.

I can add logs and other things to the database but no uploads.

What could be the reason?

1 Like

I think server folder access restriction problem for your web server.

1 Like

@Lars have you followed the instructions for configuring your server to enable file uploads?

I am trying to do this. Is it correct that the settings.php has to be made writable with `chmod a+w sites/default/settings.php and if so how do I change it back to the secure setting?

I assume the folder (create the folder /opt/drupal/web/sites/default/private/) should be outside the docker container to make it permanent but then it needs to be mounted as a volume correct? Sorry this is a new setup using the pretty good manual of FarmOS on Raspberry PI: Farm Management Software Open-Source but this part was not explained.

Just to be sure that my data is stored in a permanent place and I dont loose all the work of data input. I can see that /var/lib/docker/volumes/farmos_db/_data is mounted as a volume but cant find that volume or the docker folder on the normal file system even as root. Is this correct?

1 Like

Yes you’ll need to edit settings.php to add the line described in the installation guide I linked above. Use chmod a-w sites/default/settings.php (minus instead of plus) to remove all write access to it afterwards.

Correct. Best practice is to bind mount /opt/drupal/web/sites. This is also explained in the official installation guide: Installing farmOS | farmOS

I can’t vouch for that guide, but the official installation guide should cover everything you need!

1 Like

Thank you you for getting back to my questions. However for a non programmer this is not so straight forward also because there is different information and missing information that makes it difficult to follow and understand the process.

For example here Installing farmOS | farmOS it sais that there is
An example docker-compose.production.yml configuration file is provided in the farmOS repository’s docker directory, with an accompanying README.md. But looking at it I cant find it. As a result I can’t check the information in that file to understand how it is done.
I have read the install file in the git farmos doc but its not the same thing.
While it is probably very easy for someone with experience to do what you describe under Installing farmOS | farmOS I have looked at it on and off for the last days but cant fully execute it as the folder /opt/drupal/web/sites/default/ is already mounted as a volume and I cant access it. Dont get me wrong farmos is a amazing system but not easy to correctly install for farmers. Especially considering that data needs to be persistent after the next update and the years to come.

Here is a link to the ..production.yml file.

If you are not comfortable around code I would recommend checking out a host that provides and maintains farmOS for you. https://farmier.com/ is one that I am using. I self hosted for a while but in the long run found this host to be easier and cheaper then running, maintaining, and backing up farmOS myself. Just throwing out another option for you.

3 Likes

@Lars Yea hosting farmOS does require some knowledge/experience with web hosting, and if you are using Docker then that’s another layer to understand, especially when it comes to volumes and file permissions.

It sounds like you’re pretty close, though. The key thing to understand about Docker (maybe you already know this) is that the files inside volumes need to be accessible to the www-data user inside the Docker container. This may be different than the user on the host machine (“outside” the container).

Inside the farmOS Docker image, there is a www-data user with a user ID of 33 (although in the farmos/farmos:3.x-dev image the user ID may be different). This means that you need to ensure user 33 has the ability to write to the necessary volume directories.

Mounting a volume doesn’t prevent you from changing permissions on subdirectories (you should be mounting /opt/drupal/web/sites… of which default is a subdirectory). Can you elaborate on what you mean by “I can’t access it”? What specifically are you doing and what output are you seeing (please include exact copy and pastes from your command line if you are running commands).

Hope that helps! I wish we could make this easier, but we’re balancing some of the flexibility that Drupal (the underlying framework that farmOS is built on) provides - which can be installed in many different ways. Ultimately farmOS is just a thin layer on top of Drupal, so all of this is general Drupal hosting setup (not specific to farmOS). If we can’t guide you in the right direction then you may have luck searching for answers for Drupal more generically.

2 Likes

Thank you very much to both of you!! Yes I also think I am almost there. I will work on this in the next days as harvest permits and report back. The information that you guys provided has certainly helped with the understanding of the setup.