a year 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!
26 Replies
a year ago
Are you using the Strapi template from the Railway Marketplace?
a year ago
And no, upgrading your plan has nothing to do with it
a year ago
You would need to check strapi docs and see where they store media assets locally and mount a volume to that directory
a year 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
a year 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 :/
a year ago
can you try just with /public?
a year ago
afaik there's also some env vars you need to set because you can't run Strapi on development mode on Railway
a year ago
because of the way it works
a year 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
a year ago
ok i'm out of ideas <:kekw:788259314607325204>
a year ago
try /src/public
a year ago
if that doesn't work just use a provider like S3 or Cloudinary
a year ago
this is weird 😄 i spotted only the volume have the 149MB - but the images are gone anyways 😄

9 months 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.
9 months ago
Thanks for reporting back with the fix!
9 months ago
!s
Status changed to Solved adam • 9 months ago