Before continuing, print out this worksheet and fill it out as you move forward: Mlab, Github & Azure Account Info
Heroku as an Alternative
If you plan to use Heroku rather than Azure to host your Nightscout site, you do not need to set up Mlab separately. Heroku creates the Mlab portion automatically. Heroku site creation directions.
Accounts and User Names
For ease of use, consider using the same name for every username. Do NOT use your “regular” passwords that you use for banking, emails or other sensitive accounts. At times, when you need assistance, you may need to share the username & password of your Nightscout setup accounts with the individuals providing help to you.
Usernames and Passwords cannot contain ANY spaces, symbols or special characters. Use Upper and lower case alpha-numeric characters only. This includes letters and numbers.
Please use the worksheet linked above to keep track of this vital information. Without this information, you cannot install Nightscout.
Sign up for an Mlab Account
Sign up for a FREE Sandbox account at http://www.mlab.com/plans.
Note: Mongolab changed its name to Mlab in March of 2016. Any references to Mongolab in the documentation on the Nightscout site is synonymous with Mlab. This document has been updated, but you will see the term Mongolab used throughout the Nightscout site and directions. You should assume it means Mlab unless instructed otherwise.
After creating your account, open your e-mail to verify your e-mail address and sign back in to the Mlab web page.
Create a New MongoDB Database
- Click the “Create new” button on the right with the lightning bolt.
- On the “Create new subscription” page, you can choose from available cloud providers. Options may include: Amazon Web Services, Google Cloud Platform, or Microsoft Azure. Select one.
- Specify a region from the dropdown menu. The location represents where the sandbox is located, NOT where you are located.
(The image above shows a sample screenshot for location options when Amazon Web Services has been selected as the Cloud Provider. You can choose whichever Cloud Provider and whichever location you wish.)
- Click the button for Single-Node Development to use the free option. This will entitle you to half a gig of data, which should last over 5 years with the current Nightscout setup. Continue to step 4.
- Click to select the free “Sandbox” option.
- Enter a database in the box. Note: The database name must be lower case. A good practice is to simply put db on the end of your username, but it’s entirely up to you. WRITE IT DOWN!
- Click the “Create New MongoDB Deployment” button.
Note: If it doesn’t say $0, you have done something incorrectly. Be sure you have selected a Sandbox.
Create a User inside your Mlab Database
- Click on the name of the newly created database to open it. Mlab will show you an alert that you do not have a user and will display a link so you can create one.
- Click the link to open the “Add New Database User” dialog.
- Enter a database username and password and click the Create button.
You’ll need these values later to complete the Mlab URI string. Write them down! Do not use any special characters such as @ or ) or ^. The Cloud system will not recognize these special characters. Use Upper and Lowercase alpha ONLY. Do not select “Make read-only” or you will be unable to upload data to the database.
Record Your MongoDB Connection Strings
Once everything has been configured, on the Database Summary page, make note of the link at the top just under “To connect using a driver via the standard URI”, as some of this information may be used to configure the uploader app and the Azure web server that will display your data.
IMPORTANT: If this information is not entered correctly in later steps, your system will not work! At this time, you are only writing it down for later use.
The above URI is a sample only. Yours will look different based on your own information. The URI will look something like these examples:
Generic URI code:
Sample URI with a sample person’s information (note that the < > symbols have been removed):
When recording the URI, replace <user> and <password> (delete the < > symbols also) with the Database Username & Password created in Step 3 above.
THIS MUST BE EXACTLY THE SAME AS THE DATABASE USERNAME & PASSWORD YOU CREATED ABOVE! (This is not your Mongo login username & password).
Replace <database> with the name of the database that you created in step 2 above. Remove the < > symbols.
Note: In March of 2016, Mongolab changed to Mlab. The syntax above is the new syntax using the mlab format.
This is all illustrated for you on the worksheet you printed from above and shows you exactly what items go where.
You are only entering it into the worksheet right now, NOT into MongoDB.
Make sure you carefully check it several times!
- There will be a colon (:) between username and password.
- There is another colon (:) between .com and the numeric string at the end
- There is one “at” symbol (@) following the password
- There is one forward slash (/) before the database name.
- Remove any marks (like >) in the string.
It is crucial that this string is absolutely correct or your Nightscout setup will not work. Absolutely will not work when you get to the completion steps.
Once you have verified that the string is correct, you can move on to the next steps.
Even if you think they are 100% correct, check it again.
Make sure you have easy access to your Mongo URI connection string for the following pages.
You are now finished setting up your MLab account. On to the next step!
Setting Up a Second MongoDB
If you need to set up a second database (e.g., for a second T1D), return to the Mlab home screen, and repeat the steps above, beginning with step 1 of “Create a New MongoDB Database” to create a second database.