Deploy another version

If you need to return to the previous Nightscout version, or in rare occasions, like testing a specific fix or a feature that is not released yet (i.e. not in the master branch), you might need to deploy another branch like dev in the example below.

Do not deploy dev or a branch other than master unless directed to do so (except if you know why you are doing so).

Step 1: Update your repository in GitHub

  • Skip this step if you’re using Azure.

  • Click here to log in at GitHub: https://github.com/login.

  • Enter your username or email and your password. Click Sign in

../../_images/UpdateNS00.png
  • Select your own cgm-remote-monitor project (not nightscout/cgm-remote-monitor)

../../_images/UpdateNS01.png
  • Your repository will open.

../../_images/Dev00.png
  • In the branch drop down menu (normally showing master) select dev

../../_images/Dev01.png
  • ClickFetch upstream to update it, then Fetch and merge

../../_images/Dev03.png
  • After a moment, your repository should display This branch is up to date with nightscout:dev

../../_images/Dev04.png
  • If you ran into trouble, try to Redeploy (and this is mandatory if you don’t see dev in GitHub.)


Step 2: Deploy

Select your platform below:

  • Log in Heroku https://id.heroku.com/login

    ../../_images/UpdateNS15.png

  • Select your app (hidden in yellow)

    ../../_images/UpdateNS16.png

  • Click on Deploy

    ../../_images/UpdateNS17.png

  • Verify Heroku is connected to GitHub, if not, click Connect to GitHub

    ../../_images/UpdateNS18.png

  • If Heroku is not connected to GitHub, scroll down and click Connect to GitHub, if a popup window opens and requires authorization, click Authorize Heroku

    ../../_images/UpdateNS19.png

  • Verify your app cgm-remote-monitor is connected to GitHub

    ../../_images/UpdateNS20.png

  • If it isn’t, In Connect to GitHub, type cgm-remote-monitor and click Search then click Connect

    ../../_images/UpdateNS21.png

  • If you have trouble connecting your app, click Disconnect and reconnect it as shown above

    ../../_images/UpdateNS22.png

  • Scroll down to the bottom of the page, select the dev branch and click Deploy Branch

    ../../_images/Dev05.png

  • Build will start and information will scroll in the log window. Do not leave the page, do not interfere and wait for completion. It might take more than 10 minutes. Interrupting the process will lead to a broken site and you’ll need to restart deployment.

    ../../_images/UpdateNS24.png

  • Wait until the deploy process completes and click View (if nothing happens click Manage App then upper right Open App)

    ../../_images/UpdateNS25.png

  • Open Railway and click login. Login with GitHub.

    ../../_images/Railway00.png

    ../../_images/Railway01.png

  • Select your Nightscout project.

    ../../_images/RailwayM15.png

  • Select your web app.

    ../../_images/RailwayM16.png

  • Still in Settings look at Environment.

  • Change the Deployment Trigger with dev (it was showing master).

    ../../_images/Dev07.png

  • If you only see master in the list you need to redeploy taking care to select all branches and not only master.
    ../../_images/Dev06.png

  • Once dev selected Railway will deploy automatically.

  • Log into Northflank: https://app.northflank.com/login

  • Select your Nightscout project

    ../../_images/Dev14.png

  • Select your Nightscout service

    ../../_images/Dev15.png

  • Click on the pen icon after the current branch (example below: master)

    ../../_images/Dev16.png

  • In the branch list, select the version you want to deploy, then click Update Build Source

    ../../_images/Dev17.png

  • Your site will redeploy with the selected branch

  • Log into Azure : https://portal.azure.com/

  • Select your App service, your Nightscout site name (you should see it in recent resources)

    ../../_images/Azure42.png

  • If you didn’t find it, it will show in App Services

    ../../_images/Azure43.png

  • In the left menu select Deployment Center, in Full Image Name and Tag change the version to:

    nightscout/cgm-remote-monitor:latest_dev (example for dev)

    Or whichever version (change filter tag find the version) in the list.

    nightscout/cgm-remote-monitor:14.2.6 (example for 14.2.6)

    ../../_images/Dev12.png

  • Click Save (or Discard if you don’t want to save).
    Your site will redeploy if you changed the configuration. Expect a few minutes before it comes back online.

    ../../_images/Dev13.png

a) Open a Web Terminal, and type:

git clone https://github.com/nightscout/cgm-remote-monitor

cd cgm-remote-monitor

b) Update your local fork

git config pull.rebase true

git pull origin dev

c) Deploy the changes (replace yourappname by the actual name of your fly.io Nightscout app).

flyctl deploy -a yourappname

Deploy will take some time and should complete with the message

Visit your newly deployed app at https://yourappname.fly.dev

d) Don’t forget to downscale the app!

flyctl scale count 1


Check your profile time zone is correct. You’re done!



How to return to the master release

If things don’t go as expected you can simply redeploy your master branch performing the same steps and using master instead of dev.

When the dev branch gets merged into release, just follow the classic update method.