nightscout / nightscout.github.io

website, meta repo for whole project
GNU General Public License v2.0
104 stars 228 forks source link

Testing migration to Atlas, reporting any documentation issues here #78

Closed bjornoleh closed 3 years ago

bjornoleh commented 3 years ago

@psonnera: Thanks for your hard work with the documentation! I am doing the first migration to Atlas, and will report any documentation issues here. I will just note everything, including minor mismatches. All of this in not necessarily something that needs attention. Just consider it a helping hand at looking for whatever issues might be there. And this was all I could find, in other words, not much :-)


The question about "How are you using MongoDB" was required to proceed. image

Did not see the page related to Choose a name for your organization

image

Click your name, top right, and select View All Organizations (not "Organizations" [sorry for nitpicking! :-)] image


Click Confirm Connectivity (not "Test Connectivity") image


There should be a short instruction to paste string into Notepad (missing)

image


Other guides have mentioned the "Maintenance Mode" in Heroku/Settings, is this required? Or will Heroku stop the apps when Begin Migration is clicked?

image


Possibly a missing suggestion about "Patience" before the green "Start Using Atlas" button appears (but it doesn't take very long).

image


I see from FB that you have already got input on this one:

image

(and your solution from FB: _You're right that's not what should be written. It should read: "Copy the contents of your Notepad (the Atlas string) in the line MONGOCONNECTION")

The helper script is great, and you could probably make it better by clarifying the last sentence here as well (Step 6: Copy the resulting connection string in Heroku)

image

And, please do suggest using your helper script as the main method to get a working connection string, I suspect it is just too confusing for most to grasp what should be and not be included.


You have already some instructions for pasting the string into theMONGO_CONNECTION variable, so a review of this whole section can be useful: image

psonnera commented 3 years ago

Great feedback. Thanks! Mongodb has been changing Atlas account creation web pages a few times since I first created it. Maintenance mode is not necessary since the mLab database will turn to read only when migration starts, i.e. no conflicting activities during this phase and neither after. Uploaders will just not be able to add data in the original dB until the string is changed to Atlas. I want to embed directly the helper javascripts in the web page but can't do that in markdown, so I need to freeze it and edit the html. Time is getting short now. Will try to do that ASAP, even if that makes me surrender the Azure migration guide.

bjornoleh commented 3 years ago

Thanks.

I found that the Restart all dynos step is not required, since the site is restarted when a config variable is changed.

I was wondering about, and found out that "Project0" in Atlas can be deleted. Not sure if it is worth mentioning. https://docs.mlab.com/how-to-migrate-nightscout-sandbox-heroku-addons-to-atlas/#create-atlas-org

I am still wondering if there can be a link from the Heroku pages, like with the mLab MongoDB sandbox add-on and Papertrail? Does not look like that is an option. Doesn't really matter.

psonnera commented 3 years ago

@bjornoleh you are right. Restart all dynos is not necessary. Removed. Yes, you can delete Project0 but why bother? It might be an useless trouble for those not understanding what they do. Atlas not being an Herolu add-on there's no link...

And good news for me: you can embed javascript in markdown, so I'll simplify the strings handling and PR. Preview here: https://psonnera.github.io/nightscout.github.io/update/migrate_heroku/ Tested in Safari 13.1, Chrome 85.0 and Edge 86.0.

bjornoleh commented 3 years ago

@psonnera Great news with the embedded script! Looks ok with Android/ Chrome too, but haven't tested the scripts as such.

The other thing I mentioned are none-issues.

Ideally, the manual instruction for creating the string should be removed to a separate page, so it won't confuse those who succeeded with the script. But it should be feasible for most as it is now.

Just a comment about this: perhaps write 'paste" instead of "copy"?

20201011_230541

psonnera commented 3 years ago

Done in last PR.

christerjensen commented 3 years ago

Followed the guide yesterday - very good instructions - BUT - even if everyting seems to go as planned, the migration failed.

I found the problemm to be the password from the mLab user. I have a feeling users that created a manual mLab database user will fail. Probably due to a short password. Out password was only 6 letters (set up 6 years ago). When I logged in to Atlas it seems like the user didnt have a password - is there a password limit?

I solved the problem by autogenerating a new 24-digit password in Atlas and changed the Mongo_conncectin string with the new password.

old-square-eyes commented 3 years ago

Similar scenario for me. Older, shorter password (though no issue with that). Successful (all green) progression through the migration doc (which is wonderful thanks!). NS failed to load after the changeover.

For me I traced it back to the the instruction to click on the mlab integration/addon link from within Heroku and to leave the window open. Turns out the mlab link form Heroku was linking to some empty DB (with NS collections). I'm guessing it was auto setup some time in the past.

122167187_1397343430609475_2961086923194916322_o

I came from Azure before Heroku. Not sure if that's it. But once I linked my correct mlab account in Atlas for the migration it worked.

The tools to check my strings actually passed validation, as did the test connection and import. I got all the way through the instructions having the wrong connection string until the final step where I was told "that's it - you're done", only to find a broken NS site. It was looking for the old config var MONGODB_URI.

121676612_1397327993944352_1033582604371186418_o

I was able to back trace and troubleshoot. So not stressed. Just raising that a few users may get tripped up here.

christerjensen commented 3 years ago

All strings passed validation for me as well, same error. It worked after I changed the password to a 24-digit autogenerated one from Atlas.

I followed the Troubleshooting guide - https://nightscout.github.io/troubleshoot/troublehoot/#boot-error-unable-to-connect-to-mongo

When I looked at the Database Access - it seemed like there was no password. Since it passed all validations, and I saw the username and passord when I validated - it might be that Atlas will not accept short passwords?

bjornoleh commented 3 years ago

@psonnera I reopened this as a new issue emerged with users of some older NS setups, please see above.

psonnera commented 3 years ago

@bjornoleh at this point should we force users with a customized password to regenerate it like this? https://nightscout.github.io/troubleshoot/troublehoot/#boot-error-unable-to-connect-to-mongo

bjornoleh commented 3 years ago

@psonnera I dont know, question is if the users will remember or understand that the password they selected years back is in this category. I dont know if the script could have detected if the password matches the requirements of Atlas, whatever those are?

Perhaps @christerjensen or @old-square-eyes have an opinion?

psonnera commented 3 years ago

Good idea. Will add this to the scripts.

bjornoleh commented 3 years ago

@psonnera I have a question about searching in collections in Atlas.

I can't sort the documents as suggested in your troubleshooting preview here: https://psonnera.github.io/nightscout.github.io/troubleshoot/troublehoot/#data-in-the-future

I used the sort order feature in mLab quite a bit (ascending or descending), but have not found a way to do this in Atlas yet.

psonnera commented 3 years ago

@old-square-eyes you're right. Unlike the Heroku migration I forgot to add to delete MONGODB_URI. Thanks! @christerjensen I tried to set my son's Atlas password to a single character (lower case a) and it liked it, there must be something else... @bjornoleh mongodB doesn't specify any restrictions on database passwords... But I'll give a refresh to the Atlas migration guide now. Thank you all for taking time to feedback, this is really appreciated.

old-square-eyes commented 3 years ago

I actually did delete the old var. NS seemed to look for it when Atlas failed.

My only comment is that the the doc shouldn't catagorically say to click into mlab from Heroku.

Maybe a huge warning that says "be sure you are logged into the account that matches your existing db connection string" where it says "Click mLab MongoDB"

christerjensen commented 3 years ago

@psonnera There were no password in Atlas (pressed SHOW - empty). If the password should have been copied from mLab something must have gone wrong - possibly because I made the database user and password myself 6 years ago? I've seen a few of these errors the last few days.

psonnera commented 3 years ago

@christerjensen you cannot view your current password, it will always show empty. You can only see it if you change it