How to Deploy an Older Version of Nightscout

1 Aug
Guides > Setup Guides > How to Deploy an Older Version of Nightscout

If some of your devices don’t meet Nightscout’s current requirements, or some other aspect of the latest version doesn’t work for you and you’d like to roll it back, you can deploy an earlier version of the code.

This guide will assume that you want to keep both versions — one Nightscout site that is fully up-to-date, and a second site that is exclusively for the older devices. If you don’t need to have the current version, and want to just replace your existing site with an older release, you can start on Step 2.

  1. Prepare your Heroku environment.
    The free tier of Heroku only supports running one app 24/7. If you deploy a second app to the same account, you will consume your free hours before the end of each month, and will have a number of days where both apps are suspended until the clock resets. There are two ways around this:

    • Start paying for the “Hobby” tier, which can accommodate multiple full-time sites. This will cost you around $7/month, but for many is worth it for the convenience of having all your sites under one roof. Or:
    • Set up a second free-tier Heroku account. You’ll need to register this second account under a different email address from the first, but you can use all the rest of your usual info (name, credit card for validation, etc.).
  2. Log into the correct Heroku account.
    Once you’ve decided which way to go, log into the account that will host the new (old-version) app. Keep this page open in a tab.
  3. Prepare your GitHub environment.
    You don’t need a second GitHub account for this, you’ll just need to make a new branch that contains the version you want to deploy.

    1. Log into your GitHub account, and get to your fork of cgm-remote-monitor.
    2. Go to the releases page:
    3. Depending on when you first forked the project, your fork might not contain all of the latest “release” tags. If you don’t see the release listed here that you want, follow the alternate directions here, then resume on Step 6 below.
    4. Find the version that you want to deploy, and click the string of random-looking letters & numbers below it.
      If you want to run this on iOS 10 or iOS 11, deploy version 0.11.1.
      If you want to run this on iOS 9 or earlier, deploy version 0.10.2.

      For this example, I’m going to choose version 0.10.2, by clicking the 75e195a link:

    5. On the page that leads to, in the upper right, click the Browse files button:
    6. On the next page, over on the left, click the Tree: button with the special number/letter string in it:
    7. Click in the field that says “Find or create a branch”, and type a name for this branch. A good name is the release version you’re deploying — in this case, I’m going to call my branch 0.10.2. Then click the Create branch link below — in blue, here:
    8. Now you’ve got a branch in your fork that contains that particular version of the Nightscout code. If you want to create more named branches for more versions, just repeat the last few steps here — find the release, browse from that point, create the branch.
  4. Deploy the new branch to Heroku.
    If you want to just replace your existing site with this older version, skip to the Alternate Instructions below. These next two steps are for deploying another app in addition to the one you already have.

    • Verify you’re in the right place by checking that the Branch selector is on the one you just made:
    • Scroll down until you see the big Nightscout logo and then the purple Deploy to Heroku button. Click that button, and then go through the app creation process as usual (described here in Step 5).
  5. Get your data into the new site.
    If this old-version site is just going to be a mirror of your main site, the easiest way to get your data mirrored is to share the same MongoDB:

    • Head over to the Config Vars for your main site, and find your MONGODB_URI variable:
    • Copy the entire string — the “mongodb://…” part — and then head over to your old-version site’s Config Vars, and paste it into the matching field there, replacing the existing contents. Save the change. You should now see all the same data showing up in the old-version site as well.


Alternate instructions for replacing your single existing site with an older version

After creating the branch containing the version you want, head to your Heroku dashboard, and then the Deploy section. If your app isn’t already connected in here to your GitHub account, follow the directions in Step 12 here to do that.

When your app is connected to your GitHub fork, choose the branch you just created down at the bottom in the Manual Deploy section, and click Deploy Branch.

Alternate instructions for finding a version that isn’t listed in your Releases list

If your Releases page doesn’t have the version you’re looking for, you can still find it:

  1. Open up a tab with this official list of releases in it. Scroll through it until you find the one you’re looking for. For this example let’s say we’re looking for 0.11.1.
  2. When you find it, note the date it was released, and the alphanumeric code — in this case, I see Feb 7 and dc7ea1b:

  3. Now go back to your own fork, and click the commits link:
  4. Scroll down through all of the commits until you get to the date you’re looking for. Verify you’ve found the right entry by matching the alphanumeric code:
  5. Click on the < > button on the far right of that entry.
  6. Head back up in this guide to Step 6 in the GitHub setup process, and continue from there.