🚨 Strapi + Railway – Media Lost After Deploy
Anonymous
HOBBYOP

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!

Solved

26 Replies

Anonymous
HOBBYOP

a year ago

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


medim
MODERATOR

a year ago

Are you using the Strapi template from the Railway Marketplace?


medim
MODERATOR

a year ago

And no, upgrading your plan has nothing to do with it


Anonymous
HOBBYOP

a year ago

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


medim
MODERATOR

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


medim
MODERATOR

a year ago

isn't it something like /public?



Anonymous
HOBBYOP

a year ago

yea, its the folder public/uploads and i've tried to add this path to the volume, but it didn't work


medim
MODERATOR

a year ago

how did u mount it? just /public?


Anonymous
HOBBYOP

a year ago

I tried it with few patterns, like:
/public/uploads
/uploads
(also the same but with / at end)
but still this didn't help :/


medim
MODERATOR

a year ago

can you try just with /public?


Anonymous
HOBBYOP

a year ago

yeah, I will try


medim
MODERATOR

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


medim
MODERATOR

a year ago

because of the way it works


medim
MODERATOR

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


Anonymous
HOBBYOP

a year 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


Anonymous
HOBBYOP

a year ago

okey, the /public also not work 😄


medim
MODERATOR

a year ago

ok i'm out of ideas <:kekw:788259314607325204>


medim
MODERATOR

a year ago

try /src/public


medim
MODERATOR

a year ago

if that doesn't work just use a provider like S3 or Cloudinary



Anonymous
HOBBYOP

a year ago

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

1341054853287510000


Anonymous
HOBBYOP

a year ago

Yeah, I think this is the only option left here


kdhoore
PRO

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.


adam
MODERATOR

9 months ago

Thanks for reporting back with the fix!


adam
MODERATOR

9 months ago

!s


Status changed to Solved adam • 9 months ago


Loading...