R
Railway12mo ago
Saul

Access certain files

I have pushed a program that writes some data in the .txt file, how can I access and download that data?
Solution:
I handled it another way
Jump to solution
16 Replies
Percy
Percy12mo ago
Project ID: ba34f4c8-bb82-4d35-9d7f-59a5fadffc39
Saul
SaulOP12mo ago
ba34f4c8-bb82-4d35-9d7f-59a5fadffc39
MantisInABox
MantisInABox12mo ago
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
Saul
SaulOP12mo ago
Once I detach, can I attach it back again?
MantisInABox
MantisInABox12mo ago
Yes, you can reattach it to the service, which will trigger a redeploy of the application.
Brody
Brody12mo ago
this one might be better for just simply grabbing some files off the volume https://railway.app/template/guiCBv
Saul
SaulOP12mo ago
I only want to read the file like open it thats all
Brody
Brody12mo ago
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
Saul
SaulOP12mo ago
Ok and if I set the variable as an env variable, will its value be saved once no matter if I redeploy the program?
simoelalj
simoelalj12mo ago
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.
Saul
SaulOP12mo ago
Ok I see by the way is observability interactable? Like if I do fmt.Scan will I be able to write something?
Brody
Brody12mo ago
no there's no stdin, ssh, or shell access
Saul
SaulOP12mo ago
Alright and would I be able to download the current state of the project (folder) in some way without detaching the volume?
Brody
Brody12mo ago
nope, but even if you where using a volume your project is not stored in the volume
Saul
SaulOP12mo ago
Ok
Solution
Saul
Saul12mo ago
I handled it another way
Want results from more Discord servers?
Add your server