How To Heroku – An Alternative Hosting Solution (16-Jan-2015)

22 Nov

Revision for “How To Heroku – An Alternative Hosting Solution (16-Jan-2015)” created on March 8, 2017 @ 17:17:49

Title
How To Heroku - An Alternative Hosting Solution (16-Jan-2015)
Content
<strong>Note: <a href="http://www.nightscout.info/wiki/welcome/set-up-nightscout-using-heroku">Updated directions are available for setting up a Heroku site.</a></strong> Drafted By:                            Greg Waehner and Jim Sifferle Edited By:                              #WeAreNotWaiting Last Updated:                      20-Feb-2015 Version:                                   0.5 <strong>Purpose:</strong> This Nightscout Labs is intended to provide “do-it-yourself” (DIY) guidance on how to begin using Heroku as a complementary Nightscout Cloud Provider. <strong>Disclaimer:</strong> While Heroku is not "the Community standard" and the official documentation is not written using Heroku interfaces, this Lab demonstrates how just how simple Heroku is now. It is quicker to setup than Azure, does not have the "Mongo" outages that Azure has... so what's the disclaimer... it may drive you to abandon Azure and adopt Heroku as your hosting solution before the rest of the Nightscout Support Team can update all the documentation and even train all our own personnel!! <strong>Feedback:</strong> This Lab is an evolving document. Please provide feedback, additional information, and recommendations for enhancements. <strong>Preparation:</strong> First, put your left foot in, take your left foot out… oh wait… this isn’t the Hokie Pokie… just checking to ensure you’re actually reading the Lab. <strong>Comparison to Azure:</strong> The benefits of using Heroku as a complement to, or replacement of your existing Azure hosting include: <ul> <li>Website site hosting that is separate from Azure in support of redundancy;</li> <li>Supports WebSockets by default (a more efficient protocol for Nightscout website)</li> <li>Data transfer does not appear to be limited;</li> <li>Can set up 5 – 100 sites on one account (must be verified with credit card for 100);</li> <li>Automated site creation capability;</li> <li>Ability to have more technical capabilities such as command-line capabilities</li> </ul> Like Azure, Heroku… <ul> <li>Is free as long as you stay within its constraints (<strong>Note:</strong> the Heroku pricing model changed in 2015; sites are free if they sleep 6 hours a day. There is a fee for 24/7 sites.);</li> <li>Provides SSL for data encryption;</li> <li>Supports the REST API;</li> <li>Integrates with GitHub; and</li> <li>Has an “update your website” integration with GitHub <em>(which was missing when this Lab was originally written in Nov. 2013)</em>.</li> </ul> However, Heroku has different terminology and interfaces - though that's easy to overcome. The following is written for the very initial setup - the first time user who has never setup anything before using Dreamsicle (cgm-remote-monitor Release/0.6.0) <strong>Step 1: Create your Heroku Account</strong> <ol> <li>Visit www.heroku.com and click the [Sign Up For Free] button.</li> <li>Submit your Email address and click the confirmation link in your Inbox.</li> <li>Choose a password.</li> <li>Do the credit card verification</li> </ol> <strong>Step 2: Create your Nightscout website for “cgm-remote-monitor”</strong> From your GitHub repository for “cgm-remote-monitor,” scroll down to the README.md and click the “Deploy to Heroku” button <a href="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-2.png"><img class="alignnone size-full wp-image-1511" src="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-2.png" alt="heroku 2" width="508" height="152" /></a> &nbsp; <strong>Step 3: Populate the data form</strong> <ul> <li>Name: Enter the name for your app – your website (e.g., NAME.herokuapp.com)</li> <li>Region: Choose the region for your website</li> <li>Env <ul> <li>Ensure “entries” is the collection name</li> <li>Enter your “API_SECRET” value. This is the passcode for the REST API upload.</li> <li>Set the ENABLE variable.  Include "careportal", "rawbg" or both (e.g. <span class="redText">careportal rawbg</span>) to enable Care Portal and/or raw BG.</li> <li>If you are going to enable custom alarm settings, enter your preferred values for ALARM_TYPES, BG_HIGH, BG_TARGET_TOP, BG_TARGET_BOTTOM, and BG_LOW</li> <li>If you are going to use Pushover, then enter the PUSHOVER_API_TOKEN and PUSHOVER_USER_KEY.</li> </ul> </li> <li>Click “Deploy For Free”</li> </ul> &nbsp; <a href="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-2-1.png"><img class="alignnone size-full wp-image-1508" src="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-2-1.png" alt="heroku 2-1" width="677" height="439" /></a> &nbsp; <img class="alignnone wp-image-1928" src="http://www.nightscout.info/wp-content/uploads/2014/11/Screen-Shot-2015-01-29-at-8.35.30-PM-300x226.png" alt="Screen Shot 2015-01-29 at 8.35.30 PM" width="609" height="458" /> <img class="alignnone wp-image-1929" src="http://www.nightscout.info/wp-content/uploads/2014/11/Screen-Shot-2015-01-29-at-8.35.40-PM.png" alt="Screen Shot of Environment Variables" width="600" height="474" /> &nbsp; Congratulations! Your first Heroku-hosted Nightscout app has been created and/or configured. <strong> <a href="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-2-3.png"><img class="alignnone size-full wp-image-1510" src="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-2-3.png" alt="heroku 2-3" width="637" height="419" /></a></strong> &nbsp; <strong> Step 4: Configure Your Phone Uploader</strong> <ul> <li>Configure your phone uploader for REST API upload. <ul> <li>If your uploader is running 0.1.10 (Cookie Monster) or the original version of xDrip, set the REST API URL using the following format: API_SECRET@https://&lt;sitename&gt;.herokuapp.com/api/v1</li> <li>If your uploader is running 0.1.12 (Dreamsicle) or a beta version of xDrip, set the REST API URL using the following format: https://API_SECRET@&lt;sitename&gt;.herokuapp.com/api/v1</li> </ul> </li> </ul> &nbsp; <strong>Step 5: Verify It’s Working</strong> To verify it’s working, you will used the “follow the data” methodology. The phone uploader using the REST API will send the SGV information to the Heroku app, which then stores it in the MongoLab database. So within your Heroku App, click Resources, and then MongoLab. <a href="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-5-1.png"><img class="alignnone size-full wp-image-1512" src="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-5-1.png" alt="heroku 5-1" width="377" height="329" /></a> &nbsp; This will bring up your MongoLab database where you can see the collections – and you entered “entries” as the collection name to store the SGV information. <em> </em> <em>Note: If you are asking yourself where the MongoLab database came from, then the quick answer is that the automated deployment process uses the free integrated “add-on” MongoLab capability and creates a MongoLab Account and database for the Heroku App. While you can discover most information about the database by looking, you can NOT discover the database user password. But you can see all the information, including the password, within the “Environment Variables.” However, the point of this automated deployment is that it abstracts away the persistence layer (the database) so you no longer need to be concerned about it. </em> Now that you have gotten beyond “where the database came from,” you can return to verifying whether or not the uploader is successfully sending the SGV using the REST API to the Heroku app and getting stored in the MongoLab database collection – in short… is it working? Once you see your “SGV collection” (entries) documents increasing, you know it is working. If that’s not sufficient because the website won't render data until approximately 5 SGVs, then you can immediately verify using the pebble data endpoint URL. <a href="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-5-2.png"><img class="alignnone size-full wp-image-1513" src="http://www.nightscout.info/wp-content/uploads/2014/11/heroku-5-2.png" alt="heroku 5-2" width="975" height="360" /></a> &nbsp; Congratulations! You have successfully deployed ‘Nightscout’ (a.k.a. cgm-remote-monitor) to your first Heroku site, configured your uploader to utilize it with the REST API, and verified that it’s working end-to-end. &nbsp; <strong>Step 6: Update Processes</strong> In this updated (version 0.3) Labs version, Heroku has released native GitHub integration similar to and even better than Azure. As such, the recommendation is to use the GitHub integration -- instead of other possible solutions available within Heroku -- to have consistent processes and support whether you use Azure or Heroku. To integrate GitHub with your Heroku App / Site, it could be the first site that you just created 5 seconds ago, or it could be a site you created 3 months ago. The following steps to add integration can be done with any existing app / site - the instructions are included in this Lab simply as an "end to end" how to get up and running on Heroku as a first time user. <ol> <ol> <li>Find the site / app you just created by selecting “Personal Apps” on the left column.</li> </ol> </ol> <img class="alignnone size-medium wp-image-1866" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step1_personalapp-300x81.png" alt="UpdateProcesses_step1_personalapp" width="300" height="81" /> <ol> <ol> <li>Choose Deploy from the app toolbar.</li> </ol> </ol> <a href="http://www.nightscout.info/wp-content/uploads/2014/11/Screen-Shot-2015-01-29-at-8.46.27-PM.png"><img class="alignnone size-full wp-image-1934" src="http://www.nightscout.info/wp-content/uploads/2014/11/Screen-Shot-2015-01-29-at-8.46.27-PM.png" alt="Screen Shot 2015-01-29 at 8.46.27 PM" width="119" height="58" /></a> <ol> <ol> <li>Choose “Connect to GitHub.”</li> </ol> </ol> <img class="alignnone size-full wp-image-1868" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step3_connectToGithub.png" alt="UpdateProcesses_step3_connectToGithub" width="235" height="99" /> <ol> <ol> <li>Choose “Connect to GitHub.”</li> </ol> </ol> <img class="alignnone size-full wp-image-1869" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step4_connectToGithub.png" alt="UpdateProcesses_step4_connectToGithub" width="230" height="68" /> <ol> <ol> <li>By granting authorization, you are giving your Heroku app access to your GitHub (which you started from and used to create the site).</li> </ol> </ol> <img class="alignnone size-full wp-image-1870" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step5_AuthApp.png" alt="UpdateProcesses_step5_AuthApp" width="266" height="139" /> <ol> <ol> <li>If prompted, enter your GitHub password…</li> </ol> </ol> <img class="alignnone size-medium wp-image-1871" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step6_Password-300x143.png" alt="UpdateProcesses_step6_Password" width="300" height="143" /> <ol> <ol> <li>Once Heroku connects to Github, you will see something like this… your GitHub account and a “search box” for a repo-name (a.k.a. repository)</li> </ol> </ol> <img class="alignnone size-medium wp-image-1872" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step7_GitHubSearchRepo-300x34.png" alt="UpdateProcesses_step7_GitHubSearchRepo" width="300" height="34" /> <ol> <ol> <li>In the blank “repo-name” box, enter “cgm-remote“ and click the Search button. It should find one result, like below. Click the “Connect” button associated with your “[GitHub username]/cgm-remote-monitor”</li> </ol> </ol> <img class="alignnone size-medium wp-image-1873" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step8_GitHib_RepoConnect-300x56.png" alt="UpdateProcesses_step8_GitHib_RepoConnect" width="300" height="56" /> <ol> <ol> <li>This will “link” the Heroku app to the repository…. You will get a screen like the following -- and now the cool stuff begins….</li> </ol> </ol> <img class="alignnone size-medium wp-image-1874" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step9_Github_ConfigScreen-300x179.png" alt="UpdateProcesses_step9_Github_ConfigScreen" width="300" height="179" /> <ol> <li>Choose what type of code update methodology you want. On this screen, you can choose whether you want a <strong>manual update</strong> or an <strong>automatic update</strong>. <ul> <ul> <li>For the manual deployment, you can select a branch, and click Deploy Branch. The current state of that branch will be deployed.</li> </ul> </ul> <img class="alignnone size-medium wp-image-1875" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step10_AutoDeployment-300x179.png" alt="UpdateProcesses_step10_AutoDeployment" width="300" height="179" /> <ul> <ul> <li>For the automated deployment, every update you make to the branch (generally, every update you make to your Master branch), will automatically be deployed. This is how GitHub integrates with Azure. However, with Heroku, you also have a choice of checking “Wait for CI to pass before deploy” which means that Continuous Integration tests must pass before the automated deployment will proceed. Make your choices, and then click “Enable Automatic Deploys”</li> </ul> </ul> <img class="alignnone size-medium wp-image-1876" src="http://www.nightscout.info/wp-content/uploads/2014/11/UpdateProcesses_step10_ManualDeployment-300x169.png" alt="UpdateProcesses_step10_ManualDeployment" width="300" height="169" /></li> </ol> <strong>You are done!</strong>
Excerpt


OldNewDate CreatedAuthorActions
March 8, 2017 @ 17:17:49 Amy Cowen
March 8, 2017 @ 17:17:20 Amy Cowen
March 8, 2017 @ 17:16:55 Amy Cowen
December 21, 2015 @ 18:05:52 Amy Cowen
December 21, 2015 @ 18:05:19 [Autosave] Amy Cowen
December 21, 2015 @ 18:04:14 Amy Cowen
February 20, 2015 @ 18:54:22 [Autosave] Jim Sifferle
February 20, 2015 @ 18:45:38 Jim Sifferle
January 31, 2015 @ 08:23:13 Greg Waehner
January 31, 2015 @ 08:21:21 [Autosave] Greg Waehner
January 31, 2015 @ 08:08:01 Greg Waehner
January 29, 2015 @ 22:49:11 Jim Sifferle
January 29, 2015 @ 22:48:28 Jim Sifferle
January 29, 2015 @ 22:45:31 Jim Sifferle
January 29, 2015 @ 22:42:35 Jim Sifferle
January 29, 2015 @ 22:39:20 Jim Sifferle
January 16, 2015 @ 18:57:20 Greg Waehner
January 16, 2015 @ 17:56:43 Greg Waehner
January 16, 2015 @ 17:48:46 Greg Waehner
January 16, 2015 @ 17:40:50 Greg Waehner
January 16, 2015 @ 17:29:21 Greg Waehner
November 23, 2014 @ 20:48:53 Greg Waehner
November 23, 2014 @ 20:05:15 Greg Waehner
November 22, 2014 @ 13:22:52 Gail DeVore

One thought on “How To Heroku – An Alternative Hosting Solution (16-Jan-2015)

  1. Found the first mistake… For the Heroku site automated deploy, this was written based upon “development” branch. Right now, the MASTER branch only provides the collection, which you will need to rename to “entries.” The other variables can be added in from the App Dashboard, Config Vars. The instructions as written will be correct for the MASTER branch once the next set of patches are released.

Comments are closed.