R
Railway•15mo ago
nilsuria

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
Percy
Percy•15mo ago
Project ID: 49a4d477-fb25-4e0e-94a5-120cedd527f2
Brody
Brody•15mo ago
what is your current mount point @Vin - what was the mount point you used when doing tests with php?
MantisInABox
MantisInABox•15mo ago
/app/<pick_a_name_not_in_use>
nilsuria
nilsuria•15mo ago
/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
MantisInABox
MantisInABox•15mo ago
You would use the environment variable RAILWAY_VOLUME_MOUNT_PATH which will return your actual mount point for you in your code
nilsuria
nilsuria•15mo ago
Ok, I'm going to try. Thanks!
andrew.dev
andrew.dev•14mo ago
Hey @nilsuria - how did you end up implementing this in your app?
andrew.dev
andrew.dev•14mo ago
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.
Want results from more Discord servers?
Add your server