I was curious about how to host MongoDB on Fly.io using our machines platform. The above repo is somewhat of a template for that. No this is not official Fly.io MongoDB, this is just a side project of mine.
Instructions on the README, feel free to use/clone it and let me know if you have ever tried MongoDB or another on Fly before, I’d love to hear your thoughts.
You’ll notice there’s some manual work when first creating the cluster and when horizontally scaling things. I’m sure there are clever ways to detect cluster changes and make everything go smoothly (we do that with our Postgres, repgmr at least does that) but I’m comfortable with running manual commands when manually scaling things for now.
Hi Mr. @lubien.
I thank u for the example and I followed the github readme. It was deployed successfully but I tried to connect it with the provided URI mongosh "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.10.1" --username admin --authenticationDatabase admin.
Update:
I added a dedicated ip4 and tried to connect it via
mongosh "mongodb://user:password@mongodb.fly.dev:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1"
MongoServerSelectionError: Server selection timed out after 2000 ms
@milimyname glad you ended up finding something that works for you.
If anyone else is giving this a try and runs into ECONNREFUSED 127.0.0.1:27017 when connecting from a terminal, try this command first to forward your MongoDB app’s port to your local machine:
fly proxy 27017 -a <mongodb-app-name>
(More on fly proxy here: fly proxy · Fly Docs)
Then, in another terminal window, retry connecting via mongosh <URI>. You should also be able to connect using MongoDB Compass!
I don’t believe that’s something come up in the short future, we would be looking for partners to provide easy mongo integration. This repo was just a weekend project of mine
Howdy. I asked the Extensions team and we have a partner that also have MongoDB but currently they’re working on another extension so MongoDB is not on our immediate radar.