This repo contains the resources required to deploy a Mongo replica set in Railway from a template.
To deploy your own Mongo replica set in Railway, just click the button below!
For even more information, check out the tutorial in Railway: Deploy and Monitor a MongoDB Replica Set
The MongoDB nodes in the replica set are built from the Mongo CE image in Docker Hub. The only customization to the image, is the inclusion of a Keyfile to enable authentication.
The init service is used to execute the required command against MongoDB to initiate the replica set. Upon completion, it deletes itself via the Railway public API.
Included in this repo are some example apps to demonstrate how to connect to the replica set from a client.
Pull requests are welcome. If you have any suggestions for how to improve this implementation of MongoDB replica sets, please feel free to make the changes in a PR.