Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB connection string after migration to Mongodb Atlas #9

Open
bordeb opened this issue Dec 17, 2020 · 5 comments
Open

MongoDB connection string after migration to Mongodb Atlas #9

bordeb opened this issue Dec 17, 2020 · 5 comments

Comments

@bordeb
Copy link

bordeb commented Dec 17, 2020

After migration from MLab sandbox to free MongoDB Atlas database I am having trouble to properly configure db_uri parameter. I am not seeing any uploads have been done.
I have tried with
mongodb+srv://username:[email protected]/dbname?retryWrites=true&w=majority
but unfortunately without sucess.
What is the proper way to configure db_uri ?
Tnx in advance

@tzachi-dar
Copy link
Owner

Just making sure you are aware that xDrip can read directly from the pis.

Moving to write to atlas should be easy.

  1. update to the latest code. (git pull )
  2. sudo pip3 install dnspython
  3. use a db_uri in the format: mongodb+srv://heroku_b6k1n0tj:@cluster-b6k1n0tj.bg18m.mongodb.net/heroku_b6k1n0tj

After this, you should be able to see writes to the mongo-db.

Reading from the mongdb by xDrip requires to create a site that will allow to read the DB.
See NightscoutFoundation/xDrip#1557 for how to do it.

Let me know if things work for you.

@bordeb
Copy link
Author

bordeb commented Dec 17, 2020

Dear @tzachi-dar thank you on the fast response. Yes, I am aware of the xdrip+ capability to read from the pis. I am using it and this software is so useful and great to cover all the house in order to not worry any more about the libre full coverage arround the house.
On the other side, I am not fully aware about the purpose of the mongodb upload, so I am thinking that it might have some synchronisation purpose between pis, but probably I am not right. I was using mlab for years without beeing fully aware about the exact purpose and now after migration to MongoDB Atlas I am not sure do I need it any more. If you have couple of minutes, it would be great if you could explain it little bit more. Many tnx

@tzachi-dar
Copy link
Owner

If both xDrip and the pis are on the same wifi network you don't need the mongodb.
If for some reason they are not (for example you left the phone at your car, or the phone did not connect to wifi on your house) the mongo allows them to continue talking.
It is completely optional, but I think it is nice to have.

@bordeb
Copy link
Author

bordeb commented Dec 18, 2020

Tnx for the info! I have looked following the link NightscoutFoundation/xDrip#1557 you have provided but honestly I can not figure it out what kind of site it would be needed to allow me to extract data from mongodb using xdrip. I will continue reading and trying to figure it out. Thank you very much

@tzachi-dar
Copy link
Owner

In order to create a sight, you need to follow:
https://devcenter.heroku.com/articles/getting-started-with-nodejs?singlepage=true

But when asked for a git page, replace it with:
https://github.com/tzachi-dar/node-js-getting-started

Once the site is up and running, you need to set two environment variables:
heroku config:set db_uri="mongodb+srv://heroku_b6k1n0tj:@cluster-b6k1n0tj.bg18m.mongodb.net/nightscout3?retryWrites=true&w=majority"
heroku config:set password="pass"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants