MongoDB configurations
Overview
Learn how to configure your MongoDB provider for Galaxy
Although Galaxy provides a free MongoDB service, it is not suitable for production usage. We recommend using the Galaxy Database service, which can be accessed by visiting Galaxy and navigating to the Databases section to make a request.
To configure MongoDB for your Meteor application, see the detailed steps in the Deployment guide.
For optimum performance, please ensure your database is running in the same region.
Configuring the app settings file
MongoDB is configured using environment variables in your settings.json file. Refer to the environment variables section to find a complete example.
Note that a valid MONGO_URL is required unless you have removed the mongo package from your app. A missing/invalid MONGO_URL is a common cause of failed deployments.
Connecting to your database
Galaxy is agnostic about how you talk to MongoDB, as long as you provide the appropriate credentials. If you can't connect, follow these steps:
Review the settings and examples on the Environment variables section.
Try connecting without a Mongo Oplog URL to see if that is causing the issue.
Verify the URL and username/password by connecting through a MongoDB tool or CLI.
If it still isn't working, you may want to check GitHub and the forums, or write to your database provider. They'll usually have more visibility into the issue than anyone in Galaxy support.
Configuring Oplog Tailing
Meteor can get real-time updates from MongoDB by using oplog tailing. Oplog tailing involves reading the MongoDB 'operations log' - a special Mongo collection that records all the write operations as they are applied to your database.
To use Oplog tailing, the database must be a Replica set enabled database. Refer to the environment variables section to find an example.
Learn more
- Learn how to configure your apps on Galaxy.
- Read our main guide for deploying applications on Galaxy.
- Read this OK GROW! article to connect your Meteor app to MongoDB Atlas with Oplog tailing
- Learn in what environment Galaxy runs your app.
Updated on: 22/08/2024
Thank you!