R
Railway•3mo ago
theo

How can I upload files to my application?

I am using firebase to upload images and firebase have a specific way of doing things, that is upload a file with the certification config. This file, of course, have sensible data. How can I upload files like this without pushing it to my project?
123 Replies
Percy
Percy•3mo ago
Project ID: 75f448f4-88c9-4d82-b428-61740d90e40c
theo
theoOP•3mo ago
75f448f4-88c9-4d82-b428-61740d90e40c
Brody
Brody•3mo ago
you would need to first upload the file with this - https://railway.app/template/Nan7Bs and then move the volume over to your service
theo
theoOP•3mo ago
i didnt understand if i can drop a file to my folders structure is that it?
Brody
Brody•3mo ago
yes, read the software's docs please - https://filebrowser.org/features
theo
theoOP•3mo ago
i did but the content is not that familiar to me how exactly do i use this? ive deployd it
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
how can i paste my files and how is this used on my app? i see that i can access this on browser but how will the dropped file go to my app?
Brody
Brody•3mo ago
You will need to move the volume over to your app
theo
theoOP•3mo ago
so I need to create the same folder structure to drop my file? for example its located on src/firebase/constants
Brody
Brody•3mo ago
you can create whatever folder structure you want
theo
theoOP•3mo ago
so i need to re-create this structure to make this accessible on my app?
Brody
Brody•3mo ago
not unless you want to do what works best for you
theo
theoOP•3mo ago
okay, and how can I move the volume to the application?
Brody
Brody•3mo ago
disconnect it and connect it to your app's service
theo
theoOP•3mo ago
isnt it possible to paste the volume on the root path?
Brody
Brody•3mo ago
no it is not
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
oh imma do anything else then you said it is not possible to paste the volume on root path so i need to put it anywhere else
Brody
Brody•3mo ago
gotcha
theo
theoOP•3mo ago
so i need to change my application
Brody
Brody•3mo ago
i dont see why you need to
theo
theoOP•3mo ago
where will be this file located? on the path, right?
Brody
Brody•3mo ago
wherever you uploaded it within the volume
theo
theoOP•3mo ago
okay, but the volume itself is on /data, right? aint i getting this correctly?
Brody
Brody•3mo ago
the volume will be whereever you mount it
theo
theoOP•3mo ago
but i cant put this on root folder, right?
Brody
Brody•3mo ago
correct, nor would you want to please read this - https://docs.railway.app/guides/volumes
theo
theoOP•3mo ago
will be useful thanks it is exactly what i was saying lol okay, now am I able to remove the filebrowser? it still not being able to import the file just to validate I opened the filebrowser and dropped a file on root folder i moved the volume on /app/secrets folder to my application but it still not being available to access on my app. am i forgetting something? how do I know if the data is persisted on the volume? am i able to deploy a different commit on my app?
Brody
Brody•3mo ago
have you carefully read its overview?
theo
theoOP•3mo ago
yes, the content is short
Brody
Brody•3mo ago
i'm sorry, i dont see the relevance to what i had just asked
theo
theoOP•3mo ago
no problem 🙂 look
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
oh, probably i need to put this on dist no, it still with the same problem it is not working... im probably doing something wrong here
Brody
Brody•3mo ago
please read the template overview
theo
theoOP•3mo ago
i did
Brody
Brody•3mo ago
slow down, read it again
theo
theoOP•3mo ago
the template doesnt say anything, basically it just says what the template does
Brody
Brody•3mo ago
yes it does, slow down, read it again
theo
theoOP•3mo ago
railway just crashed and its infinitly applying 3 changes more than 5 minutes with that
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
applied, but it just dont work i readed this 10 times, doesnt helped
Brody
Brody•3mo ago
you are skim reading it to be clear, you should be reading this - https://railway.app/template/Nan7Bs
theo
theoOP•3mo ago
i did were you talking about this part?
By default, the storage location is set to the storage subdirectory in the root of the volume, but by setting a service variable USE_VOLUME_ROOT to 1 you can opt to use the root of the volume as the storage location instead
By default, the storage location is set to the storage subdirectory in the root of the volume, but by setting a service variable USE_VOLUME_ROOT to 1 you can opt to use the root of the volume as the storage location instead
i was already using the root folder but it is still not working The rest of this post is just about what the template does
Brody
Brody•3mo ago
you have that variable set to what value?
theo
theoOP•3mo ago
1 ive already tried with 0 and 1 none of them worked
Brody
Brody•3mo ago
then the path you mounted the volume to or the path you are trying to read the file from is incorrect, or both
theo
theoOP•3mo ago
the path im trying to read is just <root>/secrets/file.json
Brody
Brody•3mo ago
what did you mount the volume to
theo
theoOP•3mo ago
/app inside the volume i created a folder called secrets and inside of it, file.json
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
import * as cert from '../../secrets/firebase-secret.json'
import * as cert from '../../secrets/firebase-secret.json'
../.. points to root folder
Brody
Brody•3mo ago
^
theo
theoOP•3mo ago
but what is wrong with that?
Brody
Brody•3mo ago
you don't gain any problem solving abilities if I gave you all the simple answers
theo
theoOP•3mo ago
the problem is not the import, is the platform it is not clear how to do things and the docs dont help if it was clear, i dont need to open a thread
Brody
Brody•3mo ago
this is not a platform or anything specific to the platform, this is just simple file paths and such nothing Railway specific
theo
theoOP•3mo ago
so why does it work when i create the file manually but not when i use this volume stuff?
Brody
Brody•3mo ago
because you are doing something incorrectly ^
theo
theoOP•3mo ago
if i am, it is related to the volume, not to the app, the app is working correctly the instructions to use the volumes are not clear
Brody
Brody•3mo ago
volume's are nothing special, it's simply a place to store files
theo
theoOP•3mo ago
Nixpacks, the default buildpack used by Railway, puts your application files in an /app folder at the root of the container. If your application writes to a directory at a relative path, and you need to persist that data on the volume, your mount path should include the app path.
Nixpacks, the default buildpack used by Railway, puts your application files in an /app folder at the root of the container. If your application writes to a directory at a relative path, and you need to persist that data on the volume, your mount path should include the app path.
Brody
Brody•3mo ago
yep
theo
theoOP•3mo ago
so... i did it and inside my volume, i created a secrets folder it is on root, right?
Brody
Brody•3mo ago
if you set that variable, yes, though I haven't looked at your filebrowser service to verify if you did
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
so...? its specific from railway use a variable with a 0-1 value to set the folder is not normal path handle and it still dont work
Brody
Brody•3mo ago
that variable is specific to my filebrowser template, not railway, using correct file paths is not specific to railway either. I recommend you read our guide again and read up on how file paths work in general. keep trying, you will get there, and learn a new skill in the end.
theo
theoOP•3mo ago
we are talking about 2 things that are specific your template and railway
Brody
Brody•3mo ago
a folder named /app is not specific to Railway
theo
theoOP•3mo ago
okay, but i've already set mine to this path the thing is, im using a template created by u
Brody
Brody•3mo ago
^ ... have you moved the volume over yet?
theo
theoOP•3mo ago
to my application? sure
Brody
Brody•3mo ago
let's see
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
No description
Brody
Brody•3mo ago
i mean, that's definitely a volume, but is it the volume that was attached to the filebrowser?
theo
theoOP•3mo ago
yes, it is i dont see a way to prove it, but it is
Brody
Brody•3mo ago
what did your app fail with
theo
theoOP•3mo ago
because its trying to import a file that does not exists (the file provided by the volume)
Brody
Brody•3mo ago
(the file provided by you)
theo
theoOP•3mo ago
how can I validate if the file is on the volume?
Brody
Brody•3mo ago
did you put it on the volume?
theo
theoOP•3mo ago
yes, using the file browser
Brody
Brody•3mo ago
then it's on the volume
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
No description
theo
theoOP•3mo ago
this is what i have the appdata and lost+found came with the volume, they were not put by me
Brody
Brody•3mo ago
they came from the filebrowser software
theo
theoOP•3mo ago
yes, so i put the file into the volume, right?
Brody
Brody•3mo ago
well lost+found is a linux thing, but that's besides the point right
theo
theoOP•3mo ago
and it proves i've used the 1 to set on root folder
Brody
Brody•3mo ago
yes it does
theo
theoOP•3mo ago
because these folders does not appear when 0 is used so... the file is on the expected path
Brody
Brody•3mo ago
right
theo
theoOP•3mo ago
so, it must be accessible on the application but its not
Brody
Brody•3mo ago
^
theo
theoOP•3mo ago
look, this is my vscode
No description
Brody
Brody•3mo ago
did you use nixpacks?
theo
theoOP•3mo ago
this works the secrets is directly on root folder yes, i do use nixpacks i see something here that must be a problem
Volume Availability
Volumes are mounted to your service's container when it is started, not during build time.

If you write data to a directory at build time, it will not persist on the volume, even if it writes to the directory to which you have mounted the volume.

Volumes are not mounted as overlays.
Volume Availability
Volumes are mounted to your service's container when it is started, not during build time.

If you write data to a directory at build time, it will not persist on the volume, even if it writes to the directory to which you have mounted the volume.

Volumes are not mounted as overlays.
files are not accessible during build does it counts to reading too?
Brody
Brody•3mo ago
did you tell me that you needed that file during build?
theo
theoOP•3mo ago
i told you that my build were failing cause the file wasnt there
Brody
Brody•3mo ago
I get so many people using failed builds as a generic term for a crash at any stage, specifics are key alright, how big is that file
theo
theoOP•3mo ago
ok, imma be more specific 2.34kb
Brody
Brody•3mo ago
since when are they that large?
theo
theoOP•3mo ago
there are keys and stuff private keys to handshake they are long i tried to use envs instead, but didnt worked fine
Brody
Brody•3mo ago
alright we'll try to base64 encode the json, set the base64 string as a variable, and then in code decode the base64 back into a string
theo
theoOP•3mo ago
i can try just bypass this error during build time also
Brody
Brody•3mo ago
just a thought, I forget how large variables can be, I think that should fit
theo
theoOP•3mo ago
i dont like this strategy a lot, but its possible
Brody
Brody•3mo ago
why not?
theo
theoOP•3mo ago
bypass things can hide another problems on the future for exemple, the file actually dont be there
Brody
Brody•3mo ago
oh you said you don't like your idea, try mine
theo
theoOP•3mo ago
your idea is to encode b64 the file and decode this on the app?
Brody
Brody•3mo ago
yes 2.34kb worth of data should fit into a variable, but don't quote me on that
theo
theoOP•3mo ago
3200 characters of b64
Brody
Brody•3mo ago
see what happens, it can't hurt if you break railway I won't hold you accountable
theo
theoOP•3mo ago
if my bill comes $ 1000 ill give it to you as a gift
Brody
Brody•3mo ago
well it's a good thing we don't bill for variables
theo
theoOP•3mo ago
does anyone bills for variables? haha ima try this
Brody
Brody•3mo ago
I sure hope not
Want results from more Discord servers?
Add your server