🚨 Strapi + Railway – Media Lost After Deploy
Anonymous
HOBBYOP

2 years 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

2 years ago

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


2 years ago

Are you using the Strapi template from the Railway Marketplace?


2 years ago

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


Anonymous
HOBBYOP

2 years ago

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


2 years ago

You would need to check strapi docs and see where they store media assets locally and mount a volume to that directory


2 years ago

isn't it something like /public?



Anonymous
HOBBYOP

2 years ago

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


2 years ago

how did u mount it? just /public?


Anonymous
HOBBYOP

2 years ago

I tried it with few patterns, like:

/public/uploads

/uploads

(also the same but with / at end)

but still this didn't help :/


2 years ago

can you try just with /public?


Anonymous
HOBBYOP

2 years ago

yeah, I will try


2 years ago

afaik there's also some env vars you need to set because you can't run Strapi on development mode on Railway


2 years ago

because of the way it works


2 years 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

2 years 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

2 years ago

okey, the /public also not work 😄


2 years ago

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


2 years ago

try /src/public


2 years ago

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



Anonymous
HOBBYOP

2 years ago

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

1341054853287510117


Anonymous
HOBBYOP

2 years ago

Yeah, I think this is the only option left here


kdhoore
PRO

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


a year ago

Thanks for reporting back with the fix!


a year ago

!s


Status changed to Solved adam • over 1 year ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...