Is it possible to download the docker image from a running railway app?
Hey, I need to download the docker image or at least the sql file inside it
Would it be possible to stop the server, add a on deploy command to download the sql file on my computer snd redeploy it?
The issue is that the sql file isn't the same as the one on my repo so I don't know if stopping the server and running it again would restore the sql file to it's git hub version
40 Replies
Project ID:
866079ee-0ce9-4a7d-8282-2e56ee9e6849
866079ee-0ce9-4a7d-8282-2e56ee9e6849
Please don't duplicate posts it looks like both your posts are about the same issue
Sorry
Would it be possible to keep a file in the docker when rebuilding?
It could also fix the issue since it wouldn't erase the db with the github one
why not host a proper postgres DB on railway? that way the data would persist, and then you could just access the data from your computer locally easily
no
It takes to much time to make requests and so makes my app crash
too much time? what do you mean by that
unless the latency was >1s or something it shouldn't just crater
When I used the railway postgress database, my app crashed no matter what timeout I gave to the workers
that sounds more like a misconfiguration with the connection details than a latency issue
The workaround I found was to then use a sqlite file instead
is this a django webapp by any chance?
It is
ah so you're using a sqlite3 db
Yes
yeah i've used django + railway's postgres, it works fine ime
just need to make sure the connection details are correct + the driver is set properly
The database worked fine
It just took too much time
So atm I'm stuck with a sqlite file being updated inside the railway docker...
hmmm yeah i did notice significantly higher latency vs something on the same subnet on a service like fly or aws
and since django makes a lot of db queries a slight increase in latency makes the perceived latency on your end a lot worse
And so every time I push to my gh repo it resets the db...
So I'm softlocked
yeaaaaaaaaaaaaa
hmmm
if you really want a better db experience i'd recommend a more network-optimized provider like fly.io, very similar in policy and setup to railway, uses nixpacks, etc etc
it's a little more complicated setup wise, their UX is not as smooth as railway for the non-experienced
but the DB latencies are way better
railway is also working on better private networking iirc
but im not sure of the timeline there
as kinda a last resort workaround you could make some sort of page in your admin panel that uploads the sqlite to gdrive or something
but that sounds kinda sketchy and 1 wrong step and all ur data gone
I can't update my Django admin page since that would mean pushing to gh... 😦
And so reseting the database...
catch-22
regardless if you want to access the container you'll need to install tailscale or something in it which will require a redeploy/reset
If redeploy doesn't reset the files from the Gh
I could maybe add a Deploy command to download the file or something?
That's very tricky tho
if you make an entrypoint.sh call in the dockerfile (if you're using one), you can download it there
pre-django start
i.e. the dockerfile ends with
and you have a shell script in ur repo that looks like
I don't think I have a docker file inside my Django app
The database you were hosting was it in the same region as your sever?
it's a sqlite3 flatfile
but it would have been if they were both on the same railway project right?
The postgress one? I don't know, I'm from Eu
Nah the normal dB he had
Whatever dB you chose make sure it's hosted in the usa
Otherwise your dB will be on the others side of the plannet
ah yeah, if it's not in railway make sure it's in us-west
that's where railway is based iirc
EU regions soon™️
I had the railway postgress one
So us hosted I guess
That would explain the delay
indeed
😦
yeah sorry about that, i don't think there's a super easy fix, if you want persistence you'll have to either
- make some super hacky/unstable workaround (probably not a good idea)
- switch to a postgres db hosted on railway (more latency)
- switch to a hosted db with another provider closer to where you live (more $$$)
And all of that would make me lose the db
correct
i dont think it will be possible to export/backup the db at this point, the container is isolated and you can't ssh in
😭☠️
Maybe a Railway dev could access it and so literally save my life
Spoiler they can't
Idk if I understand it properly but wouldn't this allow me to access my running docker files?
https://docs.railway.app/develop/cli#local-shell
Nvm...