Nacho Codoñer
Trying to setup a Mongo ReplicaSet
I know that MongoDB Replica Sets are not officially supported. However, with the Railway current capabilities in theory could be approached.
I am following the official steps and I feel to be stuck on first steps and I would like to understand if there is anything I can do alternatively.
With the start command support for docker, you can pass "--replSet rs0" to the mongod command. However, you need to enforce security with a key for the replicas communication and shared between three minimum required mongo replicas.
I was trying to store the key into an env variable, and then tweak the start command of the service with something like this:
docker-entrypoint.sh mongod --replSet rs0 --keyFile <(echo "${AUTH_SECRET}" | base64) --ipv6 --bind_ip ::,0.0.0.0
However, I think this is not working and I think the reason is that start command can't execute " <(echo ${VAR})" "$(echo ${VAR})" dynamic evaluations.
Am I correct on this limitation? Is there any chance to ask for support dynamic evals on start commands?
Alternatively, could you think in an alternative way to achieve this?
Of course, I was thinking in possibly create a forked mongo db image and include a way to fetch securely the secret, generate the file and be ready to link it on the start command just by the route. But I was wondering if there is an even easier way to achive this without going out Railsway context.
Thank you59 replies
Mongo 6 - Service + Volume
I am about to deploy an app to Railway that uses Mongo 6. The build-in version that Railway provides is 4.4.
I have tried to create a Service (using mongo 6.x official image) + Volume but when I try to link the DB with the app service, I always get mongodb connection timeout. I also attempted to do it via a mongo client, but failed as well.
I used a connection string like this:
mongodb://USER:[email protected]:27017
What am I doing wrong?
Project Id: 3cdba747-364e-4315-8788-5bcc6a5c6a8c4 replies