Recreate a Site in Azure

30 Sep

So, you’ve tried everything… you’ve redeployed, you’ve disconnected and reconnected, you’ve deleted your fork and reforked. And nothing is working.

Sometimes, things happen in Azure, and a site gets corrupted, and none of the regular troubleshooting steps help.

You may be told that the next step is to recreate your site.

Don’t worry. You’ve already done most of the hard work in the past (when you first set up Nightscout). Recreating is fairly straightforward, but if you want to use the same url (the same name for your site), you need to follow directions.

  1. Log into Github. (You need to be logged in for steps later in this process to work.)
  2. Open you Azure site in a browser window. Click the configure tab. Scroll down to connection strings and click the link to reveal the hidden text.
  3. Copy the contents of each box into a separate text file (e.g., Notepad, Word, Google doc, Gmail message, Evernote file, etc.). This gives you a copy of the information you can use to cut/paste later to help avoid errors. (If you have settings in App Settings, you may want to also copy those into the text file for reference. Be sure and save the file. It may come in handy in the future!)
  4. Open your Azure site in another browser window. Click the dashboard tab.
  5. Click the delete button at the bottom.

    recreate-delete
  6. When the popup window comes up, click the arrow to confirm the deletion.

    recreate-delete-confirm
  7. After the site has been deleted, you can use the following steps to create a new site (these are the same steps used during regular Nightscout site setup).
    • Click on “Globe” (WEB APPS) icon on the left navigation of your Azure site.

      azure-menu

      As you click the buttons described below, the options will open up in a horizontal cascade of menus that look, together, like this:
      azure-newsite
    • After clicking the ‘Globe’ (WEB APPS), go to the bottom of the page and click on the ‘+ NEW‘ Button
      azure-new
    • From the expanded menu that appears, click COMPUTE:

      azure-compute
    • From the next menu that appears, click WEB APP:

      azure-webapp
    • From the next menu that appears, click QUICK CREATE:

      azure-quickcreate
    • The next menu that appears looks like this:

      azure-newsite-url
    • Enter your old site name in the URL box (unless you are creating a new site with a new name).
    • For APP SERVICE PLAN (formerly called the WEB HOSTING PLAN), leave the default option of ‘Create new app service plan
    • For REGION select one from the drop down list.  It does not need to be near you.
    • When you have filled in the information, you should have something like this (with an App Service Plan selected):

      azure-newsite-region
    • On the bottom right side of screen, Click on CREATE WEB SITE:

      azure-create
    • The website details will appear, and the STATUS will show ‘Creating….’ Wait until it completes and says ‘Running‘ before continuing.  (It may stall out or give you a message that it cannot be created.  Log in with a different browser and try again.  It may take several tries to get it to work.)azure-newsite-info2
    • Click on the web site name, and you will see a welcome page stating ‘Your site has been created!
    • On the top navigation menus, click on CONFIGURE as shown below:

      azure-newsitenavbar
    • Next, scroll down the page until you find the CONNECTION STRINGS. You need to re-enter the SAME information from your previous site, specifically the mongo, mongo_collection, and API_SECRETE need to be re-entered.
    • Use either the text file you have (where you pasted the values of these fields) or the open screen from your previous site to copy and paste the information in. DO NOT RETYPE THE INFORMATION. Copy and paste it to avoid creating new errors. Make sure ALL of these variables are set to custom as the “type.”
    • If you had other variables set in the App Settings portion of the Azure site, you can enter those now, if you choose.
    • Once you are done entering variables, click “Save” at the bottom of Azure.

      azure-config-save
  8. Reconnect to Github and select your repository:
    • Click on the DASHBOARD tab:

      azure-dash-menu
    • On the right ‘Quick Glance‘ menu, click on the ‘Set up deployment from source control‘ link.


    • Select Github.

      azure source code
    • Authorize Github/Azure access.
    • Find cgm-remote-monitor:

      azure choose repository2
    • Confirm, and wait for the site to deploy.

      azure waiting for deploymentazure active deployment

  9. Check your site in a browser to see if it works by reloading the site (if you have it open) or by visiting your site, e.g.
    http://YOURWEBSITENAME.azurewebsites.net
  10. Return to How to Update to Latest CGM-REMOTE-MONITOR Web Site