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
b) Enter a password and a username (anything you want and that is accepted, not very important).
Type n
to decline advertisement emails.
c) Play and solve the puzzle then click Create account
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. 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
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
Confirm with Create fork
Warning
Make sure you deselect Copy the master branch only
.
c) Wait for a moment
d) You now have a copy (fork) of the Nightscout project repository in your own GitHub.
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
Select your own
cgm-remote-monitor
project (notnightscout/cgm-remote-monitor
)
Your repository will open. If you see
This branch is xxx commits behind nightscout:master
you need to update.Select
Fetch upstream
Select
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
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).
b) Confirm your GitHub account if required.
c) Select Only select repositories
, in the drop-down list select cgm-remote-monitor
then click Install & Authorize
.
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
.
d) Click Choose theme
.
e) Select Skip for now
.
f) Select 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 Create project
.
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.
a) Select Add new service
or New service
.
b) Select Deploy a Docker image
. Scroll down and put a name in Service name
or click Suggest random name
.
c) In Deployment
, select External image
and type nightscout/cgm-remote-monitor:latest
in Image path
.
d) Expand Variables
and click Add variable
.
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.
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:
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.
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
).
h) You can add alarms values. See here for the meaning of each one.
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
.
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
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.
m) Scroll down and check you’re using an nf-compute-10
plan, then click: Create Service
n) If not done before, you now need to add a payment method.
o) 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 Service
then Environment
, click Edit
.
b) Select Add variable
at the end of the list.
c) Name it MONGODB_URI
and paste the string you obtained at Step 0.
d) Click Update and restart
bottom right.
If you already created a Nightscout project (for example if you created your database in Northflank), select it now.
a) Select Add new service
or New service
.
b) Select Build and deploy a Git repo
. Scroll down and put a name in Service name
or click Suggest random name
.
c) Select your cgm-remote-monitor
and the master
branch.
d) In Buid options
select Buildpack
.
Open Advanced build settings
and select heroku/builder-classic:22
.
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.
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.
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:
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.
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
).
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 denied
.
If you want your site to be visible to anybody leave it as readable
.
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
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.
n) Scroll down and check you’re using an nf-compute-10
plan, then click: Create Service
o) If not done before, 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 Service
then Environment
, click Edit
.
b) Select Add variable
at the end of the list.
c) Name it MONGODB_URI
and paste the string you obtained at Step 0.
d) Click Update and restart
bottom right.
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.
Note
If you don’t see this option, send a mail to Northflank support to request access to the feature.
b) Click Link Heroku
.
c) Login in Heroku.
d) Click Allow
.
e) Select your Nightscout Heroku app then click Continue
.
f) Select your project (the one you created in Step 1.g) then click Continue
.
g) Verify the branch you want to migrate, usually it’s master
unless you know why you need another one.
h) Select heroku/builder-classic:22
.
i) Modify your compute plan to the smallest nf-compute-10
and click Continue
.
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.
Good time to check you selected the right plan.
Make sure you selected the developer sandbox plan to avoid unexpected fees.
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 Update
.
d) Click Save
.
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 Profile Editor
.
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.
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.
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.
b) Select Services
then your Nightscout project.
c) Select Environment
then Edit
.
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
Note
Multiple lines values should be typed with \n
separating each original line.
Example:
----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
.
Continue to c) below.
b) If you want to modify an existing Northflank site,
Open Northflank and login with your username or with GitHub.
Select Services
then your Nightscout project.
Select Environment
then Env
.
c) Select Import from file
then the file (heroku.env
) you saved in a).
Your variables should display like this:
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
.