Announcement

Collapse
No announcement yet.

Save documents in a different disk

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Save documents in a different disk

    Having just setup a EspoCRM server that will be used progressively from more colleagues, it's a small machine with one 120GB SSD (with Ubuntu Server OS and applications) and a 500GB HDD.
    Is possible to configure EspoCRM so that any document will be saved into the HDD

  • #2
    Hello,

    https://forum.espocrm.com/forum/deve...urgent-problem

    i think there a a "mistake?" on a fileName of a .json.. try it so or correct it

    Create custom/Espo/Custom/Resourcs/metadata/app/fileStrage.json

    must be maybe Create custom/Espo/Custom/Resourcs/metadata/app/fileStorage.json

    I think too, the new folder must be readable by webserver (user/group permission of your webserver) and maybe not work with v6..

    Comment


    • #3
      Being not a developer I see this difficult to achieve, need to ask colleagues.
      Will be nice to have this feature if both trough UI at least in a configuration file, any way to suggest a feature request.

      Comment


      • #4
        Originally posted by davide445 View Post
        Being not a developer I see this difficult to achieve, need to ask colleagues.
        Will be nice to have this feature if both trough UI at least in a configuration file, any way to suggest a feature request.
        Personally I don't need to do it, but from the look of that thread it is quite simple to do, only part you actually have to work for is getting this line correct:

        Code:
        [COLOR=#000000][COLOR=#007700]        return [/COLOR][COLOR=#DD0000]'data/upload/' [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000BB]$sourceId[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#FF8000]// HERE YOUR CUSTOM PATH[/COLOR][/COLOR]

        Comment


        • #5
          Looking around I already found all the files to be created (I suppose new releases of EspoCRM integrate these files into standard), but in different paths

          /var/lib/docker/volumes/espo-docker_espocrm/_data/application/Espo/Resourcs/metadata/app/fileStrage.json
          /var/lib/docker/volumes/espo-docker_espocrm/_data/application/Espo/Core/FileStrage/Storages/EspoUploadDir.php

          I mounted the HDD partition under /mnt/hdd/espoupload/ and set this instead of data/upload/ in the php code.
          Copied all the directory and files from data/upload to the new location and changed recursivelly ownership to www-data so to align with the status of the data/upload/. All the permissions are aligned with the old one.

          Cleared cache but: all the logos and attachment are disappeared, and email is not more syncronized.

          Looking at EspoCRM logs appear a [500] error permisson denied.
          Last edited by davide445; 11-22-2020, 01:57 PM.

          Comment


          • #6
            Looking at the permissions configuration
            https://docs.espocrm.com/administrat...n/#permissions
            I think I have set all correctly using Webmin File Manager (see attached images. Edit: I later changed the name of the dir from "EspoCRM_upload" to "espoupload")

            I didn't used the suggested script

            Code:
            cd <PATH-TO-ESPOCRM-DIRECTORY>
            find . -type d -exec chmod 755 {} + && find . -type f -exec chmod 644 {} +;
            find data custom client/custom -type d -exec chmod 775 {} + && find data custom client/custom -type f -exec chmod 664 {} +;
            chmod 775 application/Espo/Modules client/modules;
            Since being not inside standard espocrm /var/lib/docker/volumes/espo-docker_espocrm/_data/data dir but a different /mnt/hdd/espoupload dir I supposed was not working in this case

            Even setting the /mnt and all his dubdir 777 persmission result in the same problem, this is the error from log

            Code:
            [2020-11-22 13:27:48] Espo.WARNING: E_WARNING: mkdir(): Permission denied {"code":2,"message":"mkdir(): Permission denied","file":"/var/www/html/application/Espo/Core/Utils/File/Manager.php","line":528,"context":{"path":"/mnt/hdd/espoupload","permission":"493","recursive":true,"f ullPath":"/mnt/hdd/espoupload","defaultPermissions":{"dir":"0755","fi le":"0644","user":"www-data","group":"www-data"},"umask":18}} []
            [2020-11-22 13:27:48] Espo.ERROR: (500) Permission denied: unable to create a folder on the server - /mnt/hdd/espoupload; POST /Attachment; line: 656, file: /var/www/html/application/Espo/Core/Utils/File/Manager.php [] []
            I have checked using ls -n the uid and guid of /data/uload dir and it's the same 33:33 set in the new directory.
            I can touch a file and mkdir a dir inside /mnt/hdd/espoupload using server user
            Last edited by davide445; 11-22-2020, 01:54 PM.

            Comment


            • #7
              Hi there, my suggestion is to start small.

              Can you first try changing it to a different folder name first, then upper level filepath, then slowly work your way upward, at least that way you know your Script is working but it just having problem when it come to different Drive location rather than it not working at all.

              That as far as I can give my input.

              Comment


              • #8
                Tested as you suggested, using absolute path

                /var/lib/docker/volumes/docker-master_espocrm/_data/data/uploadtest/

                always give the same permission denied error, using the relative path

                data/uploadtest/

                work. Same directory same position, just changed the path.
                Maybe I need to change something else in EspoCRM configuration? Otherwise I can't refer a different directory outside data.
                Last edited by davide445; 11-29-2020, 09:25 PM.

                Comment


                • #9
                  Hello,

                  i have no skill with docker but i think some setting is "docker" restriction. (see somethink like that on github)
                  you need to adapt apache/nginx setting ! there are for setting who provide "access denied" for folder !
                  as is see, it's not easy with many technologie to find a good result.. ?

                  Comment


                  • #10
                    Using your keyword I dig up a bit of information but no luck of similar issue.

                    Only one information I manage to find might fluke a solution is to add in the .

                    e.g.

                    ./var/lib/docker/volumes/docker-master_espocrm/_data/data/uploadtest/

                    Or possible //
                    //var//lib//docker//volumes//docker-master_espocrm//_data//data//uploadtest//

                    This article mention of using a volume command:
                    Just putting out into a blog post some of the things I understand about Docker volumes and bind-mounts. Been doing a bit of reading on these and taking notes.  We have two types of locations that c…


                    ---

                    Lastly as a work-around, will Symbolic link work you reckon? Not sure if Linux/Docker can do symbolic/hard linking.

                    Comment


                    • #11
                      using ./ didn't give any error finally, also relocating the uploadtest directory in /mnt/hdd.

                      The problem is loads the images always in the old standard data/upload directory!

                      I cleared the cache and reloaded the page, re-login from the admin, rebooted the system as last test, but still loads in the old dir. The EspoUploadDir.php correctly point to the new dir.
                      Last edited by davide445; 11-30-2020, 08:02 AM.

                      Comment


                      • #12
                        Looking at the Docker access topic
                        https://flaviocopes.com/docker-acces...ide-container/
                        I suppose can use a Bind Mount or a Volume to make Docker able to access /mnt/hdd/espoupload, but being not a Docker expert I would prefer someone can point me putting together EspoCRM with Docker usage.
                        In any case previous posed problem seems tell EspoCRM it's not using the EspoUploadDir.php file to decide where the uploads where saved, so not sure how the whole process will work.

                        Comment

                        Working...
                        X