Access Cloudron volume from WordPress container
-
Hi guys
Please could you help with the following; thank you very much in advance.
We've done out homework using both Cloudron and forum resources, see links below (thank you to all who documented their prior experience and troubleshooting):
We created a volume, we presented it to the WordPress app container / website, but we are not able to access an mp4 hosted on the volume from within WordPress to display the mp4 on a website page or post.
Here is what we've done:
- In Cloudron Volumes, we created a volume called ovitest of type Filesystem and pointing to /srv/ovitest (we created this folder on the host first using FileZilla); permissions were assigned to root, as one would expect
- In one of our WordPress Cloudron containers / websites, on Storage tab under the Mounts section, we added the volume ovitest with Read and Write permissions
- As per advice from https://forum.cloudron.io/topic/5747/volumes-are-not-working/8 we figured out that our cloudron user and group equivalent on our setup is www-data, so we ran "chown -R www-data:www-data /media/ovitest" to change permissions on the new volume, we confirmed from FileZilla that this change applied succesfully and plus, checking other hosted apps / systems we have, we noted the same Owner of www-data elsewhere so we are confident that the mount is set up correctly from a host / Cloudron perspective
NB: We were slightly surprised by the chown command using /media/ovitest given that we set up the Filesystem volume with /srv/ovitest, but the chowm command worked. Also when we run "ls -lah /media" in the Terminal for the website, we do get ovitest returned in the results.
Now, trying to access the mp4 file from the WordPress site, we can't figure out what the correct URL or UNC path is; we tried /media/ovitest/Red-cloud.mp4 which is correct from a Cloudron perspective, but it does not load in a video WordPress object (because the mp4 can't be found or accessed); we also tried https://<our_web_domain>/media/ovitest/Red-cloud.mp4 but this does not work either (mp4 can't be found or accessed). We confirmed the mp4 has correctly inherited the www-data user and group permissions, so we are out of ideas, hence asking you guys for advice.
Not sure if we also need a symlink created as detailed here https://forum.cloudron.io/topic/7619/filesystem-mount-inside-container/5 but our website is not showing under /home for root as benborges detailed in his post; so this may not apply to us.
Finally, as mentioned here https://forum.cloudron.io/topic/7619/filesystem-mount-inside-container/11 we also ran "chmod 777 Red-cloud.mp4" but this made no different as far as accessing this file from WordPress.
Your help and assistance is much appreciated, thank you again.
THI Staff
-
It seems the app container can see the mount from terminal so that's fine.
However now you have to map the mount dir to something the webserver can read and have access to.
For WP that means something like an additional dir in the wp-content/uploads/ tree that sym-links to the /media/ovitest mount path.
Once you can see and select your .mp4 from the media picker or filemanager plugin in WP, it'll work.
-
@robi That makes a lot of sense, though we've not seen any of this mentioned in the Cloudron documentation.
I will talk to our WordPress developer though he is new to the Cloudron packaged WP container deployment so if anybody can detail further what exactly is required for the following 2 steps, we would be very grateful indeed. Of course we'll have a go ourselves as well. Thank you @robi
"However now you have to map the mount dir to something the webserver can read and have access to.
For WP that means something like an additional dir in the wp-content/uploads/ tree that links to the /media/ovitest mount path." -
If I'm understanding the aim, maybe a job for the Minio app? Might make future migrations of content locations easier, too.
-
@girish Yes, all sorted, thank you for asking.
Thanks to @robi's suggestion all we needed to do was the following:
- in terminal window for our WordPress app, at /app/code/wp-content/uploads we created a symlink (ln -s /media/ovitest ovitest) and then updated its permissions, just in case (chown -R www-data:www-data ovitest)
- then we could access the mp4 at https://<our_web_domain>/wp-content/uploads/ovitest/Red-cloud.mp4
Thank you very much all; we did enjoy finding the fix in the end. And of course we will make good use of it as we can now keep 10-20 GB of data, or even more, outside the WordPress data container, so out of the backup, but still reference this content on our website, which is great.
-
-