Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Deeplinking media files from external volumes

    LAMP
    volumes
    3
    11
    109
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • benborges
      benborges last edited by girish

      I'm using a LAMP container to display the content of another container running tg-archive, by default tg-archive store media at the root of the site folder, inside a "media" folder.

      https://ukraine.osintukraine.com/

      But this is taking a lot of space (videos, images) so I started using a SSHFS mount volume to host the media folder, this means that in Cloudron context if I go to
      /media/dataua/media/ I can see all my media files from the command line from inside the container.

      But ultimately I want to be able to link to these files from the LAMP container html index, I already tried to change media path to /media/dataua/media/ but it seems the Apache server cannot see those files ?

      default cloudron data volume

      • /app/data/public
        --- media
        --- index.html

      sshfs data volume assigned to this LAMP container

      • /media/dataua/media/

      I also tried to "move" the default storage to the newly mounted volume, it seems cloudron is doing the operation but the container restart none of the files from the previous appdata/target have been moved to the new location, it's just empty.

      Maybe I have to be on the latest cloudron to be able to use volumes the way I want ?

      anyway, any help very much appreciated & thanks in advance !

      girish 2 Replies Last reply Reply Quote 0
      • girish
        girish Staff @benborges last edited by

        @benborges said in Deeplinking media files from external volumes:

        But ultimately I want to be able to link to these files from the LAMP container html index, I already tried to change media path to /media/dataua/media/ but it seems the Apache server cannot see those files ?

        Can you clarify what you mean by media path ? You have to fixup apache config - https://docs.cloudron.io/apps/lamp/#apache-settings

        1 Reply Last reply Reply Quote 0
        • Moved from Support by  girish girish 
        • girish
          girish Staff @benborges last edited by

          @benborges I did a quick test. I attached a volume which has some images:

          root@4213cfdd-b0fd-4325-9763-ec8ac002116d:/app/code# ls -l /media/blockstorage/images/
          total 260
          -rw-r--r-- 1 www-data www-data 265746 Jan  1  2021 artemis-fowl.jpeg
          

          I added this block to the apache config inside the VirtualHost in /app/data/apache/app.conf:

              Alias /images /media/blockstorage/images
              <Location /images>
                  Require all granted
              </Location>
          

          Restart the apps and I can access https://lamp.domain.com/images/artemis-fowl.jpeg.

          Not sure if this is what you are looking for though?

          benborges 2 Replies Last reply Reply Quote 3
          • benborges
            benborges @girish last edited by

            @girish This is exactly what I was looking, even better because I don't have to replace any of my path now, this is actually perfect, thank you very much for taking the time to test it !

            demo here https://russia.osintukraine.com/#2022-06-11

            1 Reply Last reply Reply Quote 1
            • Topic has been marked as a question  nebulon nebulon 
            • Topic has been marked as solved  nebulon nebulon 
            • benborges
              benborges @girish last edited by benborges

              @girish Last question, how did you gave www-data permissions to files inside the remote volume attached to the container ?

              In my use case they belong to a completely different user in another linux system so i'm a bit confused on how I should give proper permissions so that the apache web server can access these files.

              jdaviescoates 1 Reply Last reply Reply Quote 0
              • jdaviescoates
                jdaviescoates @benborges last edited by jdaviescoates

                @benborges you can do that using the File Manager for the Volume

                I use Cloudron with Gandi & Hetzner

                benborges 1 Reply Last reply Reply Quote 0
                • benborges
                  benborges @jdaviescoates last edited by

                  @jdaviescoates Yes that's how I usually do it but here, I have so many files in my media folder that the Filemanager crash during the operation .

                  girish benborges 2 Replies Last reply Reply Quote 0
                  • girish
                    girish Staff @benborges last edited by

                    @benborges Maybe there's too many files causing some crash. Are you able to go one level up and change permissions at directory level ? There is an option to change permissions recursively. Does that work?

                    benborges 1 Reply Last reply Reply Quote 1
                    • benborges
                      benborges @girish last edited by

                      @girish it does work for cloudron containers/volumes but since this is a filesystem on another system under another user, I'm not sure it can even change those permissions ?

                      And actually, it seems the fact those files are being handled by Apache, maybe I don't need to change permission at all?

                      girish 1 Reply Last reply Reply Quote 0
                      • girish
                        girish Staff @benborges last edited by

                        @benborges As long as it's readable by apache (which runs as www-data user), we should be good. Change in ownership is not needed.

                        1 Reply Last reply Reply Quote 1
                        • benborges
                          benborges @benborges last edited by

                          @benborges said in Deeplinking media files from external volumes:

                          @jdaviescoates Yes that's how I usually do it but here, I have so many files in my media folder that the Filemanager crash during the operation .

                          will have tg-archive to store media files in sub directories by month/day and problem solved 🙂

                          Thanks again for the support !

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Powered by NodeBB