This process requires using Dexcom’s Follow feature for the Nightscout Connect addon to function. Make sure you have a working follower that you plan to use with this. You can use the Dexcom app to set yourself as a follower.

Northflank

This will be made possible using a service called Northflank . Unlike other methods, we will not need Github nor MongoDB Atlas. Everything will be contained within Northflank.

Northflank has a free offering, where you are allowed one free project per account. This free project allows 2 services and an addon, which is more than enough to accomplish our goal. One of the two services will be Nightscout, and the addon we will use is MongoDB. The MongoDB offering provides a 4GB SSD backing it, which will provide more than enough storage for our needs by a large margin.

Please keep in mind this type of deployment is meant for development and is missing key functionality to ensure it stays online and stable. While it’s likely you’ll never have a problem with it, you should expect that, at some point, you will. If you want more resiliency, that comes at a cost. Accomplishing that will be out of scope of this article. At the very least, the free offering allows backup of your data on a schedule.

While we will be creating a free project, you still need to provide payment information to Northflank.

Go to their website and create a new account. Verify your email. Choose the theme you like and click Next. We don’t need to link a Git account, so click Skip for now. This will, then, prompt you to create a new project. Click Create free project. Next, give it a name and choose a color (this doesn’t matter overall, so pick your favorite). Select the region that works best for you.

You are now ready to get started deploying stuff.

Create MongoDB Addon

First, let’s deploy MongoDB:

  • At the top right, click Create new.
  • Click Addon
  • Click MongoDB
  • Name it nightscout-mongodb
  • Select the latest version in the next field
  • Scroll all the way down and click Create addon

For safety, let’s enable backups:

  • On the left, click Backup schedules
  • Click Add schedule
  • Change Backup type to “Dump”
  • Change Repeat to Weekly
  • At the bottom, click Save 1 change

The backup type of Dump gives us the flexibility to easily download one of these backups to use somewhere else if we decide not to use Northflank anymore. For larger databases, this is not a preferred backup type, but we should never get large enough for this to matter.

A weekly repeat frequency should be adequate for our needs. If you would prefer to take daily backups, you can use that instead. Hourly backups would be pretty pointless.

MongoDB is now ready to use.

Create Nightscout Service

Now, let’s deploy Nightscout:

  • At the top right, click Create new
  • Click Service
  • At the block that says I want to…, click Deploy a Docker image
  • Enter “nightscout” as the name
  • In the Deployment block, click External Image
  • In the Image path field, paste: nightscout/cgm-remote-monitor:latest
  • Wait for verification
  • In the Environment variables block, click Runtime variables to expand it
  • In the top right of the box where Edit is selected, click Env

Copy and paste this block into the box:

ENABLE=careportal basal dbsize rawbg iob maker cob boluscalc pushover treatmentnotify profile food override cors connect
SHOW=dbsize
BG_HIGH=250
BG_LOW=55
BG_TARGET_TOP=180
BG_TARGET_BOTTOM=70
ALARM_URGENT_HIGH=off
ALARM_URGENT_LOW=off
ALARM_HIGH=off
ALARM_LOW=off
ALARM_TIMEAGO_WARN=off
ALARM_TIMEAGO_URGENT=off
NIGHT_MODE=off
THEME=colors
AUTH_DEFAULT_ROLES=denied
DBSIZE_MAX=3000
DBSIZE_WARN_PERCENTAGE=70
DBSIZE_URGENT_PERCENTAGE=80
CUSTOM_TITLE=Nightscout
INSECURE_USE_HTTP=true

A note on alarms: I don’t use alarms in Nightscout. I use Nightscout so other apps can access my data and those apps and tools have their own sets of alarms. Set these to on if you would like Nightscout to alarm.

Scroll all the way down and click Create service.

We are now done creating the service, but it will not, yet, be functional.

Create Secrets

We will be storing some of our environment variables in an area called Secrets. We’ll start with creating the Secrets group from the MongoDB Addon.

  • At the top, click Addons
  • Click the mongodb deployment
  • On the left, click connection details
  • On the right, click link to seret groups
  • Click create a new secret group
  • Name the secret group, I used nightscout-secrets
  • In the Secrets block, where Edit is selected, click Env
  • Add the following:
CONNECT_SOURCE=dexcomshare
CONNECT_SHARE_ACCOUNT_NAME=<dexcom follower username>
CONNECT_SHARE_PASSWORD=<dxcom follower password>
CONNECT_SHARE_REGION=<'us' if in US, 'ous' if outside US>
API_SECRET=<A password of your choosing>
  • Scroll down to Linked addons
  • Click show addons
  • At the right, click configure
  • Click MONGO_SRV
  • Click the + next to aliases
  • Enter MONGODB_URI
  • Scroll to the bottom of the page
  • Click create secret group

Now that the group is created, we need to restart Nightscout.

  • At the top, click Services
  • On the far right of the Nightscout service is a button to restart called Rollout restart - click it
  • Wait for restart to complete

The service will take a small amount of time to start, so loading the page may not work initially. However, click on the Nightscout service entry and scroll down to the block called Ports. There is a DNS column in this block, which contains what your Nightscout URL will be. It’s rather ugly and not easy to remember. I recommend saving it somewhere. To the left of the URL is a copy button. To the right is a link to open the page. Click the link to open the page.

If you reach a page that has a line of text ending in “delayed connect error: 111”, refresh the page until Nightscout loads.

Your first time loading Nightscout will require authentication. Enter the value you used for API_SECRET. If you don’t want it prompting for this every time you load a page, check the checkbox for Remember this device. Click Authenticate.

Still with the first time loading Nightscout, you will be prompted to create a profile. Click ok on the popups until it loads the profile editor. Scroll down and click Save. So long as you had Nightscout remember your device, you should not need to re-authenticate.

At the top right, you should see Status: success. Click the X next to it.

You should now be at the main Nightscout page with no data.

Create Nightscout API Tokens

For tools to work with Nightscout with the current security settings, a token needs to be created.

  • In Nightscout, click the 3 bars at the top right
  • Click Admin Tools
  • Under the Subjects block, click Add new Subject
  • Give it a name (I use librelinkup)
  • In the role field, enter admin
  • Click Save

A new token will be generated. Save this for later. Follow the same steps to create a “readable” token for your follower apps (ie: sugarmate, shuggah, xdrip+, etc). Name it something interesting, but give it “readable” role instead of “admin”.

You can create a token per app, or just create a single token for all apps.

Once done, you can close this.

It will take some time for the service to start. If all goes well, in about 5-10 minutes, you should see data points start appearing in Nightscout.