Nacho Codoñer
How to scale up a NodeJS Socket IO server without Session Affinity
I did it!
I installed Caddy as you suggested and set it up with a load balancer using sticky sessions. I pointed my main domain directly to the LB, and used the Caddy config example you provided here. I followed it, adjusting only to point directly to one service that includes both frontend and backend. The setup is great, as it uses dynamic upstreams that retrieve A/AAAA DNS records, which results on getting the individual IP addresses from one's service replicas (all using private networking). This lets me reuse Railway's replicas, each with the proper cookie for sticky sessions, without having to manually manage new services.
I'm updating this thread to help anyone looking to enable sticky sessions in their app setups on Railway, it is possible!
Thanks to Brody and rest of the team for sharing solutions that saved us a lot of time.
PD: For those who try this setup, special attention on the railwayapp-templates/caddy-reverse-proxy prerequisite:
Since Railway's internal network is IPv6 only the frontend and backend apps will need to listen on :: (all interfaces, both IPv4 and IPv6)In my case, Node kind of app, I had to add on my app service the
BIND_IP="::"
env to make it work.93 replies
How to scale up a NodeJS Socket IO server without Session Affinity
Thank you for the insights. It makes sense to use private tunnels, and I might try that at some point.
The goal is to create controlled replicas of my app while allowing the load balancer to handle traffic, primarily enabling sticky sessions but any other LB configuration logic. These replicas should not be accessed directly by users or search engines, instead, they should be accessed through the load balancer. Does it make sense?
93 replies
How to scale up a NodeJS Socket IO server without Session Affinity
I have a question about Cloudflare load balancing in Railway. If I create multiple services in my app and add public domains to be accessed by the load balancer, they'll also be accessible to anyone on the internet.
Does this mean those endpoints could be indexed by search engines? Could it also expose them to attacks since they're not protected?
Am I correct, or is there a way to prevent this?
93 replies
Trying to setup a Mongo ReplicaSet
Happy to see that Railway just delivered the official support of MongoDB Replica Set, https://railway.app/template/ha-mongo
I have been using MongoDB replicas for long already, and this template should overcome many of the problems when I tried to automate. 🥳
59 replies
How to scale up a NodeJS Socket IO server without Session Affinity
I have a question after reading this tutorial: https://docs.railway.app/tutorials/proximity-steering
Is it possible to use Cloudflare's load balancing referencing to replicas on the same Railway service, or would we need to duplicate the services on Railway for Cloudflare's sticky sessions to work?
Could sticky sessions be a useful application of Cloudflare load balancing for Railway apps? They seem to support it, https://developers.cloudflare.com/load-balancing/understand-basics/session-affinity/#enabling-session-affinity-via-the-cloudflare-api
93 replies
How to scale up a NodeJS Socket IO server without Session Affinity
Here's the link to the request to "sticky sessions". If you're interested, please vote and contribute to its implementation priority.
https://help.railway.app/feedback/sticky-sessions-fa65efc4
93 replies
How to scale up a NodeJS Socket IO server without Session Affinity
I see. Using session storage with Redis requires understanding how to implement it in your app and how your framework handles sessions, right?
I implement Meteor apps and understand that managing sessions with Redis can be challenging. Typically, Meteor apps rely heavily on horizontal scaling and sticky sessions when scale. Since Meteor also uses Node.js and is single-core, replication may be necessary for scaling Node apps.
I won't focus on this right now since I don't need it. However, I'd like to request sticky sessions in Railway to simplify horizontal scaling for any app project. If it's easy to implement, it could save time and benefit projects that need it at scale.
93 replies
MCMeteor Community
•Created by Vikron on 4/4/2024 in #general-help
Meteor 3 Beta run on android
The fix on Cordova experience was added on 3.0-rc.1 release that happened previous Monday. Please, review if the issue is fixed for you and if the other you got still happens. Otherwise, for the other I would need a reproduction repository.
6 replies
MCMeteor Community
•Created by Vikron on 4/4/2024 in #general-help
Meteor 3 Beta run on android
One of the issues reported here will be fixed on this PR, https://github.com/meteor/meteor/pull/13117.
Regarding the use of accounts package and the other errror reported, I didn't get it when testing, so if you have a reproduction of an small app triggering it I can review if it is fixed after the first fix. Otherwise, when next 3.x RC is available, you can test it. Thanks.
6 replies
MCMeteor Community
•Created by Vikron on 4/4/2024 in #general-help
Meteor 3 Beta run on android
https://forums.meteor.com/t/meteor-3-typeerror-cannot-read-properties-of-undefined-reading-format/61390
Reported on the forums as well. We track this issue and find out a solution. Thanks for the report.
About the accounts issue, maybe that one needs a repro steps, but we will focus in the other for the moment being.
6 replies
MCMeteor Community
•Created by Vikron on 4/4/2024 in #general-help
Meteor 3 Beta run on android
TypeError: Cannot read properties of undefined (reading 'format')Wait, I have got this issue as you do. And it completely crashes the server.
6 replies
MCMeteor Community
•Created by Vikron on 4/4/2024 in #general-help
Meteor 3 Beta run on android
Hello,
I just tested Cordova in Meteor 3.0-beta.7 release and worked well for me, and with the accounts package.
May you provide a minimal repository where the issue can be seen straight?
This way we can hunt down specifically the problem you get. Thanks
6 replies