How can I upload files to my application?

theo-nejm
HOBBY

9 months 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?

0 Replies

theo-nejm
HOBBY

9 months ago

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


9 months ago

you would need to first upload the file with this -

and then move the volume over to your service


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

is that it?


9 months ago

yes, read the software's docs please -


theo-nejm
HOBBY

9 months ago

i did


theo-nejm
HOBBY

9 months ago

but the content is not that familiar to me


theo-nejm
HOBBY

9 months ago

how exactly do i use this?


theo-nejm
HOBBY

9 months ago

ive deployd it


theo-nejm
HOBBY

9 months ago

1286513782180544500


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

i see that i can access this on browser


theo-nejm
HOBBY

9 months ago

but how will the dropped file go to my app?


9 months ago

You will need to move the volume over to your app


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

for example


theo-nejm
HOBBY

9 months ago

its located on src/firebase/constants


9 months ago

you can create whatever folder structure you want


theo-nejm
HOBBY

9 months ago

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


9 months ago

not unless you want to


9 months ago

do what works best for you


theo-nejm
HOBBY

9 months ago

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


9 months ago

disconnect it and connect it to your app's service


theo-nejm
HOBBY

9 months ago

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


9 months ago

no it is not


theo-nejm
HOBBY

9 months ago

1286515907711209500


theo-nejm
HOBBY

9 months ago

oh


theo-nejm
HOBBY

9 months ago

imma do anything else then


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

so i need to put it anywhere else


9 months ago

gotcha


theo-nejm
HOBBY

9 months ago

so i need to change my application


9 months ago

i dont see why you need to


theo-nejm
HOBBY

9 months ago

where will be this file located?


theo-nejm
HOBBY

9 months ago

on the path, right?


9 months ago

wherever you uploaded it within the volume


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

aint i getting this correctly?


9 months ago

the volume will be whereever you mount it


theo-nejm
HOBBY

9 months ago

but i cant put this on root folder, right?


9 months ago

correct, nor would you want to


9 months ago

please read this -


theo-nejm
HOBBY

9 months ago

will be useful thanks


theo-nejm
HOBBY

9 months ago

it is exactly what i was saying lol


theo-nejm
HOBBY

9 months ago

okay, now am I able to remove the filebrowser?


theo-nejm
HOBBY

9 months ago

it still not being able to import the file


theo-nejm
HOBBY

9 months ago

just to validate


theo-nejm
HOBBY

9 months ago

I opened the filebrowser and dropped a file on root folder


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

but it still not being available to access on my app.
am i forgetting something?


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

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


9 months ago

have you carefully read its overview?


theo-nejm
HOBBY

9 months ago

yes, the content is short


9 months ago

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


theo-nejm
HOBBY

9 months ago

no problem 🙂


theo-nejm
HOBBY

9 months ago

look


theo-nejm
HOBBY

9 months ago

1286521745502769200


theo-nejm
HOBBY

9 months ago

oh, probably i need to put this on dist


theo-nejm
HOBBY

9 months ago

no, it still with the same problem


theo-nejm
HOBBY

9 months ago

it is not working…


theo-nejm
HOBBY

9 months ago

im probably doing something wrong here


9 months ago

please read the template overview


theo-nejm
HOBBY

9 months ago

i did


9 months ago

slow down, read it again


theo-nejm
HOBBY

9 months ago

the template doesnt say anything, basically


theo-nejm
HOBBY

9 months ago

it just says what the template does


9 months ago

yes it does, slow down, read it again


theo-nejm
HOBBY

9 months ago

railway just crashed and its infinitly applying 3 changes


theo-nejm
HOBBY

9 months ago

more than 5 minutes with that


theo-nejm
HOBBY

9 months ago

1286525539900719000


theo-nejm
HOBBY

9 months ago

applied, but it just dont work


theo-nejm
HOBBY

9 months ago

i readed this 10 times, doesnt helped


9 months ago

you are skim reading it


9 months ago

to be clear, you should be reading this -


theo-nejm
HOBBY

9 months ago

i did


theo-nejm
HOBBY

9 months 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
HOBBY

9 months ago

i was already using the root folder


theo-nejm
HOBBY

9 months ago

but it is still not working


theo-nejm
HOBBY

9 months ago

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


9 months ago

you have that variable set to what value?


theo-nejm
HOBBY

9 months ago

1


theo-nejm
HOBBY

9 months ago

ive already tried with 0 and 1


theo-nejm
HOBBY

9 months ago

none of them worked


9 months 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
HOBBY

9 months ago

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


9 months ago

what did you mount the volume to


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

1286529048511512600


theo-nejm
HOBBY

9 months ago

1286529094321705000


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

../.. points to root folder


9 months ago

^


theo-nejm
HOBBY

9 months ago

but what is wrong with that?


9 months ago

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


theo-nejm
HOBBY

9 months ago

the problem is not the import, is the platform


theo-nejm
HOBBY

9 months ago

it is not clear how to do things


theo-nejm
HOBBY

9 months ago

and the docs dont help


theo-nejm
HOBBY

9 months ago

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


9 months ago

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


9 months ago

nothing Railway specific


theo-nejm
HOBBY

9 months ago

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


9 months ago

because you are doing something incorrectly


9 months ago

^


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

the instructions to use the volumes are not clear


9 months ago

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


theo-nejm
HOBBY

9 months 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.


9 months ago

yep


theo-nejm
HOBBY

9 months ago

so…


theo-nejm
HOBBY

9 months ago

i did it


theo-nejm
HOBBY

9 months ago

and inside my volume, i created a secrets folder


theo-nejm
HOBBY

9 months ago

it is on root, right?


9 months ago

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


theo-nejm
HOBBY

9 months ago

1286530467474182100


theo-nejm
HOBBY

9 months ago

so…?


theo-nejm
HOBBY

9 months ago

its specific from railway


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

is not normal path handle


theo-nejm
HOBBY

9 months ago

and it still dont work


9 months 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
HOBBY

9 months ago

we are talking about 2 things that are specific


theo-nejm
HOBBY

9 months ago

your template and railway


9 months ago

a folder named /app is not specific to Railway


theo-nejm
HOBBY

9 months ago

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


theo-nejm
HOBBY

9 months ago

the thing is, im using a template created by u


9 months ago

^


9 months ago

… have you moved the volume over yet?


theo-nejm
HOBBY

9 months ago

to my application? sure


9 months ago

let's see


theo-nejm
HOBBY

9 months ago

1286532037750030300


theo-nejm
HOBBY

9 months ago

1286532141634683000


9 months ago

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


theo-nejm
HOBBY

9 months ago

yes, it is


theo-nejm
HOBBY

9 months ago

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


9 months ago

what did your app fail with


theo-nejm
HOBBY

9 months ago

because its trying to import a file that does not exists


theo-nejm
HOBBY

9 months ago

(the file provided by the volume)


9 months ago

(the file provided by you)


theo-nejm
HOBBY

9 months ago

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


9 months ago

did you put it on the volume?


theo-nejm
HOBBY

9 months ago

yes, using the file browser


9 months ago

then it's on the volume


theo-nejm
HOBBY

9 months ago

1286532601309560800


theo-nejm
HOBBY

9 months ago

1286532646423232500


theo-nejm
HOBBY

9 months ago

this is what i have


theo-nejm
HOBBY

9 months ago

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


9 months ago

they came from the filebrowser software


theo-nejm
HOBBY

9 months ago

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


9 months ago

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


9 months ago

right


theo-nejm
HOBBY

9 months ago

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


9 months ago

yes it does


theo-nejm
HOBBY

9 months ago

because these folders does not appear when 0 is used


theo-nejm
HOBBY

9 months ago

so…


theo-nejm
HOBBY

9 months ago

the file is on the expected path


9 months ago

right


theo-nejm
HOBBY

9 months ago

so, it must be accessible on the application


theo-nejm
HOBBY

9 months ago

but its not


9 months ago

^


theo-nejm
HOBBY

9 months ago

look, this is my vscode

1286533275023704000


9 months ago

did you use nixpacks?


theo-nejm
HOBBY

9 months ago

this works


theo-nejm
HOBBY

9 months ago

the secrets is directly on root folder


theo-nejm
HOBBY

9 months ago

yes, i do use nixpacks


theo-nejm
HOBBY

9 months ago

i see something here


theo-nejm
HOBBY

9 months ago

that must be a problem


theo-nejm
HOBBY

9 months 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
HOBBY

9 months ago

files are not accessible during build


theo-nejm
HOBBY

9 months ago

does it counts to reading too?


9 months ago

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


theo-nejm
HOBBY

9 months ago

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


9 months ago

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


9 months ago

alright, how big is that file


theo-nejm
HOBBY

9 months ago

ok, imma be more specific


theo-nejm
HOBBY

9 months ago

2.34kb


9 months ago

since when are they that large?


theo-nejm
HOBBY

9 months ago

there are keys and stuff


theo-nejm
HOBBY

9 months ago

private keys to handshake


theo-nejm
HOBBY

9 months ago

they are long


theo-nejm
HOBBY

9 months ago

i tried to use envs instead, but didnt worked fine


9 months 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
HOBBY

9 months ago

i can try just bypass this error during build time also


9 months ago

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


theo-nejm
HOBBY

9 months ago

i dont like this strategy a lot, but its possible


9 months ago

why not?


theo-nejm
HOBBY

9 months ago

bypass things can hide another problems on the future


theo-nejm
HOBBY

9 months ago

for exemple, the file actually dont be there


9 months ago

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


theo-nejm
HOBBY

9 months ago

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


9 months ago

yes


9 months ago

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


theo-nejm
HOBBY

9 months ago

3200 characters


theo-nejm
HOBBY

9 months ago

of b64


9 months ago

see what happens, it can't hurt


9 months ago

if you break railway I won't hold you accountable


theo-nejm
HOBBY

9 months ago

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


9 months ago

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


theo-nejm
HOBBY

9 months ago

does anyone bills for variables? haha


theo-nejm
HOBBY

9 months ago

ima try this


9 months ago

I sure hope not


How can I upload files to my application? - Railway Help Station