a year ago
hi all,
been trying to implement volume as persistent storage for my react+node full stack ssr app (vike+node). i have created a mount point to /app/client/uploads/ and configured my backend to upload files to this location (fs.writeFile(${process.env.RAILWAY_VOLUME_MOUNT_PATH}/script.txt
), however when i try to access this file (and every other file from path /client/uploads/) from my ssr rendered front end i get nothing!
can someone help what am i missing here?
13 Replies
a year ago
have you setup your app to serve files from that location on disk with that url path? this is not something railway would do for you, you would need to setup a file server in code
a year ago
you mean by implementing app.use(
express.static(path.join(_dirname, process.env.RAILWAYVOLUMEMOUNTPATH))
) in my server?
a year ago
it still isn't finding anything in that location… i definitely am missing something. is there any way to access this volume and check whether files are getting uploaded there at all?
a year ago
you likely have some path wrong somewhere, please double-check everything.
yes, there is a way to access the volume, but it is far from simple, The best way to check is to upload large files and see if the disk usage increases.
a year ago
you likely have some path wrong somewhere, please double-check everything.
yes, there is a way to access the volume, but it is far from simple, The best way to check is to upload large files and see if the disk usage increases.
is this the way to access the volume? https://railway.app/template/guiCBv
i have tried every other path combo that i could think of and still no result. it seems to me that files are getting uploaded since usage has increased by couple MB after i uploaded several files, however i can't access them from the front end no matter what…. perhaps SSR is messing something up?
a year ago
is this the way to access the volume? https://railway.app/template/guiCBv
yes.
i have tried every other path combo that i could think of and still no result. it seems to me that files are getting uploaded since usage >has increased by couple MB after i uploaded several files, however i can't access them from the front end no matter what…. perhaps >SSR is messing something up?
something is messing up somewhere, likely just paths are wrong, if you could share your repo I could try recommending some paths to try.
a year ago
that would be much appreciated…. i can add you directly as collaborator in github, what's your username there?
a year ago
ok invite sent… basically, you are looking at app.js for express.static(); +onRenderHtml.jsx for the html element trying to read the script and clarityUpdate.js for the function trying to write all these scripts to file.
i'm currently testing with /app/dist/client/assets/static/uploads as mount point
a year ago
i managed to fix this, but first i had to browse the mounted volume and get an idea how data is saved there… it was the paths definitely.
the abstraction that vike and railway add when building the app (especially the SSR front-end) is somewhat troublesome. also, not being able to browse and manage data in the mounted volume is not really what i'm looking long-term. i need to find better storage space for user images…
Status changed to Solved Railway • over 1 year ago
a year ago
I'm really sorry I wasn't able to help, shortly after sending my gh username I became very busy solving some code issues I made for myself.
Happy you were able to solve it! and may I recommend mino for storing data?
https://railway.app/template/SMKOEA
connect to it via the private network and use your favorite s3 compatible SDK! it also comes with a web UI that allows you to manage the files in the bucket!
a year ago
no problem, thanks for helping out as much as you did anyways.
thanks for the storage suggestion, i will definitely take a look as i was considering s3 as an option also…
br
vlado