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

a year 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?

201 Replies

theo-nejm
HOBBYOP

a year ago

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


a year ago

you would need to first upload the file with this -

and then move the volume over to your service


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

is that it?


a year ago

yes, read the software's docs please -


theo-nejm
HOBBYOP

a year ago

i did


theo-nejm
HOBBYOP

a year ago

but the content is not that familiar to me


theo-nejm
HOBBYOP

a year ago

how exactly do i use this?


theo-nejm
HOBBYOP

a year ago

ive deployd it


theo-nejm
HOBBYOP

a year ago

1286513782180544500


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

i see that i can access this on browser


theo-nejm
HOBBYOP

a year ago

but how will the dropped file go to my app?


a year ago

You will need to move the volume over to your app


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

for example


theo-nejm
HOBBYOP

a year ago

its located on src/firebase/constants


a year ago

you can create whatever folder structure you want


theo-nejm
HOBBYOP

a year ago

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


a year ago

not unless you want to


a year ago

do what works best for you


theo-nejm
HOBBYOP

a year ago

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


a year ago

disconnect it and connect it to your app's service


theo-nejm
HOBBYOP

a year ago

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


a year ago

no it is not


theo-nejm
HOBBYOP

a year ago

1286515907711209500


theo-nejm
HOBBYOP

a year ago

oh


theo-nejm
HOBBYOP

a year ago

imma do anything else then


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

so i need to put it anywhere else


a year ago

gotcha


theo-nejm
HOBBYOP

a year ago

so i need to change my application


a year ago

i dont see why you need to


theo-nejm
HOBBYOP

a year ago

where will be this file located?


theo-nejm
HOBBYOP

a year ago

on the path, right?


a year ago

wherever you uploaded it within the volume


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

aint i getting this correctly?


a year ago

the volume will be whereever you mount it


theo-nejm
HOBBYOP

a year ago

but i cant put this on root folder, right?


a year ago

correct, nor would you want to


a year ago

please read this -


theo-nejm
HOBBYOP

a year ago

will be useful thanks


theo-nejm
HOBBYOP

a year ago

it is exactly what i was saying lol


theo-nejm
HOBBYOP

a year ago

okay, now am I able to remove the filebrowser?


theo-nejm
HOBBYOP

a year ago

it still not being able to import the file


theo-nejm
HOBBYOP

a year ago

just to validate


theo-nejm
HOBBYOP

a year ago

I opened the filebrowser and dropped a file on root folder


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

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


a year ago

have you carefully read its overview?


theo-nejm
HOBBYOP

a year ago

yes, the content is short


a year ago

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


theo-nejm
HOBBYOP

a year ago

no problem 🙂


theo-nejm
HOBBYOP

a year ago

look


theo-nejm
HOBBYOP

a year ago

1286521745502769200


theo-nejm
HOBBYOP

a year ago

oh, probably i need to put this on dist


theo-nejm
HOBBYOP

a year ago

no, it still with the same problem


theo-nejm
HOBBYOP

a year ago

it is not working…


theo-nejm
HOBBYOP

a year ago

im probably doing something wrong here


a year ago

please read the template overview


theo-nejm
HOBBYOP

a year ago

i did


a year ago

slow down, read it again


theo-nejm
HOBBYOP

a year ago

the template doesnt say anything, basically


theo-nejm
HOBBYOP

a year ago

it just says what the template does


a year ago

yes it does, slow down, read it again


theo-nejm
HOBBYOP

a year ago

railway just crashed and its infinitly applying 3 changes


theo-nejm
HOBBYOP

a year ago

more than 5 minutes with that


theo-nejm
HOBBYOP

a year ago

1286525539900719000


theo-nejm
HOBBYOP

a year ago

applied, but it just dont work


theo-nejm
HOBBYOP

a year ago

i readed this 10 times, doesnt helped


a year ago

you are skim reading it


a year ago

to be clear, you should be reading this -


theo-nejm
HOBBYOP

a year ago

i did


theo-nejm
HOBBYOP

a year 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

a year ago

i was already using the root folder


theo-nejm
HOBBYOP

a year ago

but it is still not working


theo-nejm
HOBBYOP

a year ago

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


a year ago

you have that variable set to what value?


theo-nejm
HOBBYOP

a year ago

1


theo-nejm
HOBBYOP

a year ago

ive already tried with 0 and 1


theo-nejm
HOBBYOP

a year ago

none of them worked


a year 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

a year ago

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


a year ago

what did you mount the volume to


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

1286529048511512600


theo-nejm
HOBBYOP

a year ago

1286529094321705000


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

../.. points to root folder


a year ago

^


theo-nejm
HOBBYOP

a year ago

but what is wrong with that?


a year ago

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


theo-nejm
HOBBYOP

a year ago

the problem is not the import, is the platform


theo-nejm
HOBBYOP

a year ago

it is not clear how to do things


theo-nejm
HOBBYOP

a year ago

and the docs dont help


theo-nejm
HOBBYOP

a year ago

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


a year ago

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


a year ago

nothing Railway specific


theo-nejm
HOBBYOP

a year ago

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


a year ago

because you are doing something incorrectly


a year ago

^


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

the instructions to use the volumes are not clear


a year ago

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


theo-nejm
HOBBYOP

a year 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.


a year ago

yep


theo-nejm
HOBBYOP

a year ago

so…


theo-nejm
HOBBYOP

a year ago

i did it


theo-nejm
HOBBYOP

a year ago

and inside my volume, i created a secrets folder


theo-nejm
HOBBYOP

a year ago

it is on root, right?


a year ago

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


theo-nejm
HOBBYOP

a year ago

1286530467474182100


theo-nejm
HOBBYOP

a year ago

so…?


theo-nejm
HOBBYOP

a year ago

its specific from railway


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

is not normal path handle


theo-nejm
HOBBYOP

a year ago

and it still dont work


a year 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

a year ago

we are talking about 2 things that are specific


theo-nejm
HOBBYOP

a year ago

your template and railway


a year ago

a folder named /app is not specific to Railway


theo-nejm
HOBBYOP

a year ago

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


theo-nejm
HOBBYOP

a year ago

the thing is, im using a template created by u


a year ago

^


a year ago

… have you moved the volume over yet?


theo-nejm
HOBBYOP

a year ago

to my application? sure


a year ago

let's see


theo-nejm
HOBBYOP

a year ago

1286532037750030300


theo-nejm
HOBBYOP

a year ago

1286532141634683000


a year ago

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


theo-nejm
HOBBYOP

a year ago

yes, it is


theo-nejm
HOBBYOP

a year ago

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


a year ago

what did your app fail with


theo-nejm
HOBBYOP

a year ago

because its trying to import a file that does not exists


theo-nejm
HOBBYOP

a year ago

(the file provided by the volume)


a year ago

(the file provided by you)


theo-nejm
HOBBYOP

a year ago

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


a year ago

did you put it on the volume?


theo-nejm
HOBBYOP

a year ago

yes, using the file browser


a year ago

then it's on the volume


theo-nejm
HOBBYOP

a year ago

1286532601309560800


theo-nejm
HOBBYOP

a year ago

1286532646423232500


theo-nejm
HOBBYOP

a year ago

this is what i have


theo-nejm
HOBBYOP

a year ago

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


a year ago

they came from the filebrowser software


theo-nejm
HOBBYOP

a year ago

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


a year ago

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


a year ago

right


theo-nejm
HOBBYOP

a year ago

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


a year ago

yes it does


theo-nejm
HOBBYOP

a year ago

because these folders does not appear when 0 is used


theo-nejm
HOBBYOP

a year ago

so…


theo-nejm
HOBBYOP

a year ago

the file is on the expected path


a year ago

right


theo-nejm
HOBBYOP

a year ago

so, it must be accessible on the application


theo-nejm
HOBBYOP

a year ago

but its not


a year ago

^


theo-nejm
HOBBYOP

a year ago

look, this is my vscode

1286533275023704000


a year ago

did you use nixpacks?


theo-nejm
HOBBYOP

a year ago

this works


theo-nejm
HOBBYOP

a year ago

the secrets is directly on root folder


theo-nejm
HOBBYOP

a year ago

yes, i do use nixpacks


theo-nejm
HOBBYOP

a year ago

i see something here


theo-nejm
HOBBYOP

a year ago

that must be a problem


theo-nejm
HOBBYOP

a year 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

a year ago

files are not accessible during build


theo-nejm
HOBBYOP

a year ago

does it counts to reading too?


a year ago

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


theo-nejm
HOBBYOP

a year ago

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


a year ago

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


a year ago

alright, how big is that file


theo-nejm
HOBBYOP

a year ago

ok, imma be more specific


theo-nejm
HOBBYOP

a year ago

2.34kb


a year ago

since when are they that large?


theo-nejm
HOBBYOP

a year ago

there are keys and stuff


theo-nejm
HOBBYOP

a year ago

private keys to handshake


theo-nejm
HOBBYOP

a year ago

they are long


theo-nejm
HOBBYOP

a year ago

i tried to use envs instead, but didnt worked fine


a year 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

a year ago

i can try just bypass this error during build time also


a year ago

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


theo-nejm
HOBBYOP

a year ago

i dont like this strategy a lot, but its possible


a year ago

why not?


theo-nejm
HOBBYOP

a year ago

bypass things can hide another problems on the future


theo-nejm
HOBBYOP

a year ago

for exemple, the file actually dont be there


a year ago

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


theo-nejm
HOBBYOP

a year ago

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


a year ago

yes


a year ago

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


theo-nejm
HOBBYOP

a year ago

3200 characters


theo-nejm
HOBBYOP

a year ago

of b64


a year ago

see what happens, it can't hurt


a year ago

if you break railway I won't hold you accountable


theo-nejm
HOBBYOP

a year ago

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


a year ago

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


theo-nejm
HOBBYOP

a year ago

does anyone bills for variables? haha


theo-nejm
HOBBYOP

a year ago

ima try this


a year ago

I sure hope not


Loading...