R
Railway6mo ago
Kriim

what is egress why are my costs going so high

I am using hobby plan of railway for a small django web application suddenly billing started to go higher and higher its egress what is egress? I have chosen 5 dollar plan i cannot pay more than that!
137 Replies
Percy
Percy6mo ago
Project ID: 70164d65-198b-405f-b20d-8423b1e71b1e
Kriim
Kriim6mo ago
70164d65-198b-405f-b20d-8423b1e71b1e
Kriim
Kriim6mo ago
No description
Brody
Brody6mo ago
egress is a fancy work for outgoing network traffic. you are likely paying for that because you are connecting to your database over the public network, instead connect to it via the private network, use the private url variable
Kriim
Kriim6mo ago
Any tutorial video for that ? I am using postgresql
Adam
Adam6mo ago
You will have received emails alerting you to change this over the past few months
Kriim
Kriim6mo ago
I have subscribed today
Adam
Adam6mo ago
change your database url link to the private networking link. You can find it in your database service’s environment variables
Brody
Brody6mo ago
no videos, but there are docs this shows you the variable you want to use https://docs.railway.app/guides/postgresql#private-networking this shows you how to use it https://docs.railway.app/guides/variables#referencing-another-services-variable this shows you where to set it https://docs.railway.app/guides/variables#service-variables
Adam
Adam6mo ago
You can also set spending limits if you have a hard cap on what you would like to be charged
Kriim
Kriim6mo ago
I have put spending limits but It will be hit in a few days because of egress
Adam
Adam6mo ago
Great, then get rid of your egress charges by following the links above
Brody
Brody6mo ago
get rid of your future database egress charges** 🙂
Kriim
Kriim6mo ago
could not translate host name "postgres.railway.internal" to address: Name or service not known Do i have to put here the host from database variable ?
Brody
Brody6mo ago
can you try adding a 3 second sleep to your start command?
Kriim
Kriim6mo ago
Its gunicorn command i dont understand what you mean But i could add a custom command If you can tell Custom start command
Brody
Brody6mo ago
how are you currently setting the gunicorn start command?
Kriim
Kriim6mo ago
Its automatically started I am not using custom start command
Brody
Brody6mo ago
you dont have a Procfile or railway.json?
Kriim
Kriim6mo ago
I have Procfile
Brody
Brody6mo ago
send the procfile please
Kriim
Kriim6mo ago
web: gunicorn dostana.wsgi —log-file -
Brody
Brody6mo ago
change it to
web: sleep 3 && gunicorn dostana.wsgi —log-file -
web: sleep 3 && gunicorn dostana.wsgi —log-file -
Kriim
Kriim6mo ago
OperationalError at / could not translate host name "postgres.railway.internal" to address: Name or service not known Request Method: GET Request URL:
Django Version: 5.0.1 Exception Type: OperationalError Exception Value:
could not translate host name "postgres.railway.internal" to address: Name or service not known Exception Location: /opt/venv/lib/python3.11/site-packages/psycopg2/init.py, line 122, in connec
Kriim
Kriim6mo ago
Same Error What should i do
Brody
Brody6mo ago
build logs please
Kriim
Kriim6mo ago
Any tutorial for it ? Video or document ?
Brody
Brody6mo ago
there are 3 steps on the page
Kriim
Kriim6mo ago
i am using firefox
Brody
Brody6mo ago
it works with firefox
Kriim
Kriim6mo ago
No description
Kriim
Kriim6mo ago
I am here i bookmarked That link now what ?
Brody
Brody6mo ago
you did not follow the instructions, you bookmarked the web page, please follow the instruction on the page
Kriim
Kriim6mo ago
alright I got the logs Should i send it here ? .log file ?
Brody
Brody6mo ago
yes
Kriim
Kriim6mo ago
Here It is
Brody
Brody6mo ago
build logs please
Kriim
Kriim6mo ago
Here Web is down users are putting pressure on me
Brody
Brody6mo ago
screenshot of your railway project please
Kriim
Kriim6mo ago
No description
Brody
Brody6mo ago
where is the database?
Kriim
Kriim6mo ago
No description
Kriim
Kriim6mo ago
No description
Brody
Brody6mo ago
your database needs to be in the same project as the app that is accessing it, otherwise you will not be able to use the private network to connect to it
Kriim
Kriim6mo ago
I didn’t understand what you mean Alright But can I transfer It ? Transfer that database inside my project Because it contains data now And i don’t wanna now take backup and restore Inside my project
Brody
Brody6mo ago
thats a semi manual process - create a new database in your mucho-knot project - deploy the Postgres Plugin Migration template into your mucho-knot project - the PLUGIN_URL variable will be the public url of the database from your workable-trucks project - the NEW_URL will be the url of the new database you just created - deploy it
Kriim
Kriim6mo ago
From where How to get old database plugin url
Brody
Brody6mo ago
copy it from the variables tab
Kriim
Kriim6mo ago
By which name It will be available
Brody
Brody6mo ago
please check my steps
Kriim
Kriim6mo ago
No description
Kriim
Kriim6mo ago
Alright Got it It would be database url
Brody
Brody6mo ago
yep
Kriim
Kriim6mo ago
I will let it deploy the plugin after that is it okay to delete that plugin?
Brody
Brody6mo ago
as long as you confirm your data has made it to the new database you deployed in the mucho-knot project, then yes
Kriim
Kriim6mo ago
What about sleep Command Should i remove it ?
Brody
Brody6mo ago
its still needed
Kriim
Kriim6mo ago
Lets see Project is building
Brody
Brody6mo ago
can you send a new screenshot of the mucho-knot project please
Kriim
Kriim6mo ago
No description
Brody
Brody6mo ago
looks good have you used the migration template yet?
Kriim
Kriim6mo ago
No I subscribed today Will i get 0 inges cost now ? No I used that plugin Got data transferred Alright its working But too slow Idk why
Brody
Brody6mo ago
are you sure you are using variable references?
Kriim
Kriim6mo ago
Yes its working No I mean its working Posts are showing People are online Its connected that’s why it is working
Brody
Brody6mo ago
but are you are using variable references for the database url?
Kriim
Kriim6mo ago
Alright now its fine It has plain data in it Its alright My github repo is private
Brody
Brody6mo ago
sorry that doesn’t quite answer the question
Kriim
Kriim6mo ago
No just copy pasted private db url
Brody
Brody6mo ago
please do not do that, use variable references instead
Kriim
Kriim6mo ago
Why ? will it work with variable reference?
Brody
Brody6mo ago
you never want to hardcode the url variable
Kriim
Kriim6mo ago
Should i use variable like hostname pguser etc Instead of credentials?
Brody
Brody6mo ago
you should use variable references
Kriim
Kriim6mo ago
I used them I put info correctly
Brody
Brody6mo ago
im not sure you did, please read these docs pages
Kriim
Kriim6mo ago
The user hostname password Speed of website is fine now
Brody
Brody6mo ago
im only trying to help you do it the right way
Kriim
Kriim6mo ago
Dude i tried but I couldn’t understand those Docs
Brody
Brody6mo ago
there is examples to look at this is a variable reference
DATABASE_URL=${{Postgres.DATABASE_PRIVATE_URL}}
DATABASE_URL=${{Postgres.DATABASE_PRIVATE_URL}}
Kriim
Kriim6mo ago
I am connecting it by using Dj celery Instead of url Should i put that their ? This ?
Brody
Brody6mo ago
its okay, its works for now, thats all that matters right now
Kriim
Kriim6mo ago
Yes i will learn eventually But will it affect billing or performance? By not using those variables?
Brody
Brody6mo ago
i dont know if you are using the correct variable, so i cant say, sorry
Kriim
Kriim6mo ago
What about Egrees cost Will it be 0 ?
Brody
Brody6mo ago
it will never be zero, the app itself will always have egress costs since its a web site
Kriim
Kriim6mo ago
But what will be my end bill 5$ ? I was using a vps before this railway a ubuntu vps it was 6 euro per month fixed cost 4 core 8gb ram and 800gb ssd
Brody
Brody6mo ago
i cant say that either, i dont know how much resources your app will use by the end of the month cost is based on resource usage
Kriim
Kriim6mo ago
What is fixed price ? Don’t it have a fixed price ?
Brody
Brody6mo ago
railway does not have fixed pricing
Kriim
Kriim6mo ago
What is 5$ worth of usage and 5$ base plan price
Brody
Brody6mo ago
you pay 5$ for the account, you get $5 towards usage every month, and then you are charged for any resource usage above 5$
Kriim
Kriim6mo ago
Alright lets see where it goes What about additional storage Above than 100gb What are costs For that For additional 100gb lets say
Brody
Brody6mo ago
you do not want to use the container storage for this (that is referring to the 100gb) for anything but short lived temp files, becuase any files you saved there will be removed on the next deploy, for persistent storage you want to use a volume https://docs.railway.app/guides/volumes hobby users get a 5gb volume
Kriim
Kriim6mo ago
Alright should i create that too inside My project?
Brody
Brody6mo ago
you would need to create the volume attached to the web service itself
Kriim
Kriim6mo ago
Are their any additional steps for configuring it or it will be utilised automatically
Brody
Brody6mo ago
your code would need to save the files to the volume's mount point
Kriim
Kriim6mo ago
In django settings file ? What if I don’t create a volume It has 100gb space
Brody
Brody6mo ago
then any files you save to disk will be removed on the next deploy are you saving any files to disk?
Kriim
Kriim6mo ago
Omg Now i understand Why pictures of users were not showing Alright let’s create a volume
Brody
Brody6mo ago
because you where saving them to the ephemeral container storage
Kriim
Kriim6mo ago
That container is 100gb ? Why so big size Just for temp files
Brody
Brody6mo ago
big temp files
Kriim
Kriim6mo ago
No description
Kriim
Kriim6mo ago
Django with volume support Should i select that ?
Brody
Brody6mo ago
nope, thats a template
Kriim
Kriim6mo ago
I am creating volume inside my mucho proj
Brody
Brody6mo ago
you need to right click the web service and attach a volume
Kriim
Kriim6mo ago
100gb volume price ?
Brody
Brody6mo ago
hobby users can only make 5gb volumes
Kriim
Kriim6mo ago
Can i use external Storage than ? Buy from somewhere else
Brody
Brody6mo ago
yeah you can use things like cloudflare r2, cloudinary
Kriim
Kriim6mo ago
What would be price of that
Brody
Brody6mo ago
that isnt disk storage though thats something you could need to check cloudflare/cloudinary for
Kriim
Kriim6mo ago
I want to store pictures and videos uploaded by users Its a social media site basically
Brody
Brody6mo ago
then cloudinary is probably your best bet
Kriim
Kriim6mo ago
Cheapest solution I am not earning any money from site
Brody
Brody6mo ago
you would need to check on cloudinary's pricing page
Kriim
Kriim6mo ago
Its just my hobby Mount path Of volume should i set /. A slash
Brody
Brody6mo ago
definitely not, id recommend /app/media
Kriim
Kriim6mo ago
Its /media folder Inside my django projext
Brody
Brody6mo ago
yes and your app is placed inside of an /app folder
Kriim
Kriim6mo ago
Should i set Media folder Path here ?
Brody
Brody6mo ago
/app/media
Kriim
Kriim6mo ago
Alright i am setting This exact path What if i want to Delete data from volume When it fill up Volume name is dog-volume 🤣🤣
Brody
Brody6mo ago
your code would need to provide a way to delete data from the volume auto generated
Kriim
Kriim6mo ago
I know But can i access Using command line Like ubuntu vps uses command line
Brody
Brody6mo ago
nope thats not how railway works right now, all file access has to be done via the service its attached to
Kriim
Kriim6mo ago
Alright thanks for helping me where can i tell that Brody helped me And guided me alot
Brody
Brody6mo ago
where can i tell that Brody helped me
Alright thanks for helping me
you just did
Kriim
Kriim6mo ago
Alright but they should hire you as a tech support guy You would be a great fit for it
Brody
Brody6mo ago
not qualified, but thank you ❤️
Kriim
Kriim6mo ago
It is truth Your experience in this railway app can help alot of users it will increase railway growth
Brody
Brody6mo ago
thank you