Nightscout in Northflank


Too complicated? Not what you’re looking for?

Consider a hosted Nightscout service! Check for easier solutions here.


Northflank

You can create your new Northflank Nightscout site with a MongoDB Atlas database or with its own Northflank database.

Pros:

  • Nightscout fits in the free tier

  • Easy to deploy or migrate an existing site from Heroku

  • Simple to use and troubleshoot

  • Can use a native Northflank MongoDB database

  • You can deploy up to $20/mo worth of free resources on Northflank’s managed cloud

Cons:

  • The Nightscout address generated for your site is virtually impossible to remember


Set up a new Nightscout

Create your Northflank and GitHub accounts from a computer.

Note

Do not change device/computer/browser during the setup process!
If you have unexpected issues when creating your site, restart with another browser.


Step 0: Create a database

Note

Make sure you created one before starting your Nightscout web app creation with Northflank. Come back here when you have a MONGODB_URI connection string.

Migrating?

Copy the connection string from your previous platform: edit the variables and look for MONGODB_URI. If you don’t see MONGODB_URI but see MONGO_CONNECTION (NOT MONGO_COLLECTION): use its value.


Step 1: Create a GitHub account and fork the Nightscout project

Continue with Step 2.

Create a GitHub account

a) Click this link to create a GitHub account: https://github.com/

Enter your email and click Sign up for GitHub

../../../_images/NewNS00a.png

b) Enter a password and a username (anything you want and that is accepted, not very important).
Type n to decline advertisement emails.

../../../_images/NewNS00.png

c) Play and solve the puzzle then click Create account

../../../_images/NewNS01.png

d) GitHub will send you a verification code. Open your mail and check your inbox (check your spam-folder if not received after a couple of minutes).

../../../_images/NewNS02.png

e) If a personalization sequence starts, click Skip personalization at the bottom.

../../../_images/NewNS03.png

f) Leave the page that opened as it is. Don’t close it.

../../../_images/NewNS04.png

You have created your GitHub account. Now fork the Nightscout project.


Fork the Nightscout project

a) 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

If you already have a fork of cgm-remote-monitor in GitHub

Delete or update your current cgm-remote-monitor fork before continuing.

b) Open this link https://github.com/nightscout/cgm-remote-monitor. Click on Fork

../../../_images/NewNS29.png

Confirm with Create fork

Warning

Make sure you deselect Copy the master branch only.

../../../_images/NewNS51.png

c) Wait for a moment

../../../_images/NewNS30.png

d) You now have a copy (fork) of the Nightscout project repository in your own GitHub.

../../../_images/UpdateNS30.png

Update your Nightscout fork

  • 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. If you see This branch is xxx commits behind nightscout:master you need to update.

  • Select Fetch upstream

../../../_images/UpdateNS01a.png

  • Select Fetch and merge

../../../_images/UpdateNS01b.png

  • After a moment, your repository should display This branch is up to date with nightscout:master

../../../_images/UpdateNS01c.png

You have now updated your GitHub cgm-remote-monitor repository.


If you ran into trouble, you can redeploy the project.



Step 2: Create a Northflank account

If you already created your database in Northflank, skip to step 3.

a) Sign-up to Northflank in a new browser tab. Login with GitHub (click on the logo).

../../../_images/Northflank00.png

b) Confirm your GitHub account if required.

../../../_images/Northflank01.png

c) Select Only select repositories, in the drop-down list select cgm-remote-monitor then click Install & Authorize.

../../../_images/Northflank02.png

c) Enter a user name, your email address and invent a password (type it twice to confirm). Accept the TOS and Privacy Policy then click Continue .

../../../_images/Northflank03.png

d) Click Choose theme.

../../../_images/Northflank04.png

e) Select Skip for now.

../../../_images/Northflank05.png

f) Select Create free project.

../../../_images/Northflank06.png

g) Enter a project name (for example nightscout) and select a region (you can make it geographically close to where you live) then click Create project.

../../../_images/Northflank07.png

Step 3: Deploy Nightscout in Northflank

What are you trying to do now?

If you already created a Nightscout project (for example if you created your database in Northflank), select it now.

../../../_images/Northflank32.png


a) Select Add new service or New service.

../../../_images/Northflank08.png


b) Select Deploy a Docker image. Scroll down and put a name in Service name or click Suggest random name.

../../../_images/Northflank33.png


c) In Deployment, select External image and type nightscout/cgm-remote-monitor:latest in Image path.

../../../_images/Northflank34.png


d) Expand Variables and click Add variable.

../../../_images/Northflank12.png


e) Setup your Nightscout core variables.

Tip

If you want to copy all variables from Heroku, follow these instructions and then continue to l) below.

API_SECRET will be your Nightscout site password, it needs to be at least 12 characters long and you should NOT use spaces if you use @ or ! symbols remember you will probably need to express them using Percent encoding in your uploader and downloader apps. If you’re not sure on how to do this, it is recommended to use only letters (uppercase + lowercase) and digits.

Warning

The API_SECRET is the main password allowing full access to your Nightscout site. Make sure it’s reasonably secure (mix uppercase and lowercase letters, plus digits) and do no not share it publicly. If you think you exposed it by mistake, it is recommended that you change it.

../../../_images/Northflank13.png

Click Add variable each time to add another one.


Dexcom Bridge

f) If you use Dexcom bridge you need to configure these two variables with your Dexcom credentials:

../../../_images/Northflank14.png

../../../_images/Northflank15.png

If you’re using Dexcom Share in the US you should put US, in any other case it must be EU.
If you don’t see it proposed at this point you’ll need to browse the list below to find it and modify it.

../../../_images/Northflank16.png

Remember to add bridge at the end of the enable variable in the list below.


MOST COMMON ERRORS

The most common error on initial Nightscout setups is that people incorrectly use an old account or an old password. To test your username and password, go to Dexcom’s Clarity page (check here for USA accounts and here for the others) and try logging in to your Dexcom account. If your account info isn’t valid, or you don’t see any data in your Clarity account… you need to figure out your actual credentials before moving ahead. See here for troubleshooting tips and information on your Dexcom account.

Password

Some people have had problems with their bridge connecting when their Dexcom passwords are entirely numeric. If you have connection issues in that case, try changing your password to something with a mix of numbers and letters.

Hint

You need to have at least one follower to use Dexcom Share. See here.


g) Select the units you’re using in DISPLAY_UNITS acceptable choices are mg/dl or mmol/L (or just mmol).

../../../_images/Northflank17.png


h) You can add alarms values. See here for the meaning of each one.

../../../_images/Northflank18.png


i) If you want to ensure that ONLY someone with permission to view your site (e.g., a token or the API_SECRET) is able to view the data, you should configure the AUTH_DEFAULT_ROLES variable in as denied.
If you want your site to be visible to anybody leave it as readable.

../../../_images/Northflank19.png


j) In ENABLE, copy and paste the following words (separated by a space) so that won’t have to think about which you want now:

careportal basal dbsize rawbg iob maker cob bwp cage iage sage boluscalc pushover treatmentnotify loop pump profile food openaps bage alexa override speech cors

If you are using your Dexcom share account as a data source also add bridge at the end, after a space like this:

careportal basal dbsize rawbg iob maker cob bwp cage iage sage boluscalc pushover treatmentnotify loop pump profile food openaps bage alexa override speech cors bridge

../../../_images/Northflank20.png


k) You can modify the variables values, check the documentation for the meaning of each one.


l) You can modify the 3 to 8 letter code to your URL.

../../../_images/Northflank21.png


m) Scroll down and check you’re using an nf-compute-10 plan, then click: Create Service

../../../_images/Northflank22a.png

../../../_images/Northflank22.png


n) If not done before, you now need to add a payment method.

../../../_images/Northflank23.png


o) Wait until your build completes. You will see a green cloud when done, it will take less than 15 minutes.

../../../_images/Northflank24.png



Step 4: Attach your database to your Nightscout site


a) Browse back into your project Service then Environment, click Edit.

../../../_images/Northflank25.png


b) Select Add variable at the end of the list.

../../../_images/Northflank26.png


c) Name it MONGODB_URI and paste the string you obtained at Step 0.

../../../_images/Northflank27.png


d) Click Update and restart bottom right.

../../../_images/Northflank28.png


If you already created a Nightscout project (for example if you created your database in Northflank), select it now.

../../../_images/Northflank32.png


a) Select Add new service or New service.

../../../_images/Northflank08.png


b) Select Build and deploy a Git repo. Scroll down and put a name in Service name or click Suggest random name.

../../../_images/Northflank09.png


c) Select your cgm-remote-monitor and the master branch.

../../../_images/Northflank10.png


d) In Buid options select Buildpack.

../../../_images/Northflank11.png


Open Advanced build settings and select heroku/builder-classic:22.

../../../_images/Northflank11b.png


e) Expand Variables and click Add variable.

Tip

If you want to copy all variables from Heroku, follow these instructions and then continue to m) below.

../../../_images/Northflank12.png


f) Setup your Nightscout core variables.

API_SECRET will be your Nightscout site password, it needs to be at least 12 characters long and you should NOT use spaces if you use @ or ! symbols remember you will probably need to express them using Percent encoding in your uploader and downloader apps. If you’re not sure on how to do this, it is recommended to use only letters (uppercase + lowercase) and digits.

Warning

The API_SECRET is the main password allowing full access to your Nightscout site. Make sure it’s reasonably secure (mix uppercase and lowercase letters, plus digits) and do no not share it publicly. If you think you exposed it by mistake, it is recommended that you change it.

../../../_images/Northflank13.png

Click Add variable each time to add another one.


Dexcom Bridge

g) If you use Dexcom bridge you need to configure these two variables with your Dexcom credentials:

../../../_images/Northflank14.png

../../../_images/Northflank15.png

If you’re using Dexcom Share in the US you should put US, in any other case it must be EU.
If you don’t see it proposed at this point you’ll need to browse the list below to find it and modify it.

../../../_images/Northflank16.png

Remember to add bridge at the end of the enable variable in the list below.


MOST COMMON ERRORS

The most common error on initial Nightscout setups is that people incorrectly use an old account or an old password. To test your username and password, go to Dexcom’s Clarity page (check here for USA accounts and here for the others) and try logging in to your Dexcom account. If your account info isn’t valid, or you don’t see any data in your Clarity account… you need to figure out your actual credentials before moving ahead. See here for troubleshooting tips and information on your Dexcom account.

Password

Some people have had problems with their bridge connecting when their Dexcom passwords are entirely numeric. If you have connection issues in that case, try changing your password to something with a mix of numbers and letters.

Hint

You need to have at least one follower to use Dexcom Share. See here.


h) Select the units you’re using in DISPLAY_UNITS acceptable choices are mg/dl or mmol/L (or just mmol).

../../../_images/Northflank17.png


i) You can add alarms values. See here for the meaning of each one.

../../../_images/Northflank18.png


j) If you want to ensure that ONLY someone with permission to view your site (e.g., a token or the API_SECRET) is able to view the data, you should configure the AUTH_DEFAULT_ROLES variable in as denied.
If you want your site to be visible to anybody leave it as readable.

../../../_images/Northflank19.png


k) In ENABLE, copy and paste the following words (separated by a space) so that won’t have to think about which you want now:

careportal basal dbsize rawbg iob maker cob bwp cage iage sage boluscalc pushover treatmentnotify loop pump profile food openaps bage alexa override speech cors

If you are using your Dexcom share account as a data source also add bridge at the end, after a space like this:

careportal basal dbsize rawbg iob maker cob bwp cage iage sage boluscalc pushover treatmentnotify loop pump profile food openaps bage alexa override speech cors bridge

../../../_images/Northflank20.png


l) You can modify the variables values, check the documentation for the meaning of each one.


m) You can modify the 3 to 8 letter code to your URL.

../../../_images/Northflank21.png


n) Scroll down and check you’re using an nf-compute-10 plan, then click: Create Service

../../../_images/Northflank22a.png

../../../_images/Northflank22.png


o) If not done before, you now need to add a payment method.

../../../_images/Northflank23.png


p) Wait until your build completes. You will see a green cloud when done, it will take less than 15 minutes.

../../../_images/Northflank24.png



Step 4: Attach your database to your Nightscout site


a) Browse back into your project Service then Environment, click Edit.

../../../_images/Northflank25.png


b) Select Add variable at the end of the list.

../../../_images/Northflank26.png


c) Name it MONGODB_URI and paste the string you obtained at Step 0.

../../../_images/Northflank27.png


d) Click Update and restart bottom right.

../../../_images/Northflank28.png


Warning

If you already have a Northflank database, you cannot use this wizard. Create a new Northflank Nightscout site with only MONGODB_URI and API_SECRET then manually copy your Heroku variables.

a) Go to your Account Dashboard - Settings and scroll down to Import.
Select Heroku.

../../../_images/NorthflankM01.png

Note

If you don’t see this option, send a mail to Northflank support to request access to the feature.



b) Click Link Heroku.

../../../_images/NorthflankM02.png



c) Login in Heroku.

../../../_images/NorthflankM03.png



d) Click Allow.

../../../_images/NorthflankM04.png



e) Select your Nightscout Heroku app then click Continue.

../../../_images/NorthflankM05.png



f) Select your project (the one you created in Step 1.g) then click Continue.

../../../_images/NorthflankM06.png



g) Verify the branch you want to migrate, usually it’s master unless you know why you need another one.

../../../_images/NorthflankM07.png



h) Select heroku/builder-classic:22.

../../../_images/NorthflankM08.png



i) Modify your compute plan to the smallest nf-compute-10 and click Continue.

../../../_images/NorthflankM09.png



j) Wait until import completes then return to your Dashboard (top left).

../../../_images/NorthflankM10.png



To open your Nightscout site, navigate to your project Services and click the address link top right.

../../../_images/Northflank29.png

Good time to check you selected the right plan.

Make sure you selected the developer sandbox plan to avoid unexpected fees.

../../../_images/NorthflankSP.png

New Nightscout Setup


a) Your Nightscout site should open and direct you to a new profile creation.

../../../_images/NewNS50.png

b) Setup your Time zone and eventually all other fields. Do not leave any fields empty. If you don’t know which value to use, just use the default value. You can change these values later at any time.

../../../_images/NewNS44.png

c) Browse down to Authentication status and click Authenticate. Enter your API secret. Click Update.

../../../_images/NewNS45.png

d) Click Save.

../../../_images/NewNS46.png

e) If the following pop-up shows up click OK, and check status (upper right of the window).

../../../_images/NewNS47.png

f) If you need to modify your profile after this, authenticate with the lock icon (top right of the page): enter your API secret. Then click on the hamburger menu and select Profile Editor.

../../../_images/NewNS43.png

Privacy warning

Anyone with access to the URL of your Nightscout site, can view your BG and run reports of your data. It it strongly recommended that you enable security to your site once you’re done with the setup


g) Dexcom Share users should see data flowing in after some minutes. xDrip+ users (including Medtronic CareLink followers) should setup the uploader as shown here. xDrip4iOS users here. AAPS and Loop: consult the relative documentation.

../../../_images/NewNS48.png

You have completed a new Nightscout site creation. You can continue here now.

The following section provides more information that you might not need to use now.





Change your Northflank Nightscout site name

You cannot override the default name if you don’t have a DNS.
You can use TinyURL to get a shorter name.

../../../_images/TinyURL.png

You can also use a free dynamic DNS service to do this in order to have something easier to remember.

Keep the original Northflank URL in your uploaders and followers.



You have completed a new Nightscout site creation. The following section provides more information for variables edition that you might not need to use now.



Editing Variables in Northflank


a) Open Northflank and login with your username or with GitHub.

../../../_images/Northflank30.png

b) Select Services then your Nightscout project.

../../../_images/Northflank31.png

c) Select Environment then Edit.

../../../_images/Northflank25.png

e) You can perform various operations on your variables:

  1. Add a new variable with + Add Variable

  2. Edit variables values directly in the table

  3. Delete a variable with the bin icon

Note

Multiple lines values should be typed with \n separating each original line.
Example:
../../../_images/APNKeys.png

----BEGIN PRIVATE KEY-----\n
MIGTAgEAMBMGBygGSM49AwEHBHkwdwIBAQQg7c8w00t5ju7N980rerN8N+isnJoec+ohIEuD0teRbPmgCgYIKoZIzj0DAQehRANCAAREnRISLSiFgdn4Lbf44yIKspXKr7GpPBVshv3ShOms2qHTdAFriXXRPmbq7eAJuFrxpYOduU1dl9voouciW0je
\n-----END PRIVATE KEY-----

Don’t forget to Update & restart when you’re done editing.


Copy all variables from Heroku


a) Export all your Heroku variables as explained here. In a file you can call heroku.env.

If you’re currently deploying a new Northflank Nightscout site, select Env.

../../../_images/Northflank36.png

Continue to c) below.


b) If you want to modify an existing Northflank site,

Open Northflank and login with your username or with GitHub.

../../../_images/Northflank30.png

Select Services then your Nightscout project.

../../../_images/Northflank31.png

Select Environment then Env.

../../../_images/Northflank39.png

c) Select Import from file then the file (heroku.env) you saved in a).

../../../_images/Northflank37.png

Your variables should display like this:

../../../_images/Northflank38.png

d) If you’re creating a new site, return to the step you were following before importing all variables from Heroku.


e) If you were importing all variables from a running Northflank Nightscout site, select Update & restart.

../../../_images/Northflank40.png