Access certain files
I have pushed a program that writes some data in the .txt file, how can I access and download that data?
16 Replies
Project ID:
ba34f4c8-bb82-4d35-9d7f-59a5fadffc39
ba34f4c8-bb82-4d35-9d7f-59a5fadffc39
If you are writing and saving any form of files, they should be saved to a volume, as the container storage is ephemeral and will be wiped with every deploy of your app.
Once stored to a volume, you can either serve the files back for access in a web browser, or you will need to detach the volume from your app, and mount it to a file browser like this one https://railway.app/template/Nan7Bs
If you go this route, each time you detach the volume, you will not be able to write new files.
You can also use S3/R2 for file storage
Other than these options, there is no way to access the file that is written inside of the container that your app deployed to
Once I detach, can I attach it back again?
Yes, you can reattach it to the service, which will trigger a redeploy of the application.
this one might be better for just simply grabbing some files off the volume https://railway.app/template/guiCBv
I only want to read the file
like open it
thats all
then use the template I just linked, it comes with full instructions
but that's only applicable when using a volume, please refer to what vin has said about storing the file in the container
Ok and if I set the variable as an env variable, will its value be saved once no matter if I redeploy the program?
I'm using vscode server (
codercom/code-server
) to have access to a terminal. You can detach the volume from your service, attach it temporary the volume to vscode to do whatever you need, and then rattached back to your original service.Ok I see
by the way is observability interactable?
Like if I do fmt.Scan will I be able to write something?
no
there's no stdin, ssh, or shell access
Alright and would I be able to download the current state of the project (folder) in some way without detaching the volume?
nope, but even if you where using a volume your project is not stored in the volume
Ok
Solution
I handled it another way