Setting Up Your Nightscout Website on Azure

22 Aug
Guides > Setup Guides > Setting Up Your Nightscout Website on Azure

This guide is no longer current. Please follow this guide instead.

Currently, Heroku is the recommended approach for Nightscout hosting. If you plan to Loop or use openAPS, you will need to use Heroku instead of Azure. For regular use, Heroku is easier to set up and some find it to have less downtime and be more reliable.

Directions below are for Azure. To set up a Heroku site, use these directions.


You need the worksheet you started filling out during the MongoDB setup for the next steps.

The following multi-step process will walk you through obtaining the web site source code from GitHub, creating a website hosted by Microsoft Azure, and deploying the source code to your new Nightscout site.

1. Set Up GitHub

  • Create a free account at Github. You will see the following screen that confirms you have a free account:github setup
  • Be sure and write down your username & password.
  • After creating your account and logging in, open the master repository by clicking here –>cgm-remote-monitor
  • Make a copy (“Fork”) of nightscout/cgm-remote-monitor to your own repository by clicking on the Fork button that appears top right OR click here to fork the repository –>fork the cgm-remote-monitor
  • If prompted with ‘Where should we fork this repository?‘, select your @<gitaccountname>, and it will fork to your repository. (At the top of the page, you will now see <gitaccountname>/cgm-remote-monitor indicating you have your own copy forked from Nightscout.)
  • You are now ready to create a website (or web app). Documentation below is for setting the site up using Azure. Heroku is an alternative. If you plan to use Heroku, you will NOT use the directions below. Set up a Heroku account, deploy to Heroku, and configure your site instead. Heroku setup also automatically creates and configures the mLab database.

2.  Create an Azure Website

Note: With the release of CGM Remote Monitor 0.9 (October 2016), there is now a “Deploy to Azure” button that can simplify the creation and configuration of a Nightscout site in Azure. Directions to use this streamlined approach can be found here. Using these directions replaces the setup steps on the rest of this page.

  • Go to
  • If you are setting up your first Azure site, click “Try for free.” (This is a 30-day trial that also gives  you a $200 credit.) (If you already have an Azure account and need to create a new website, skip to Create Your Azure Website below.)
  • Be sure and write down your username & password.
  • Enter your credit card information when requested. This is a required step, even though the plan is free for 30 days.

    Note: after setting up your Azure account, you must change your plan within the thirty day trial or you risk your account being terminated. Find out how to change to the Pay-As-You-Go plan. (With typical Nightscout usage, your Azure site should remain free or very low cost.)

  • Once your account is set up, log in (if necessary) to the Azure Portal to create your Nightscout website.Note: the user interface at Azure has changed. If you have used Azure before and wish to use the older version, please begin at The following screenshots and directions have been updated to reflect the new Azure interface.

2.2 Create Your Website

You can host your site at Azure or Heroku. Directions below are for Azure. To set up a Heroku site, use these directions.

Note: With the release of CGM Remote Monitor 0.9 (October 2016), there is now a “Deploy to Azure” button that can simplify the creation and configuration of a Nightscout site in Azure. Directions to use this streamlined approach can be found here. Using these directions replaces the setup steps on the rest of this page.

  • If you do not see the buttons and pop-up screens shown below, please try using the Google Chrome browser.
  • From the Microsoft Azure Portal, create a new site, as follows:
  1. Click NEW in the left-hand menu.
  2. From the panel that opens, select Web + Mobile.
  3. From the panel that opens, select Web App.
  4. In the panel that opens, fill in the App Service Name. This will be the name of your Nightscout site. (Your Nightscout url will be

    Since this information is health-related, we suggest you give your site a name not associated with the PWD.


  5. Subscription Type should be Pay-As-You-Go (default).
  6. If default choices are shown, you can leave the default selections for Resource Group and App Service Plan/Location. If the Resource Group shows + New as the only option, type a name in the New Resource Group Name box to create one. (This can be any name, e.g., MyResource.)
  7. If default selections are not shown for App Service Plan/Location, click the box and follow the prompts to make your choices.
  8. Fill in a name for the App Service plan you are creating. (This can be any name, e.g., MyPlan.)
  9. Select a location from the drop-down menu. The location does not need to be the region in which you live.
  10. Click the Pricing Tier box to open the pricing options panel.
  11. You want to select “free” as the pricing tier. In the current Azure Portal, the panel that opens does not show “free.” Click the “View All” link.
  12. Scroll down the options to find the “free” choice. Click it to select it, and then click the “Select” button at the bottom.
  13. Make sure that the free option is shown in the pricing tier box. Click “OK” at the bottom.
  14. You will now see the new Web App panel again, with all of your information filled in. Verify your choices and selections. Click Pin to Dashboard at the bottom, and then click Create.

After creating your new site (web app), a screen will open, and you will see the following icon while the app is created. (Azure will give you a message that the web app has been deployed. Please note this is not the same thing as the deployment in GitHub, which happens in the following step.)

Important Node Update for all New Sites

Before deploying your GitHub code (next step), you need to set the WEBSITE_NODE_DEFAULT_VERSION variable (in Azure app settings) to 8.5.0 (as shown in the screenshot below). Make this change and save before moving ahead.

Azure node update

3.  Deploy GitHub Code to Azure

After your site has been created, you are ready to deploy the Nightscout code (CGM-remote-monitor) from GitHub.

  • Click on the web site name. Note: You may see the name in a list. You may see the name in a box. Click the name of your site.
  • Your site’s dashboard will open and will look similar to the one shown here. Note: the “All Settings” link has been removed in Azure.
  • Click Application settings (which is a link in the panel/column of links) to open the Settings panel.
  • On the Settings panel, scroll down to the Publishing section, and click Deployment Options. (Note: previously it was labeled deployment source.)
  • In the new panel that opens, click to choose a deployment source.
  • In the new panel that opens, choose GitHub from the list.
  • If this is your first time setting up Azure, you will need to authorize the connection between Azure and GitHub. Follow the prompts.
  • Once connected to GitHub, click the Choose project box.
  • In the panel that opens, select cgm-remote-monitor from the list. (It may be the only one you see.)
  • After selecting the cgm-remote-monitor repository, if master is shown in the Choose branch box, continue to the next step. If master is not shown, click the Choose branch box. In the panel that opens, select master from the list of branches. (The “master” branch is the official release.)
  • Click the OK button at the bottom of the Deployment Source panel.
  • After clicking the OK button, Azure will begin deploying the code. You will be able to watch the progress through a series of dialog boxes and status notes, like these.


  • Once the deployment has completed, the deployment will be shown with a green checkmark indicating the deployment was successful. (Note: If the deployment was not successful, you have to retry the deployment.)
  • If your deployment was successful, move on to the next step.


Step 4: Configure Your Website to Use Mlab and Set an API SECRET

    • From the Settings menu in Azure, click Application Settings.
    • Near the top, under “General Settings,” ensure “Always On” is clicked to
    • Scroll down to Connection Strings.
    • On the first row, enter mongo in the first (left) box.
    • In the second box, enter your mongo connection uri from the Mlab account. (This should be written on your worksheet). Your connection will look like this one, but you must fill in your OWN information, not the sample values shown here:mongodb://

For example:

Note: In March of 2016, mongolab changed to mlab. The syntax above is the new syntax using the mlab format.


  • In the third box, click the dropdown arrow and select Custom.
  • Once you have entered this information, it will look similar to this:azure-new-connectionstrings
  • In the next row, enter mongo_collection in the first (left) box.
  • Enter entries in the second box.
    Note:</strong >If you used a custom Collection Name in your Mongo setup, type your custom name here instead of “entries.” This is not the recommended setup method.
  • Use the dropdown menu to change the type to Custom.
  • Once you have entered this information, it will look similar to this:



  • Set your API SECRET. The API SECRET is used for some of the admin features of your Nightscout site, and some uploaders use REST API Upload (REST) to upload data.As part of the configuration of your site, you need to set an API SECRET. The API_SECRET value must be a MINIMUM of 12 characters.To set the API_SECRET, enter API_SECRET in the first box in the next blank row in Connection Strings. Enter your API_SECRET value (the value you choose for this “passphrase”) in the next box. Select “Custom” for the type. (Note: You make up the API_SECRET. It can be whatever alphanumeric phrase you wish. If you set up your uploader app first and already used an API_SECRET in configuring the BASE URL, the API_SECRET you enter in Azure must match.)azure-new-apisecret
  • If you ever need to edit or see the values of your connection strings, click Show connection string values to reveal the hidden information.
  • Click Save at the top of the Settings panel.


Note: any time you “save” your information in Azure, you will see a dialog box indicating the application is saving any changes. When the process completes, you will see a dialog box indicating the changes were saved.


Note: a change in the 0.9.0 release may affect users of older uploader apps, including the Medtronic uploader. If your site does not receive data, you may need to set the following variable in Azure (or Heroku): AUTH_DEFAULT_ROLES
=readable devicestatus-upload


Step 5. Verify Your Site Loads

  • Verify that your site works by opening a new browser tab/window and entering your site url:
Note: a “profile” is required for you to view your site. The very first time you visit the site, you will be prompted to create a profile. Enter your API SECRET to authenticate your site. Then, at the minimum, select the timezone and “save” the profile. (You can always edit it later.) Return to another browser window and load your site (or enter your url again in the same window and hit enter).

If your site loads with a black screen showing the time and either dashes or your blood glucose values, your Nightscout site has deployed successfully and is running. Note: if you are following the sequence of setup steps shown on this site, you now need to install and configure the uploader app. (If you are using a cabled rig, this means setting up the Nightscout app. If you are using another uploader or configuring the bridge, return to the core directions for your specific setup and continue with the next step.) You will not see data on your Nightscout site until the uploader app (or bridge) is configured.

Plugins you “enabled” will need to be toggled on/off in the settings in the browser. When viewing your site, click the three horizontal bars top right, and scroll down to see the plugins. You can check visibility on/off, and then save the settings. If you wish to have certain plugins always visible, you can set the SHOW_PLUGINS variable with the value being the plugins you want visible. For example: SHOW_PLUGINS=careportal iob cob sage iage cage.

Step 6. Confirm Your Site is Configured as a FREE Site

If your account is new, you have 30 days in which to convert the site to Pay-As-You-Go. In addition to changing to Pay-As-You-Go, it is important that you verify that the correct Pricing Tier is in place to help prevent unexpected charges. (Note: There is no need to wait until the end of 30 days to convert your site. Do it early to avoid problems!)

We recommend you double-check your site settings by reviewing the following:

  • Confirm the Subscription type is set to Pay-As-You-Go.
  • Confirm the Pricing Tier is set to Free.


Directions to review the above settings and make necessary changes appear here.

Step 7. Learn More About Your Nightscout Site

To learn about your website’s features click here.  There are many customizable features, such as high and low alarms, high and low alerts (for warning of an approaching high/low), and other custom settings. You also can enable a range of plugins, including CarePortal, IOB (insulin on board), COB (carbs on board), CAGE (canula age), and more.


Next: Installing the Android App

NEXT:  Installing the Android App (cabled setup only)