Heroku to Fly Migration with problem

Hi @anapfb

I actually helped a friend with a Nightscout web monitor migration last week. See if the walk-through below helps.

Nightscout on Fly.io

Fly.io

Install flyctl:

Setup Fly.io account:

Setup MongoDB

Follow these instructions for creating MongoDB, Create an Atlas database. This is not required if migrating from Heroku, etc.

It should resemble:

mongodb+srv://username:password@deployment.mongodb.net/?retryWrites=true&w=majority

It will be used as MONGODB_URI in the app environment below.

Clone the Nightscout web monitor:

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

Change working directory to cgm-remote-monitor

cd cgm-remote-monitor

Create a new Fly app:

fly apps create YOUR-UNIQUE-APP-NAME-GOES-HERE

Create the app configuration file:

Save the following to fly.toml

app = "<YOUR-UNIQUE-APP-NAME-GOES-HERE>"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
  PORT = "8443"
  THEME="color"
  BASE_URL = "<YOUR-UNIQUE-APP-NAME-GOES-HERE>.fly.dev"
  DISPLAY_UNITS = "mg/dl"
  INSECURE_USE_HTTP = "true"
  MONGODB_COLLECTION = "entries"
  
[[services]]
  internal_port = 8443
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

  [[services.ports]]
    handlers = ["http"]
    port = 80
    force_https = true

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.http_checks]]
    interval = 30000
    grace_period = "5s"
    method = "get"
    path = "/"
    protocol = "http"
    restart_limit = 5
    timeout = 5000
    tls_skip_verify = false
    [services.http_checks.headers]

Create Nightscout API Secret

Create a secret passphrase, must be at least 12 characters.

It will be used as API_SECRET in the app environment below.

Add secrets to the app environment:

Adjust as needed. Further documentation can be found here

fly secrets set API_SECRET="<YOUR-UNIQUE-API-SECRET>" \
 MONGODB_URI="<YOUR-MONOGDB-URI-FROM-ATLAS>"

Allocate a public IP:

flyctl ips allocate-v4

Deploy the app:

fly deploy

Open app

fly open