Nightscout in Northflank
Too complicated? Not what you’re looking for?
Consider a hosted Nightscout service! Check for easier solutions here.
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 ($)
The Nightscout address generated for your site is impossible to remember
Set up a new Nightscout
Create your Northflank and GitHub accounts from a computer.
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
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.
Copy the connection string from your previous platform: edit the variables and look for
If you don’t see
MONGODB_URI but see
MONGO_COLLECTION): use its value.
Step 1: Create a GitHub account and fork the Nightscout project
Do you have a GitHub account?
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
b) Enter a password and a username (anything you want and that is accepted, not very important).
n to decline advertisement emails.
c) Play and solve the puzzle then click
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).
e) If a personalization sequence starts, click
Skip personalization at the bottom.
f) Leave the page that opened as it is. Don’t close it.
You have created your GitHub account.
Update your Nightscout fork
Click here to log in at GitHub: https://github.com/login.
Enter your username or email and your password. Click
Select your own
Your repository will open. If you see
This branch is xxx commits behind nightscout:masteryou need to update.
Fetch and merge
After a moment, your repository should display
This branch is up to date with nightscout:master
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
a) Sign-up to Northflank in a new browser tab. Login with GitHub (click on the logo).
b) Confirm your GitHub account if required.
Only select repositories, in the drop-down list select
cgm-remote-monitor then click
Install & Authorize.
Skip for now.
Create free project.
g) Enter a project name (for example nightscout) and select a region (you can make it geographically close to where you live) then click
Step 3: Deploy Nightscout in Northflank
What are you trying to do now?
Add new service.
b) Don’t change anything and scroll down to
Service name. Click
Suggest random name.
c) Select your
cgm-remote-monitor and the
Buid options select
Variables and click
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.
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.
Add variable each time to add another one.
g) If you use Dexcom
bridge you need to configure these two variables with your Dexcom credentials:
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.
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.
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.
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
mmol/L (or just
i) You can add alarms values. See here for the meaning of each one.
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
If you want your site to be visible to anybody leave it as
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
l) You can modify the variables values, check the documentation for the meaning of each one.
m) add a 3 to 8 letter code to your URL.
n) Scroll down and click:
o) You now need to add a payment method.
p) Wait until your build completes. You will see a green cloud when done, it will take less than 15 minutes.
Step 4: Attach your database to your Nightscout site
a) Browse back into your project
Add variable at the end of the list.
c) Name it
MONGODB_URI and paste the string you obtained at Step 0.
Update and restart bottom right.
a) Go to your
Settings and scroll down to
!!!note “If you don’t see this option, send a mail to Northflank support to request access to the feature.”
c) Login in Heroku.
e) Select your Nightscout Heroku app then click
f) Select your project (the one you created in Step 1.g) then click
g) Verify the branch you want to migrate, usually it’s
master unless you know why you need another one.
h) Optional if your Heroku wasn’t on stack 22 select
heroku/builder-classic:22 unless you know why you want to use another one.
i) Modify your compute plan to the smallest
nf-compute-10 and click
j) Wait until import completes then return to your Dashboard (top left).
To open your Nightscout site, navigate to your project
Services and click the address link top right.
New Nightscout Setup
a) Your Nightscout site should open and direct you to a new profile creation.
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.
c) Browse down to
Authentication status and click
Authenticate. Enter your API secret. Click
e) If the following pop-up shows up click
OK, and check status (upper right of the window).
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
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.
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 can also use a free dynamic DNS service to do this in order to have something easier to remember.
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.
Services then your Nightscout project.
e) You can perform various operations on your variables:
Add a new variable with
+ Add Variable
Edit variables values directly in the table
Delete a variable with the bin icon
----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGBygGSM49AwEHBHkwdwIBAQQg7c8w00t5ju7N980r\nerN8N+isnJoec+ohIEuD0teRbPmgCgYIKoZIzj0DAQehRANCAAREnRISLSiFgdn4\nLbf44yIKspXKr7GpPBVshv3ShOms2qHTdAFriXXRPmbq7eAJuFrxpYOduU1dl9vo\nouciW0je\n-----END PRIVATE KEY-----
Don’t forget to
Update & restart when you’re done editing.