3 months ago
I'm hosting Strapi on Railway, and media files are lost after each deploy because Railway uses an ephemeral filesystem.
I want to use Railway Volumes to store media files persistently. Can this be done? If so, what do I need to configure?
If not, are there any other good solutions (like S3, Cloudinary)?
Also, does upgrading to a higher plan with backups help with this issue?
Appreciate any insights!
1 Replies
3 months ago
Are you using the Strapi template from the Railway Marketplace?
3 months ago
And no, upgrading your plan has nothing to do with it
3 months ago
You would need to check strapi docs and see where they store media assets locally and mount a volume to that directory
3 months ago
isn't it something like /public
?
yea, its the folder public/uploads and i've tried to add this path to the volume, but it didn't work
3 months ago
how did u mount it? just /public
?
I tried it with few patterns, like:
/public/uploads
/uploads
(also the same but with / at end)
but still this didn't help :/
3 months ago
can you try just with /public
?
3 months ago
afaik there's also some env vars you need to set because you can't run Strapi on development mode on Railway
3 months ago
because of the way it works
3 months ago
you can also try deploying this template, it doesn't have a volume but it's a good starting point
https://railway.com/template/strapi
yeah, I know - now its running on the production mode and for me its fine, cuz I dont need to modify fields on deploy - I prefer keep change it localy
unless it is needed for volumes to work properly
3 months ago
ok i'm out of ideas <:kekw:788259314607325204>
3 months ago
try /src/public
3 months ago
if that doesn't work just use a provider like S3 or Cloudinary
3 months ago
this is weird 😄 i spotted only the volume have the 149MB - but the images are gone anyways 😄
17 days ago
Had the same problem; the correct path is '/app/public/uploads'
This was mentioned in the docs here (under the section 'Relative Paths':
https://docs.railway.com/guides/volumes
Fyi: It doesn't matter which builder you are using - Nixpacks or Railpack - both need the '/app' prefix.
17 days ago
Thanks for reporting back with the fix!
17 days ago
!s
Status changed to Solved adam • 17 days ago