How can I upload files to my application?
theo-nejm
HOBBYOP

2 years ago

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?

Closed

201 Replies

theo-nejm
HOBBYOP

2 years ago

75f448f4-88c9-4d82-b428-61740d90e40c


2 years ago

you would need to first upload the file with this -

and then move the volume over to your service


theo-nejm
HOBBYOP

2 years ago

i didnt understand if i can drop a file to my folders structure


theo-nejm
HOBBYOP

2 years ago

is that it?


2 years ago

yes, read the software's docs please -


theo-nejm
HOBBYOP

2 years ago

i did


theo-nejm
HOBBYOP

2 years ago

but the content is not that familiar to me


theo-nejm
HOBBYOP

2 years ago

how exactly do i use this?


theo-nejm
HOBBYOP

2 years ago

ive deployd it


theo-nejm
HOBBYOP

2 years ago

1286513782180544532


theo-nejm
HOBBYOP

2 years ago

how can i paste my files and how is this used on my app?


theo-nejm
HOBBYOP

2 years ago

i see that i can access this on browser


theo-nejm
HOBBYOP

2 years ago

but how will the dropped file go to my app?


2 years ago

You will need to move the volume over to your app


theo-nejm
HOBBYOP

2 years ago

so I need to create the same folder structure to drop my file?


theo-nejm
HOBBYOP

2 years ago

for example


theo-nejm
HOBBYOP

2 years ago

its located on src/firebase/constants


2 years ago

you can create whatever folder structure you want


theo-nejm
HOBBYOP

2 years ago

so i need to re-create this structure to make this accessible on my app?


2 years ago

not unless you want to


2 years ago

do what works best for you


theo-nejm
HOBBYOP

2 years ago

okay, and how can I move the volume to the application?


2 years ago

disconnect it and connect it to your app's service


theo-nejm
HOBBYOP

2 years ago

isnt it possible to paste the volume on the root path?


2 years ago

no it is not


theo-nejm
HOBBYOP

2 years ago

1286515907711209553


theo-nejm
HOBBYOP

2 years ago

oh


theo-nejm
HOBBYOP

2 years ago

imma do anything else then


theo-nejm
HOBBYOP

2 years ago

you said it is not possible to paste the volume on root path


theo-nejm
HOBBYOP

2 years ago

so i need to put it anywhere else


2 years ago

gotcha


theo-nejm
HOBBYOP

2 years ago

so i need to change my application


2 years ago

i dont see why you need to


theo-nejm
HOBBYOP

2 years ago

where will be this file located?


theo-nejm
HOBBYOP

2 years ago

on the path, right?


2 years ago

wherever you uploaded it within the volume


theo-nejm
HOBBYOP

2 years ago

okay, but the volume itself is on /data, right?


theo-nejm
HOBBYOP

2 years ago

aint i getting this correctly?


2 years ago

the volume will be whereever you mount it


theo-nejm
HOBBYOP

2 years ago

but i cant put this on root folder, right?


2 years ago

correct, nor would you want to


2 years ago

please read this -


theo-nejm
HOBBYOP

2 years ago

will be useful thanks


theo-nejm
HOBBYOP

2 years ago

it is exactly what i was saying lol


theo-nejm
HOBBYOP

2 years ago

okay, now am I able to remove the filebrowser?


theo-nejm
HOBBYOP

2 years ago

it still not being able to import the file


theo-nejm
HOBBYOP

2 years ago

just to validate


theo-nejm
HOBBYOP

2 years ago

I opened the filebrowser and dropped a file on root folder


theo-nejm
HOBBYOP

2 years ago

i moved the volume on /app/secrets folder to my application


theo-nejm
HOBBYOP

2 years ago

but it still not being available to access on my app.

am i forgetting something?


theo-nejm
HOBBYOP

2 years ago

how do I know if the data is persisted on the volume?


theo-nejm
HOBBYOP

2 years ago

am i able to deploy a different commit on my app?


2 years ago

have you carefully read its overview?


theo-nejm
HOBBYOP

2 years ago

yes, the content is short


2 years ago

i'm sorry, i dont see the relevance to what i had just asked


theo-nejm
HOBBYOP

2 years ago

no problem 🙂


theo-nejm
HOBBYOP

2 years ago

look


theo-nejm
HOBBYOP

2 years ago

1286521745502769222


theo-nejm
HOBBYOP

2 years ago

oh, probably i need to put this on dist


theo-nejm
HOBBYOP

2 years ago

no, it still with the same problem


theo-nejm
HOBBYOP

2 years ago

it is not working...


theo-nejm
HOBBYOP

2 years ago

im probably doing something wrong here


2 years ago

please read the template overview


theo-nejm
HOBBYOP

2 years ago

i did


2 years ago

slow down, read it again


theo-nejm
HOBBYOP

2 years ago

the template doesnt say anything, basically


theo-nejm
HOBBYOP

2 years ago

it just says what the template does


2 years ago

yes it does, slow down, read it again


theo-nejm
HOBBYOP

2 years ago

railway just crashed and its infinitly applying 3 changes


theo-nejm
HOBBYOP

2 years ago

more than 5 minutes with that


theo-nejm
HOBBYOP

2 years ago

1286525539900719114


theo-nejm
HOBBYOP

2 years ago

applied, but it just dont work


theo-nejm
HOBBYOP

2 years ago

i readed this 10 times, doesnt helped


2 years ago

you are skim reading it


2 years ago

to be clear, you should be reading this -


theo-nejm
HOBBYOP

2 years ago

i did


theo-nejm
HOBBYOP

2 years ago

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


theo-nejm
HOBBYOP

2 years ago

i was already using the root folder


theo-nejm
HOBBYOP

2 years ago

but it is still not working


theo-nejm
HOBBYOP

2 years ago

The rest of this post is just about what the template does


2 years ago

you have that variable set to what value?


theo-nejm
HOBBYOP

2 years ago

1


theo-nejm
HOBBYOP

2 years ago

ive already tried with 0 and 1


theo-nejm
HOBBYOP

2 years ago

none of them worked


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

2 years ago

the path im trying to read is just /secrets/file.json


2 years ago

what did you mount the volume to


theo-nejm
HOBBYOP

2 years ago

/app

inside the volume i created a folder called secrets and inside of it, file.json


theo-nejm
HOBBYOP

2 years ago

1286529048511512639


theo-nejm
HOBBYOP

2 years ago

1286529094321705053


theo-nejm
HOBBYOP

2 years ago

import * as cert from '../../secrets/firebase-secret.json'


theo-nejm
HOBBYOP

2 years ago

../.. points to root folder


2 years ago

^


theo-nejm
HOBBYOP

2 years ago

but what is wrong with that?


2 years ago

you don't gain any problem solving abilities if I gave you all the simple answers


theo-nejm
HOBBYOP

2 years ago

the problem is not the import, is the platform


theo-nejm
HOBBYOP

2 years ago

it is not clear how to do things


theo-nejm
HOBBYOP

2 years ago

and the docs dont help


theo-nejm
HOBBYOP

2 years ago

if it was clear, i dont need to open a thread


2 years ago

this is not a platform or anything specific to the platform, this is just simple file paths and such


2 years ago

nothing Railway specific


theo-nejm
HOBBYOP

2 years ago

so why does it work when i create the file manually but not when i use this volume stuff?


2 years ago

because you are doing something incorrectly


2 years ago

^


theo-nejm
HOBBYOP

2 years ago

if i am, it is related to the volume, not to the app, the app is working correctly


theo-nejm
HOBBYOP

2 years ago

the instructions to use the volumes are not clear


2 years ago

volume's are nothing special, it's simply a place to store files


theo-nejm
HOBBYOP

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


2 years ago

yep


theo-nejm
HOBBYOP

2 years ago

so...


theo-nejm
HOBBYOP

2 years ago

i did it


theo-nejm
HOBBYOP

2 years ago

and inside my volume, i created a secrets folder


theo-nejm
HOBBYOP

2 years ago

it is on root, right?


2 years ago

if you set that variable, yes, though I haven't looked at your filebrowser service to verify if you did


theo-nejm
HOBBYOP

2 years ago

1286530467474182207


theo-nejm
HOBBYOP

2 years ago

so...?


theo-nejm
HOBBYOP

2 years ago

its specific from railway


theo-nejm
HOBBYOP

2 years ago

use a variable with a 0-1 value to set the folder


theo-nejm
HOBBYOP

2 years ago

is not normal path handle


theo-nejm
HOBBYOP

2 years ago

and it still dont work


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

2 years ago

we are talking about 2 things that are specific


theo-nejm
HOBBYOP

2 years ago

your template and railway


2 years ago

a folder named /app is not specific to Railway


theo-nejm
HOBBYOP

2 years ago

okay, but i've already set mine to this path


theo-nejm
HOBBYOP

2 years ago

the thing is, im using a template created by u


2 years ago

^


2 years ago

... have you moved the volume over yet?


theo-nejm
HOBBYOP

2 years ago

to my application? sure


2 years ago

let's see


theo-nejm
HOBBYOP

2 years ago

1286532037750030397


theo-nejm
HOBBYOP

2 years ago

1286532141634682901


2 years ago

i mean, that's definitely a volume, but is it the volume that was attached to the filebrowser?


theo-nejm
HOBBYOP

2 years ago

yes, it is


theo-nejm
HOBBYOP

2 years ago

i dont see a way to prove it, but it is


2 years ago

what did your app fail with


theo-nejm
HOBBYOP

2 years ago

because its trying to import a file that does not exists


theo-nejm
HOBBYOP

2 years ago

(the file provided by the volume)


2 years ago

(the file provided by you)


theo-nejm
HOBBYOP

2 years ago

how can I validate if the file is on the volume?


2 years ago

did you put it on the volume?


theo-nejm
HOBBYOP

2 years ago

yes, using the file browser


2 years ago

then it's on the volume


theo-nejm
HOBBYOP

2 years ago

1286532601309560833


theo-nejm
HOBBYOP

2 years ago

1286532646423232533


theo-nejm
HOBBYOP

2 years ago

this is what i have


theo-nejm
HOBBYOP

2 years ago

the appdata and lost+found came with the volume, they were not put by me


2 years ago

they came from the filebrowser software


theo-nejm
HOBBYOP

2 years ago

yes, so i put the file into the volume, right?


2 years ago

well lost+found is a linux thing, but that's besides the point


2 years ago

right


theo-nejm
HOBBYOP

2 years ago

and it proves i've used the 1 to set on root folder


2 years ago

yes it does


theo-nejm
HOBBYOP

2 years ago

because these folders does not appear when 0 is used


theo-nejm
HOBBYOP

2 years ago

so...


theo-nejm
HOBBYOP

2 years ago

the file is on the expected path


2 years ago

right


theo-nejm
HOBBYOP

2 years ago

so, it must be accessible on the application


theo-nejm
HOBBYOP

2 years ago

but its not


2 years ago

^


theo-nejm
HOBBYOP

2 years ago

look, this is my vscode

1286533275023704155


2 years ago

did you use nixpacks?


theo-nejm
HOBBYOP

2 years ago

this works


theo-nejm
HOBBYOP

2 years ago

the secrets is directly on root folder


theo-nejm
HOBBYOP

2 years ago

yes, i do use nixpacks


theo-nejm
HOBBYOP

2 years ago

i see something here


theo-nejm
HOBBYOP

2 years ago

that must be a problem


theo-nejm
HOBBYOP

2 years ago

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.

theo-nejm
HOBBYOP

2 years ago

files are not accessible during build


theo-nejm
HOBBYOP

2 years ago

does it counts to reading too?


2 years ago

did you tell me that you needed that file during build?


theo-nejm
HOBBYOP

2 years ago

i told you that my build were failing cause the file wasnt there


2 years ago

I get so many people using failed builds as a generic term for a crash at any stage, specifics are key


2 years ago

alright, how big is that file


theo-nejm
HOBBYOP

2 years ago

ok, imma be more specific


theo-nejm
HOBBYOP

2 years ago

2.34kb


2 years ago

since when are they that large?


theo-nejm
HOBBYOP

2 years ago

there are keys and stuff


theo-nejm
HOBBYOP

2 years ago

private keys to handshake


theo-nejm
HOBBYOP

2 years ago

they are long


theo-nejm
HOBBYOP

2 years ago

i tried to use envs instead, but didnt worked fine


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

2 years ago

i can try just bypass this error during build time also


2 years ago

just a thought, I forget how large variables can be, I think that should fit


theo-nejm
HOBBYOP

2 years ago

i dont like this strategy a lot, but its possible


2 years ago

why not?


theo-nejm
HOBBYOP

2 years ago

bypass things can hide another problems on the future


theo-nejm
HOBBYOP

2 years ago

for exemple, the file actually dont be there


2 years ago

oh you said you don't like your idea, try mine


theo-nejm
HOBBYOP

2 years ago

your idea is to encode b64 the file and decode this on the app?


2 years ago

yes


2 years ago

2.34kb worth of data should fit into a variable, but don't quote me on that


theo-nejm
HOBBYOP

2 years ago

3200 characters


theo-nejm
HOBBYOP

2 years ago

of b64


2 years ago

see what happens, it can't hurt


2 years ago

if you break railway I won't hold you accountable


theo-nejm
HOBBYOP

2 years ago

if my bill comes $ 1000 ill give it to you as a gift


2 years ago

well it's a good thing we don't bill for variables


theo-nejm
HOBBYOP

2 years ago

does anyone bills for variables? haha


theo-nejm
HOBBYOP

2 years ago

ima try this


2 years ago

I sure hope not


Welcome!

Sign in to your Railway account to join the conversation.

Loading...