laravel volume for the image storage
Hi!
I have a Laravel application deployed via Github to a Railway service. The app is using a Local Laravel Storage. All is working fine, except the fact that every time that the application is redeploied all uploaded images in the Laravel Storage disappear.
I've been trying to use a Volume to solve that issue, but it don't seem to work as when reedeploing it keeps deleting all the images, and the used space in the volume don't increase when I upload images to the app.
The issue may be in the route I specify. The local route I use to save the files is /storage/app/public, and I do a "php artisan storage:link" to make a symbolic link from public/storage to /storage/app/public.
Which is the correct way of setting the volume mount point to make it work with the Laravel Local Storage?
The project ID is 49a4d477-fb25-4e0e-94a5-120cedd527f2 and the Github project is here: https://github.com/nilsuria/TFG-EI-wishapp
Thank you in advance!
9 Replies
Project ID:
49a4d477-fb25-4e0e-94a5-120cedd527f2
what is your current mount point
@Vin - what was the mount point you used when doing tests with php?
/app/<pick_a_name_not_in_use>
/storage/app/public
But then how I have to configure the storage disk in Laravel? Right now, to upload the image I'm doing: $image->store('public/uploads'). The image can't be saved in /app/<pick_a_name_not_in_use>, since it have to be in the /public/storage folder
You would use the environment variable
RAILWAY_VOLUME_MOUNT_PATH
which will return your actual mount point for you in your codeOk, I'm going to try. Thanks!
Hey @nilsuria - how did you end up implementing this in your app?
Hey Brody! Thanks for that 🙂 Just trying to figure out where to plug that code in so was wondering if his code was open-source so I could take a peek at his filesystem setup.