Doubts about pricing
magicmike123
HOBBYOP

2 years ago

Hi, Im considering going for the Hobby or Pro plan for a express backend application I have. But I have doubts about what are going to be the pricing limits, its not clear to me how does it exactly works when it reads "pricing based on resources usage", for example, if I use the Hobby plan, is there a certain limit that its just not gonna go above or what can I do? Im scared of paying for the plan but receiving, idk, a charge of 500$ or something crazy because of "resource usage", do you know what I mean? Can anyone clarify me how it works? Also if it helps, I would at the very least need 8 GB of RAM and 1 CPU, if anything probably even more resources but that would be bare minimum to start with.

Closed

458 Replies

magicmike123
HOBBYOP

2 years ago

N/A


2 years ago

for starters, will your application actually be using 8GB 24/7?


magicmike123
HOBBYOP

2 years ago

Btw a good thing to mention is that I dont need database, I already have that somewhere else (im using mongoDB atlas)


magicmike123
HOBBYOP

2 years ago

Well, not 24/7 but... maybe about, idk, lets say 12 hours of the 24 hours, since will be many people using, like on average, maybe half the time yeah, maybe even more.


2 years ago

so then let's say an average of about 4GB ?


magicmike123
HOBBYOP

2 years ago

yeah


magicmike123
HOBBYOP

2 years ago

lets say that for now


magicmike123
HOBBYOP

2 years ago

and 1 CPU as well just to say something decent there


2 years ago

then that's $60 before you factor in egress and seat costs


magicmike123
HOBBYOP

2 years ago

so the resource usage is calculated with this, and only this? no "hidden surprises" then?

1303750051704733737


magicmike123
HOBBYOP

2 years ago

i mean that, and the plan, right?


2 years ago

the only hidden surprise would be not understanding how pricing works I guess


2 years ago

but yeah, that usage based pricing, and the seat cost for pro


magicmike123
HOBBYOP

2 years ago

right


magicmike123
HOBBYOP

2 years ago

About network usage, I expect each user will spend about 1 GB per day or so, and lets say I have like 500 users


2 years ago

unlike a VPS, on Railway you only pay for the resources you actually use, so if your app uses 0.1 vcpu and 500mb of memory, 99% of the time, then you are going to pay significantly less than $60


2 years ago

it's not about users, it's about how much YOUR app uses


magicmike123
HOBBYOP

2 years ago

ah right, nice


2 years ago

so you will be paying to talk to atlas


2 years ago

in the form of egress


magicmike123
HOBBYOP

2 years ago

about network usage, what if some hacker basically spamms my app as much as possible, can I somehow set up a hard limit for network? so that I dont get charged crazy


2 years ago

you can set a hard limit on spend, you can't set a hard limit on network usage though


magicmike123
HOBBYOP

2 years ago

yes I think mostly this will be, mongoDB atlas data fetching will be 90% of network activity, correct


magicmike123
HOBBYOP

2 years ago

so how do I do if theres some hacker actually?


2 years ago

you don't pay for ingress, so there's no cost in getting data from atlas, but you will pay to send data to atlas


magicmike123
HOBBYOP

2 years ago

ah... wait, ingress and egress


magicmike123
HOBBYOP

2 years ago

Its first time I hear about this


2 years ago

use Cloudflare and setup some rules so no bad traffic makes it to your app


magicmike123
HOBBYOP

2 years ago

so basically i only get charged for "sending" data to DB, not fetching data from DB?


magicmike123
HOBBYOP

2 years ago

cause if so its fine


magicmike123
HOBBYOP

2 years ago

cause im caching most of the data once its sent to DB once per hour


magicmike123
HOBBYOP

2 years ago

but they might request the DB data (already cached once per hour) like idk, 100 times per hour lets say idk, big ingress activity, that no extra charge you tell me, right?


2 years ago

basically, in reality fetching data from the database still has a little egress since you are still sending outgoing traffic to the database to tell it what data you want, but for all intensive purposes you can ignore that cost since it's little


2 years ago

correct, we do not charge for ingress


magicmike123
HOBBYOP

2 years ago

right, lets say I bring cached data from the DB, lets say its 500 mb of data. How much would it be approximately then, maybe like 1 MB of data egress there?


2 years ago

far less than 1MB, if your call to the database uses 1MB you're doing something really wrong lol


magicmike123
HOBBYOP

2 years ago

oh okey, so normal request less than 1 MB, nice. Idk im asking cause im new to hosting providers heavy deployments in general


magicmike123
HOBBYOP

2 years ago

well heavy in my terms, my app is heavier than any other i done before int erms of data processing etc


2 years ago

may I ask what tech stack?


magicmike123
HOBBYOP

2 years ago

yes 🙂


magicmike123
HOBBYOP

2 years ago

express JS with mongoDB atlas (talking backend only)


magicmike123
HOBBYOP

2 years ago

frontend is react


magicmike123
HOBBYOP

2 years ago

but frontend will be somewhere else


magicmike123
HOBBYOP

2 years ago

here I wanna put backend


magicmike123
HOBBYOP

2 years ago

the most important is backend surely


2 years ago

what does the backend do to make you think it will be using on average 4GB?


magicmike123
HOBBYOP

2 years ago

well, it takes 3 million auction house objects with like 20 fields each of the objects. then does multiple filtering and stuff like that


magicmike123
HOBBYOP

2 years ago

virtual economy stuff, cryptocurrency games, an API for getting prices, its very heavy tho yeah you see, huge amount of data


magicmike123
HOBBYOP

2 years ago

maybe it wont average 4 GB idk


magicmike123
HOBBYOP

2 years ago

but Im expecting lets say 250 users a day on average


magicmike123
HOBBYOP

2 years ago

lets say they use the app on average for 8 hours


magicmike123
HOBBYOP

2 years ago

and each hour the data is cached so data processing wont be that crazy but still some custom filters will be applied and they will be fetching each hour like 500 MB of data to the frontend, thats assuming they dont reload the page, if they do a few times, then re-fetch the cached data, imagine.


magicmike123
HOBBYOP

2 years ago

something like that, what you think would be realistically good to go for?


magicmike123
HOBBYOP

2 years ago

and what expcted cost?


2 years ago

cache is definitely gonna reduce costs for sure


2 years ago

I'd say under a $100 but that's not a promise


magicmike123
HOBBYOP

2 years ago

ah right sounds ok


magicmike123
HOBBYOP

2 years ago

yeah sure thanks good cache exists man


magicmike123
HOBBYOP

2 years ago

otherwise i be selling my leg or something 😄


magicmike123
HOBBYOP

2 years ago

hahah


2 years ago

but I will say your usecase is pro, not hobby


magicmike123
HOBBYOP

2 years ago

right


magicmike123
HOBBYOP

2 years ago

pro sounds powerful it has up to 32 GB of RAM, and 32 CPUs, that sounds epic but, im scared of the cost


2 years ago

you can still set a $100 spend limit


magicmike123
HOBBYOP

2 years ago

I would rather limit the RAM to 12 or 16 GBs to make sure it doesnt get bruteforced by some guy spamming the page on 5 different devices or some sht xD


2 years ago

you can do that too


magicmike123
HOBBYOP

2 years ago

and probably 4 CPUs is more than enough i think


2 years ago

just know that your app will crash when it reaches the memory limit you set


magicmike123
HOBBYOP

2 years ago

yeah thats fine, i mean rather that than 500$ bill


2 years ago

well a $500 bill would be impossible given you will set a spend limit


magicmike123
HOBBYOP

2 years ago

how much could an app cost with these settings: 16 GB of RAM, 4 CPUs, and if total goes over 100$ per month (whatever it is, either RAM, CPUs, network, etc.) just automatically close the server, like, crash it. will that even work?


magicmike123
HOBBYOP

2 years ago

not sure of the CPUs tho, how powerful are they? theres many typesof CPUs nowadays


2 years ago

well over $200, but if your application is using that much then hopefully with that amount of traffic it equates to a good amount of revenue haha.

if you hit a spend limit your application will be shut down.


2 years ago

they are xeon cpus


magicmike123
HOBBYOP

2 years ago

right 🙂 i mean long story short this works on % of users which makes sense


magicmike123
HOBBYOP

2 years ago

what xeon cpus may I ask? i mean what model so I can look up the specs


2 years ago

I don't know off the top of my head, sorry


magicmike123
HOBBYOP

2 years ago

ah


magicmike123
HOBBYOP

2 years ago

but do you have maybe some reference with like the year they got released or the Ghz they are using... i mean how fast/slow they are, some sort of reference


2 years ago

I know they are Cascade Lake @2.8GHz


magicmike123
HOBBYOP

2 years ago

oh okey


magicmike123
HOBBYOP

2 years ago

so anyways what happens if I start little?


magicmike123
HOBBYOP

2 years ago

lets say I start with hobby plan so its max 8 GB of RAM and 8 CPU


magicmike123
HOBBYOP

2 years ago

can I then if in the future I get more people, just click on pro and it changes plan instantly or is it complicated to change plans?


magicmike123
HOBBYOP

2 years ago

if I move on to pro I would still be limiting 100% to like, max 16 GB RAM and probably still 8 CPUs or something


2 years ago

yeah you buy pro and then it will ask you what projects you want to put on the pro plan


magicmike123
HOBBYOP

2 years ago

and then it will re-launch my hobby plan project with pro instead and thats it?


magicmike123
HOBBYOP

2 years ago

i mean, that simple is it?


2 years ago

you will need to do the relaunch yourself but yes


2 years ago

and youll need to set the spend limits up on your pro workspace again, since the personal hobby plan and pro plans are treated as separate workspaces under the same account


magicmike123
HOBBYOP

2 years ago

ah nice


magicmike123
HOBBYOP

2 years ago

and btw out of curiosity, all this was me asking about backend but do you ever deploy here like, frontend apps, or nah?


magicmike123
HOBBYOP

2 years ago

cause im wondering about the cost of deploying the frontend. the frontend codebase isnt too big its kinda small, its mostly a big datatable with pagination that will fetch like, 500 MB of data and user can play around with the data, filter it locally, etc.


magicmike123
HOBBYOP

2 years ago

should be cheaper than the backend, right?


2 years ago

oh yes we deploy frontends all the time on railway!

our docs site is frontend hosted on railway! -


2 years ago

and we even have a guide for hosting a react frontend app on railway! -


magicmike123
HOBBYOP

2 years ago

but is much cheaper than backend right?


2 years ago

if you have cloudflare in front for cache yes


magicmike123
HOBBYOP

2 years ago

never used cloudflare, lets assume i dont use it


magicmike123
HOBBYOP

2 years ago

i mean frontend is chill is just showing DB data for the most part, a few register and login simple stuff also but thats it


magicmike123
HOBBYOP

2 years ago

its like, 5 page app


2 years ago

then you only pay for the tiny amount of cpu and mem, like 0.1 vcpu and 40mb of mem (if done right), and the egress it takes to send the web page, and page assets


magicmike123
HOBBYOP

2 years ago

ah great


magicmike123
HOBBYOP

2 years ago

okey so I think im decided: first thing I wanna do is deploy my backend from my github repository on the hobby plan, to start with that 🙂


magicmike123
HOBBYOP

2 years ago

@Brody does this work as a limit?

1303764251500085248


magicmike123
HOBBYOP

2 years ago

I think I could start with 10 USD just to test around


2 years ago

yes it would act as a limit, but i highly recommend you sign up for the usage based plan


magicmike123
HOBBYOP

2 years ago

but why tho if I just wanna like, start doing some tests


2 years ago

counter question, why do you think prepaid is better for that?


magicmike123
HOBBYOP

2 years ago

cause nobody can hack the usage further


2 years ago

i think ive mentioned several times in this thread that you can set a spend limit


magicmike123
HOBBYOP

2 years ago

ah sorry, you meant with the other subscription as well? okey


magicmike123
HOBBYOP

2 years ago

makes sense then to go for the other


2 years ago

prepaid is not the way to go, its just headaches


magicmike123
HOBBYOP

2 years ago

done 🙂

1303765930714599454


magicmike123
HOBBYOP

2 years ago

how do I change name here to a more fitting name?

1303766579087020075


2 years ago

in the project settings


magicmike123
HOBBYOP

2 years ago

okey nice


magicmike123
HOBBYOP

2 years ago

so I try import from github repo and it throws me this error:

1303766918636900534


2 years ago

is the repo name longer than 32 chars?



magicmike123
HOBBYOP

2 years ago

yeah it seems


2 years ago

then you will need to create an empty service and then add the repo


magicmike123
HOBBYOP

2 years ago

ah, okey


2 years ago

click the + create button


2 years ago

then you can add the repo in the service settings


magicmike123
HOBBYOP

2 years ago

okey 🙂 nice


magicmike123
HOBBYOP

2 years ago

i also added the env variables now


magicmike123
HOBBYOP

2 years ago

deploy command I see here


magicmike123
HOBBYOP

2 years ago

should be npm install right? its an express app


magicmike123
HOBBYOP

2 years ago

no build command or anything like that in express apps


magicmike123
HOBBYOP

2 years ago

@Brody


2 years ago

nixpacks will set a install command for you, you shouldnt use npm install


magicmike123
HOBBYOP

2 years ago

ah okey nice


magicmike123
HOBBYOP

2 years ago

i clicked on deploy


magicmike123
HOBBYOP

2 years ago

as i was waiting


magicmike123
HOBBYOP

2 years ago

it says deployment successful 🙂


2 years ago

pog


magicmike123
HOBBYOP

2 years ago

😄


magicmike123
HOBBYOP

2 years ago

but idk what to do now idk whats my backend url


2 years ago

go to the service settings and get one


magicmike123
HOBBYOP

2 years ago

on generate domain?


magicmike123
HOBBYOP

2 years ago

ooh, here I can limit the stuff yes?

1303769992109625445


2 years ago

yep, but remember what i said, if your app ends up reaching those limits its just gonna crash loop


magicmike123
HOBBYOP

2 years ago

I usually run on port 3500 on localhost, not sureif here will cause trouble:

1303770687290212412


magicmike123
HOBBYOP

2 years ago

yeah


magicmike123
HOBBYOP

2 years ago

okey look


2 years ago

as long as you point the domain to the correct port youre good


magicmike123
HOBBYOP

2 years ago

I made 1 hit to my super heavy endpoint


magicmike123
HOBBYOP

2 years ago

1303770890345123931


magicmike123
HOBBYOP

2 years ago

it took 2 minutes and 16 seconds which is not bad for a start


magicmike123
HOBBYOP

2 years ago

i will try hit it again, now it will use cached data


2 years ago

okay now try on our metal hardware


magicmike123
HOBBYOP

2 years ago

no no but wait lets go slow step by step


2 years ago

haha


magicmike123
HOBBYOP

2 years ago

this is unironically good btw


magicmike123
HOBBYOP

2 years ago

yeah


magicmike123
HOBBYOP

2 years ago

in my PC it takes like 1 min 20 seconds


magicmike123
HOBBYOP

2 years ago

but my PC is my PC, my PC is powerful anyways


magicmike123
HOBBYOP

2 years ago

so this is like positive


magicmike123
HOBBYOP

2 years ago

let me see how it does with cache now


magicmike123
HOBBYOP

2 years ago

cache might take similar time anyways but still, just to make sure it works with that too


2 years ago

yeah thats why i wanted you to try on metal, the metal region has a better cpu than what you are currently running on


magicmike123
HOBBYOP

2 years ago

we will get there, but step by step, we go slow, i like to test cheapest then scale progressively, lets go slow.


2 years ago

its the same price


magicmike123
HOBBYOP

2 years ago

okey cache took 1 min 50 s, thats not bad


magicmike123
HOBBYOP

2 years ago

oh its same price?


2 years ago

yeah of course


magicmike123
HOBBYOP

2 years ago

wait, better CPU but same price? whats the catch?


2 years ago

you cant use volumes on it yet


magicmike123
HOBBYOP

2 years ago

what are volumes?


2 years ago


magicmike123
HOBBYOP

2 years ago

so it reads: "Volumes allow you to store persistent data for services on Railway", but I already have my mongoDB for cache, rigth?


2 years ago

yeah but volumes are for file storage


2 years ago

not applicable to you, but you asked so i answered


magicmike123
HOBBYOP

2 years ago

ah


magicmike123
HOBBYOP

2 years ago

anyways about the better CPU we were talking, how can I get better CPU for same price sorry?


2 years ago

switch to a region marked metal in your service settings


magicmike123
HOBBYOP

2 years ago

oh I see


magicmike123
HOBBYOP

2 years ago

i change and redeploy, lets see, so metal always better, I always choose metal yes? 🙂


2 years ago

it should be better, those machines use much newer CPUs


magicmike123
HOBBYOP

2 years ago

nice 🙂


magicmike123
HOBBYOP

2 years ago

okey lets give it a moment its deploying


magicmike123
HOBBYOP

2 years ago

wait, i even have 1 doubt


magicmike123
HOBBYOP

2 years ago

how does railway know that my express file is server.js


magicmike123
HOBBYOP

2 years ago

if everyone uses app.js


magicmike123
HOBBYOP

2 years ago

i didnt mention anything but it works


2 years ago

i assume you have a start script in your package.json?


magicmike123
HOBBYOP

2 years ago

i have one called "server"


magicmike123
HOBBYOP

2 years ago

"server": "node server.js"


magicmike123
HOBBYOP

2 years ago

1303773070275645520


2 years ago

magic


magicmike123
HOBBYOP

2 years ago

what is it xD


magicmike123
HOBBYOP

2 years ago

hahah


magicmike123
HOBBYOP

2 years ago

some AI im guessing that tries to figure out the command based on what it sees


magicmike123
HOBBYOP

2 years ago

who knows


2 years ago

its just detected a server.js file and ran it


magicmike123
HOBBYOP

2 years ago

oh right


2 years ago

we dont use ai


magicmike123
HOBBYOP

2 years ago

nice


magicmike123
HOBBYOP

2 years ago

some people use it too much too xd


magicmike123
HOBBYOP

2 years ago

anyways this is deployed


magicmike123
HOBBYOP

2 years ago

ima try to hit endpoint, its gonna use cached data lets see time


magicmike123
HOBBYOP

2 years ago

previous was 1 m 50 s


2 years ago

i assume an in memory cache? if so, that cache is gone since you redeployed


magicmike123
HOBBYOP

2 years ago

no no


magicmike123
HOBBYOP

2 years ago

i meant my own mongoDB cache


magicmike123
HOBBYOP

2 years ago

like its not refetching all the data from some API as the first time, it just fetches from mongoDB, it still have to do some processing of the data so its normal it takes long time


2 years ago

i would highly recommend you deploy redis on railway and use that as cache, since right now you will pay for the cache if its in atlas


magicmike123
HOBBYOP

2 years ago

okey now it took 1 minute 38 seconds


magicmike123
HOBBYOP

2 years ago

no i dont pay any cache to atlas


magicmike123
HOBBYOP

2 years ago

im using gridFS


magicmike123
HOBBYOP

2 years ago

with free tier, and it works


2 years ago

egress, remember


magicmike123
HOBBYOP

2 years ago

ah right


magicmike123
HOBBYOP

2 years ago

sorry


magicmike123
HOBBYOP

2 years ago

but i.. i never used redis before


2 years ago

time to learn then


magicmike123
HOBBYOP

2 years ago

not the time, its time to deploy this fast as possible and start testing, customer wants to start soon


magicmike123
HOBBYOP

2 years ago

so in total i made 3 endpoints hits


magicmike123
HOBBYOP

2 years ago

can I see a chart of the hardware to see how much RAM / CPUs were used?


2 years ago

look at the metrics tab


magicmike123
HOBBYOP

2 years ago

like is there a way to see somehwere how much it took


magicmike123
HOBBYOP

2 years ago

ah okey


magicmike123
HOBBYOP

2 years ago

1303774808722505748


magicmike123
HOBBYOP

2 years ago

so, how bad is it? mmm, i mean 2 GB of RAM, thats quite good i think, not using that much


magicmike123
HOBBYOP

2 years ago

and 2 vCPU, not that bad either


magicmike123
HOBBYOP

2 years ago

i think reason takes so much its mongoDB gridFS, i need to improve that myself


magicmike123
HOBBYOP

2 years ago

but we can see that server is doing good, is not exploding or anything


magicmike123
HOBBYOP

2 years ago

what if 10 people request at the same time, will server crash or just go slower a bit with all the requests?


magicmike123
HOBBYOP

2 years ago

btw this means like, 240mb of egress right? approximately? which is saving in further requests, right?

1303775461393961051


2 years ago

yeah


2 years ago

not doing cache in atlas will surely improve that


magicmike123
HOBBYOP

2 years ago

yes but for now i plan to continue doing cache in atlas, forget changing it


magicmike123
HOBBYOP

2 years ago

and 240 mb was without the cache, first time i removed cache intentionally


magicmike123
HOBBYOP

2 years ago

from my mongoDB database


magicmike123
HOBBYOP

2 years ago

so further requests not doing much egress, which is like, good, right? saving costs yes?


magicmike123
HOBBYOP

2 years ago

just to make sure I undrstand whats happening, im a bit slow and new to this sorry 😄


2 years ago

sounds about right


magicmike123
HOBBYOP

2 years ago

oh nice 🙂


magicmike123
HOBBYOP

2 years ago

so lets analyse, this cache stays for 1 hour since the time its cached lets say


magicmike123
HOBBYOP

2 years ago

so about 24 caches per day approximately


magicmike123
HOBBYOP

2 years ago

and then this for 30 days


magicmike123
HOBBYOP

2 years ago

so its about 240 mb call x 24 times a day x 30 days a month


magicmike123
HOBBYOP

2 years ago

(cache gets shared across all users of the app)


magicmike123
HOBBYOP

2 years ago

172 gb per month


magicmike123
HOBBYOP

2 years ago

thats like, 17.2$ right?


magicmike123
HOBBYOP

2 years ago

then obviously login, register etc would add a bit more but basically it would be this


2 years ago

retrieving cache would be free, since thats ingress


magicmike123
HOBBYOP

2 years ago

ah right


magicmike123
HOBBYOP

2 years ago

still 17$ usd per month due to the 240 mb non-cached-yet call every hour


magicmike123
HOBBYOP

2 years ago

which is i would say, quite reasonable


magicmike123
HOBBYOP

2 years ago

right?


2 years ago

id say so


magicmike123
HOBBYOP

2 years ago

perfect!


magicmike123
HOBBYOP

2 years ago

so just to make sure this is clear, if 10 users use the endpoint at the same time, obviously its going to go much slower for a bit but it should in theory not crash the server, right? @Brody


2 years ago

it definitely could crash, this is node after all, not typically known for high throughput with compute


2 years ago

under high load you will want to use replicas, aka horizontal scaling


magicmike123
HOBBYOP

2 years ago

god knows whats that man 😄 hahah


magicmike123
HOBBYOP

2 years ago

i mean the replicas thing


magicmike123
HOBBYOP

2 years ago

haha


2 years ago


magicmike123
HOBBYOP

2 years ago

so: "Scale horizontally by manually increasing the number of replicas for a service in the service settings. Increasing the number of replicas on a service will create multiple instances of the service deployment.", does this means I have to use different domains for each replica?


magicmike123
HOBBYOP

2 years ago

or they work under the scenes but at the same domain?


2 years ago

read a little more and your question will be answered


magicmike123
HOBBYOP

2 years ago

oh nice


magicmike123
HOBBYOP

2 years ago

so hows the cost of adding a replica @Brody ? just as if i was adding another exact same server in terms of pricing, or how it works?


2 years ago

correct, its just another instance of your app


magicmike123
HOBBYOP

2 years ago

so I have this doubt


magicmike123
HOBBYOP

2 years ago

I have a customer, but Im the one with the github repo


magicmike123
HOBBYOP

2 years ago

my customer is supposed to put the money in railway for the servers


magicmike123
HOBBYOP

2 years ago

is it possible to do it so that i keep my github repo and he pays the servers?


magicmike123
HOBBYOP

2 years ago

how would we do it? @Brody


2 years ago

yeah you'd just need their card details and you would enter them when signing up for pro


magicmike123
HOBBYOP

2 years ago

but thats dangerous for him 😦 no way right?


magicmike123
HOBBYOP

2 years ago

i mean no way he gives me his card details, there has to be another way


2 years ago

then you pay and send them invoices


magicmike123
HOBBYOP

2 years ago

mm... no, for some private reasons I cant do that


magicmike123
HOBBYOP

2 years ago

so basically he would register


magicmike123
HOBBYOP

2 years ago

on railway


magicmike123
HOBBYOP

2 years ago

and he puts his card on his account, that would work for me


2 years ago

it needs to be done on the account you already have


magicmike123
HOBBYOP

2 years ago

but then how can he connect the github repo? can i keep the github repo on my github account and then give him like, permissions on his github account¿?


magicmike123
HOBBYOP

2 years ago

im assuming he creates an account for him, wont be using my railway account im just testing stuff with hobby plan but in future we deploy with his acc


2 years ago

you can only connect one GitHub account to one Railway account


magicmike123
HOBBYOP

2 years ago

so theres no way on github to give access to somebody else like a github team project or something? idk im not expert at github either


2 years ago

I'm not either


magicmike123
HOBBYOP

2 years ago

i guess i could create new github account for him and put my code on a repo for him and he can use that


magicmike123
HOBBYOP

2 years ago

right


2 years ago

you would need to push code to that repo and be a part of their team, meaning that's 2 seat costs


magicmike123
HOBBYOP

2 years ago

no, we can use both the same github account


2 years ago

respectfully this is over complicating it, pay it and send them the invoice, that is how most people do it in your situation


magicmike123
HOBBYOP

2 years ago

I cant, its taxes related stuff


2 years ago

you definitely can


2 years ago

I assume it's just that you don't want to set it up


magicmike123
HOBBYOP

2 years ago

im not a legal registered business anyways


magicmike123
HOBBYOP

2 years ago

i cant emit invoices legally here


magicmike123
HOBBYOP

2 years ago

is not an option


magicmike123
HOBBYOP

2 years ago

you dont know what country i am from


magicmike123
HOBBYOP

2 years ago

laws different


2 years ago

Is it hard for you to do that? where I live it's $70 and a sheet of paper


magicmike123
HOBBYOP

2 years ago

you probably live


magicmike123
HOBBYOP

2 years ago

in a normal country


magicmike123
HOBBYOP

2 years ago

i live in degenerate socialist shithole


magicmike123
HOBBYOP

2 years ago

so as of now i rather choose this, otherwise here its 300$ monthly taz


magicmike123
HOBBYOP

2 years ago

tax


magicmike123
HOBBYOP

2 years ago

  • 35-40%

2 years ago

fair enough


magicmike123
HOBBYOP

2 years ago

but base tax 300$


magicmike123
HOBBYOP

2 years ago

yeah


magicmike123
HOBBYOP

2 years ago

we will just do 1 github account im okey terms with him, we friends 🙂


magicmike123
HOBBYOP

2 years ago

so i think that will work that way


magicmike123
HOBBYOP

2 years ago

👍


magicmike123
HOBBYOP

2 years ago

@Brody and anyways thank you for all the support today I will try ask you around here anytime I have more doubts


magicmike123
HOBBYOP

2 years ago

I will now give you my most beloved gift


magicmike123
HOBBYOP

2 years ago

a fat chinchilla pic

1303787914324475977


magicmike123
HOBBYOP

2 years ago

my favourite floof


magicmike123
HOBBYOP

2 years ago

😄


2 years ago

lmfao thank you very much, very nice picture


magicmike123
HOBBYOP

2 years ago

😄 yes i love them, so fluffy and big, they friendly and rarely bite unless quite stressed


magicmike123
HOBBYOP

2 years ago

👍


2 years ago

have a nice day!


magicmike123
HOBBYOP

2 years ago

@Brody Hi again, I was investigating this Redis thing, I got as far as getting the code with code that should hopefully work, but this throws me an error of cant connect to client:

1303839442204622878


magicmike123
HOBBYOP

2 years ago

How do you usually install redis anyways and, is it complicated to do on railway?


magicmike123
HOBBYOP

2 years ago

Im just using a windows 11 machine, nothing special


2 years ago

just click that same create menu, choose database and then choose redis


2 years ago

and then have your code connect to it via environment variables


magicmike123
HOBBYOP

2 years ago

ah, and btw I found theres an installer for windows, its the first time I ever use this so no idea what im doing but hopefully works, I will try locally first then try railway


magicmike123
HOBBYOP

2 years ago

got it running now it seems... kinda


2 years ago

kinda?


magicmike123
HOBBYOP

2 years ago

@Brody Hi, so Im learning Redis, and I gt it working


magicmike123
HOBBYOP

2 years ago

im running it locally correctly:

1304003880866283551


magicmike123
HOBBYOP

2 years ago

however, I have absolutely no idea on how to exactly set it up on railway


magicmike123
HOBBYOP

2 years ago

I see you wrote me before about "have your code connect to it with environment variables" but so far I didnt need any environment variable locally so im not sure where it would go


magicmike123
HOBBYOP

2 years ago

in my express backend app the initial code is like this for reference:

1304004254943674401


2 years ago

Heya ! the redis client will use the defaults to connect to a redis server. If you're running a simple redis server locally, the server likely uses all the defaults, therefore it's kinda magic for you.

On railway, you would setup a redis service, then in your app's service, you would add a REDIS_URL env variable, and have it references ${{Redis.REDIS_URL}}

You're also likely going to need to edit your code to use your env: createClient() becomes createClient(process.env.REDIS_URL). to avoid null issues, you can also do const redisClient = process.env.REDIS_URL ? createClient(process.env.REDIS_URL) : createClient()


2 years ago

You can learn more about reference variables here: https://docs.railway.app/guides/variables#reference-variables :)


magicmike123
HOBBYOP

2 years ago

Does this cost any money nowadays?


2 years ago

yes, Railway is a paid platform haha


magicmike123
HOBBYOP

2 years ago

No, I mean the Redis additional cache thing


magicmike123
HOBBYOP

2 years ago

Im asking because if its gonna cost money might as well use gridFS from mongoDB then


2 years ago

yes, Railway is paid


magicmike123
HOBBYOP

2 years ago

whats the cost of Redis


2 years ago

it all depends on the resource usage


magicmike123
HOBBYOP

2 years ago

then it should save money if anything, since Redis is supposed to save resource usage, right?


magicmike123
HOBBYOP

2 years ago

meaning: does it cost much resources to even create a Redis service?


2 years ago

no it doesn't cost much to have a idling redis database, and not having to leave the private network would be ideal.

the most ideal situation would be to use a railway hosted mongo database.


magicmike123
HOBBYOP

2 years ago

brother, you told me yesterday about "you should learn redis", now you are telling me i "better use a mongodb database" which is what I was already using in the first place? whats going on?


magicmike123
HOBBYOP

2 years ago

what the funk


2 years ago

you should do both, specifically both on railway, not atlas


magicmike123
HOBBYOP

2 years ago

pf


magicmike123
HOBBYOP

2 years ago

Anyways, the other guy told me this: On railway, you would setup a redis service, then in your app's service, you would add a REDIS_URL env variable, and have it references ${{Redis.REDIS_URL}} in here


magicmike123
HOBBYOP

2 years ago

was he refering to process.env.REDIS_URL? whats that Redis.REDIS_URL syntax? idk


magicmike123
HOBBYOP

2 years ago

ah nvm it explains in the link it seems


magicmike123
HOBBYOP

2 years ago

do you know about deploying the redis? im supposed to get some url but, no idea which one it is, is it this one here?


magicmike123
HOBBYOP

2 years ago

1304128310896365710


2 years ago

i think nico explained it quite well


magicmike123
HOBBYOP

2 years ago

the main doubt I have is this: ${{Redis.REDIS_URL}}, what "Redis" here exactly, and where is that supposed to go exactly?


2 years ago

per nico's explanation -

in your app's service


magicmike123
HOBBYOP

2 years ago

as of now heres what I have:

1304129673248247899


magicmike123
HOBBYOP

2 years ago

okey ima go to my app service then


magicmike123
HOBBYOP

2 years ago

1304129940127617084


magicmike123
HOBBYOP

2 years ago

like that I think?


2 years ago

nico said REDIS_URL


magicmike123
HOBBYOP

2 years ago

ah okey I will change it then


2 years ago

maybe it would be beneficial to read his message again?


magicmike123
HOBBYOP

2 years ago

i think i got it, its deploying now so will take a bit


2 years ago

let see your code changes?


magicmike123
HOBBYOP

2 years ago

i wonder if since its 2 different services, its considered egress when fetching from the redis?


magicmike123
HOBBYOP

2 years ago

yeah


magicmike123
HOBBYOP

2 years ago

1304132282034032671


2 years ago

no you do not pay egress for redis since you are connecting to it via the private network


2 years ago

hence why i also suggested mongo in railway


magicmike123
HOBBYOP

2 years ago

for now i will skip that, but i will keep redis here on railway


magicmike123
HOBBYOP

2 years ago

is normal that its taking 8 min to build btw?


2 years ago

no


magicmike123
HOBBYOP

2 years ago

it gave me this error:


magicmike123
HOBBYOP

2 years ago

Redis Client Error Error: connect ECONNREFUSED ::1:6379

at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {

errno: -111,

code: 'ECONNREFUSED',

syscall: 'connect',

address: '::1',

port: 6379

}


2 years ago

are you using ioredis?


magicmike123
HOBBYOP

2 years ago

and it keeps giving me the error seems like a loop


magicmike123
HOBBYOP

2 years ago

im using this:


magicmike123
HOBBYOP

2 years ago

1304133790523723786


magicmike123
HOBBYOP

2 years ago

npm redis package


2 years ago

what is this createClient function?


2 years ago

you have some syntax wrong and your code is trying to connect to a local database instead of the hosted database


magicmike123
HOBBYOP

2 years ago

1304134225041162290


magicmike123
HOBBYOP

2 years ago

its from the redis package


2 years ago

ah nico gave you the syntax for ioredis, this is the syntax for redis -

1304134591660949676


magicmike123
HOBBYOP

2 years ago

ooh


magicmike123
HOBBYOP

2 years ago

that example there on the url: is the REDIS_URL env variable reference, yes?


2 years ago

yes


magicmike123
HOBBYOP

2 years ago

1304135802053202000


magicmike123
HOBBYOP

2 years ago

its looking dramatic over here damn


magicmike123
HOBBYOP

2 years ago

ah nvm, that was previous deploy i think


magicmike123
HOBBYOP

2 years ago

think seems ok now


2 years ago

awsome!


2 years ago

now store cache in redis, not atlas


magicmike123
HOBBYOP

2 years ago

yeah, im using redis as of right now for cache, not gridFS like before for caches. as of now


magicmike123
HOBBYOP

2 years ago

and yeah I tried now with postman and it worked


magicmike123
HOBBYOP

2 years ago


2 years ago

sweet


magicmike123
HOBBYOP

2 years ago

Im now thinking of deploying the frontend, completely different thing this time


2 years ago

what kind of frontend?


magicmike123
HOBBYOP

2 years ago

react


magicmike123
HOBBYOP

2 years ago

its a react app, like vite react



magicmike123
HOBBYOP

2 years ago

okey ima check that


magicmike123
HOBBYOP

2 years ago

@Brody by any chance do you know the exact command that needs to be used to start the production server on react with vite? Im not seeing it on the guide and locally I run usually "npm run dev" but thats not the one, I am doing "npm run build" but not sure how to actually run it


2 years ago

the guide does cover that, its defined in the nixpacks.toml file and you should not be setting it yourself


magicmike123
HOBBYOP

2 years ago

ooh, okey


magicmike123
HOBBYOP

2 years ago

hold on, before I continue, I do have a bought domain on NameCheap, is it possible to use that domain with Railway for the frontend?


2 years ago

yes


magicmike123
HOBBYOP

2 years ago

perfect, how would I do that? 🙂


2 years ago


magicmike123
HOBBYOP

2 years ago

I got this thing:

1304154285558202368


magicmike123
HOBBYOP

2 years ago

not sure if thats a breaking issue with the Caddyfile, also I try run the command right there on VSCode on another terminal, the "caddy fmt --overwrite" and it says its not recognised, idk


magicmike123
HOBBYOP

2 years ago

oh it seems fine nvm


magicmike123
HOBBYOP

2 years ago

Hi


magicmike123
HOBBYOP

2 years ago

@Brody @Nico Hi, I have this issue, I already uploaded to Pro and when I do 1 request to my flipping tool endpoint to the frontend (and backend as well, both hosted here), it doesnt crash. But when I do 2 requests together, It wont work and it shows me this error on the frontend:

1304429784985505922


magicmike123
HOBBYOP

2 years ago

No way its crashing on 32 GB of RAM and 32 CPU right? my endpoint is heavy to load but not that much, when I try with 1 it usually shows about 2 GB of RAM per 1 call, 2 CPU per 1 call, so it should not crash with 2 requests at the same time


magicmike123
HOBBYOP

2 years ago

nvm I updated some node parameter and i think it works


magicmike123
HOBBYOP

2 years ago

I started using this parameter: --stack-size=8192 and it worked


2 years ago

node is single threaded so there is a limit to what you can do with a single instance, you may have fixed it now but you'll likely need to add some replicas at some point


magicmike123
HOBBYOP

2 years ago

@Brody And btw how does replicas work in terms of pricing, If I have 1 service with 1 added replica its gonna be max hardware cost of my plan (pro at the moment), so 32 GB and 32 CPUs multiplied by 2, 64 GB and 64 CPUs? how does that work exactly?


2 years ago

you are only charged for the resources you actually use, and having replicas does not change that fact.


magicmike123
HOBBYOP

2 years ago

oh nice, so basically replicas just share resources of the same service, right? a service with the pro plan lets say, with 20 replicas, it can still never go above 32 GB of RAM and 32 CPU, yes?


2 years ago

no, resources are per replica


magicmike123
HOBBYOP

2 years ago

ah


magicmike123
HOBBYOP

2 years ago

right ✅


magicmike123
HOBBYOP

2 years ago

@Brody Hi, by any chance is there anything faster than redis available on railway, that does the same thing?


2 years ago

well first, why do you need a faster redis?


magicmike123
HOBBYOP

2 years ago

my backend not going as fast as I would like, is not bad, but, just wondering if there was anything. It still improved with redis vs mongoDB or mongoDB gridFS so not complaining but, yeah


2 years ago

do you have actual metrics to prove that redis is the bottleneck?


magicmike123
HOBBYOP

2 years ago

oh no, not really, but since I moved to gridFS and redis and it improved, was hoping there was something even better


magicmike123
HOBBYOP

2 years ago

theres few bottlenecks but some of them are basically hard to dodge and dont think I can do much better, im a junior-mid fullstack guy anyways and this thing im doing is already quite complex, is 800 lines of code for an endpoint hit and except few console.logs I have everything is needed


2 years ago

then im confident in saying that redis is not the bottleneck


magicmike123
HOBBYOP

2 years ago

you are confident but i cant show you my code and i cant figure out how to improve it much, thats why I asked, but yeah


magicmike123
HOBBYOP

2 years ago

I dont even know if theres a way to not have a bottleneck when I have to process literally 3,2 millions of objects with each object having like 30 fields, is crazy, this is the highest amount of data I ever had to manage


2 years ago

write in a more performant language


magicmike123
HOBBYOP

2 years ago

thats a reasonable idea, but i dont know any other than nodejs tbh on a decent enough level


magicmike123
HOBBYOP

2 years ago

have you ever done node js before? if so, can you recommend me a similar and hopefully not too hard language to learn thats still performant¿?


2 years ago

learning time!


2 years ago

golang


magicmike123
HOBBYOP

2 years ago

yeah seems like, for now i will try to make this decent enough just so i can launch with the customer but, pretty much this seems like that


magicmike123
HOBBYOP

2 years ago

golang, okey


magicmike123
HOBBYOP

2 years ago

Im seeing stuff about Rust too, it seems even faster apparently, idk


2 years ago

it is, but you will not have a fun time going from javascript to rust, this isnt me gatekeeping anything, even experienced rust devs will tell you javascript to golang is a far easier path


magicmike123
HOBBYOP

2 years ago

oh, I see


magicmike123
HOBBYOP

2 years ago

@Brody Hi, is Redis stack available in Railway? I was doing some stuff and apparently for more advanced queries and similar stuff a Redis stack its needed, heres an example of what I mean: https://stackoverflow.com/questions/76837500/unknown-command-ft-create-when-creating-an-index-for-redis



magicmike123
HOBBYOP

2 years ago

@Nico


ddsna
HOBBY

2 years ago

Hi!

Just pitching in as a community member. They do suuport custom dockerfiles and you can absolutely deploy your own redis stack (via github repository for example) image if there is no available template.

Out of the box, I think Railway will only offer core redis.

I would only recommend doing this if you have some previous experimentation experience with docker.


ddsna
HOBBY

2 years ago

This example is a python flask app but the spirit carries over 🙂

https://docs.railway.app/guides/flask#use-a-dockerfile


magicmike123
HOBBYOP

2 years ago

ah okey thanks


magicmike123
HOBBYOP

2 years ago

@Brody Please help me with an issue with Redis network egress


2 years ago

please do not tag the team


magicmike123
HOBBYOP

2 years ago

ah sorry


magicmike123
HOBBYOP

2 years ago

REDIS_URL=${{Redis.REDIS_URL}}


Welcome!

Sign in to your Railway account to join the conversation.

Loading...