🚨 Strapi + Railway – Media Lost After Deploy

AnonymousHOBBY

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!

Solved

1 Replies

AnonymousHOBBY

3 months ago

b4aa6677-7b99-4bb7-9824-6c613bb83bcc


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


AnonymousHOBBY

3 months ago

No, I created it by CLI and upload it by github


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?



AnonymousHOBBY

3 months ago

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?


AnonymousHOBBY

3 months ago

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?


AnonymousHOBBY

3 months ago

yeah, I will try


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


AnonymousHOBBY

3 months ago

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


AnonymousHOBBY

3 months ago

okey, the /public also not work 😄


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



AnonymousHOBBY

3 months ago

this is weird 😄 i spotted only the volume have the 149MB - but the images are gone anyways 😄

1341054853287510000


AnonymousHOBBY

3 months ago

Yeah, I think this is the only option left here


kdhoorePRO

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


🚨 Strapi + Railway – Media Lost After Deploy - Railway Help Station