nightscout / cgm-remote-monitor

nightscout web monitor
GNU Affero General Public License v3.0
2.41k stars 71.71k forks source link

Heroku is phasing out free tier #7518

Closed geecko86 closed 2 years ago

geecko86 commented 2 years ago

See this blog post: https://blog.heroku.com/next-chapter

Nightscout probably needs to recommend another option in the README.md.

psonnera commented 2 years ago

Yes, there is a lot to do in the documentation. Stay tuned.

boris803 commented 2 years ago

Maybe a fallback to azure or another similar provider could make sense?

tsimmons commented 2 years ago

A self-hosted option would sure be nice.

psonnera commented 2 years ago

A NAS or a Raspberry can do that.

Maxr1998 commented 2 years ago

Official stable docker and compose files would be great to be able to deploy this on a VPS or NAS.

Root-Core commented 2 years ago

I'm moving over to my Proxmox server into a LXC container. Shouldn't be too difficult.

For selfhosting, the existing setup.sh script is outdated and not really sufficient for the end user. There is a need for good documentation and/or guided scripts. Some people could indeed be interested in a docker container.


Viable free hosters might be fly.io or vercel.com they should meet the hardware specifications. The mongo db instances are not affected, which limits the necessary hosting specs.

sulkaharo commented 2 years ago

The docker compose file in the repo root is being actively used by some user, @Maxr1998 have you tried it?

Based on the experience of supporting Nightscout users for years, I don't think hosting NS on a Pi or a NAS will ever become an "officially supported" way to host Nightscout unless we get new tech support folks who are willing to help people with this. Most of the users we have a not technical at all and would struggle with the setup, unless someone creates a Nightscout image they can just install on an SD card and figures a great way how to document punching holes in literally every common router firewall. Historically a lot of users have tried Pi and other platforms for hosting and have subsequently been asking for a lot of support that's gone to the level where only the developers have been able to help the users, which consumes time and energy from actually working on the software. (No, you can't use npm as root. No, there's no recent Node available for Pi 1 and the version you've installed and have been working on for 50 hours won't work.)

Basically - over past five years there's been around 5 people who've been contributing to Nightscout development in a significant manner and I've literally pushed more code to the repo than all the other contributors combined. As such the "technical team" working on Nightscout is absolutely tiny and we can't afford any hosting methods that cause additional support load, unless it's the type of support the people answering questions in Facebook can answer and people like the amazing @psonnera can document in a comprehensive manner.

sulkaharo commented 2 years ago

Just tested and the Digital Ocean PAAS solution works well. $5 / month and relatively easy installation process.

Maxr1998 commented 2 years ago

The docker compose file in the repo root is being actively used by some user, @Maxr1998 have you tried it?

I didn't realize there was a compose file in this repo too, that's good to see. Earlier I only found the nightscout/nightscout-docker repo, that's why I made above comment.

Based on the experience of supporting Nightscout users for years, I don't think hosting NS on a Pi or a NAS will ever become an "officially supported" way to host Nightscout unless we get new tech support folks who are willing to help people with this. Most of the users we have a not technical at all and would struggle with the setup, unless someone creates a Nightscout image they can just install on an SD card and figures a great way how to document punching holes in literally every common router firewall. Historically a lot of users have tried Pi and other platforms for hosting and have subsequently been asking for a lot of support that's gone to the level where only the developers have been able to help the users, which consumes time and energy from actually working on the software. (No, you can't use npm as root. No, there's no recent Node available for Pi 1 and the version you've installed and have been working on for 50 hours won't work.)

Basically - over past five years there's been around 5 people who've been contributing to Nightscout development in a significant manner and I've literally pushed more code to the repo than all the other contributors combined. As such the "technical team" working on Nightscout is absolutely tiny and we can't afford any hosting methods that cause additional support load, unless it's the type of support the people answering questions in Facebook can answer and people like the amazing @psonnera can document in a comprehensive manner.

That's more than understandable. I just wanted to ensure that the self-hosted variant isn't noticably less stable than the officially supported distributions. I was a bit concerned because the other repo recommended to only use the docker/compose files for development purposes.

I'm not using nightscout myself but I've been helping my dad with the setup and am planning to migrate him to some kind of VPS now that Heroku is being phased out. Having a docker distribution will make it much easier for me to set everything up for him.

xannasavin commented 2 years ago

this is pretty annyoing, first I thought "I'm not using any of those services anyways" but then I realized "Heroku Dynos" is literally the platform itself >< I won't pay 7$ a month for this, so another recommendation for a free service would be awesome! And of course a "how to" setup guide - I really appreciated the easy installation steps for Heroku. I have some simple web hosting server myself, but nothing where I could install a docker image I guess... Besides that's far beyond my technical knowledge...

christhekeele commented 2 years ago

I've opened a related issue on the documentation project to discuss alternatives to Heroku here.

@xannasavin While (as per that discussion) we don't currently have a viable path for setting up new installs or modifying migrated installs on fly.io without requiring deeper into technical knowledge, one person at least has successfully been able to use their one-click Heroku migrator to keep their setup intact and free. I hope this is a viable solution to keep the lights on until better documentation can be produced.

mdoliver commented 2 years ago

@tsimmons There's a helpful gist here that pretty much covers everything for self hosting. I managed to get 99% of it going without an issue using Ubuntu 20.04.5 LTS (focal) installed in a virtual box VM.

The one issue I do have is NS won't open port 1337 on my VM. pm2 loads the web server fine, but no port opening and I cannot browse to the local instance of NS on http://localhost:1337

Others have managed it but the above issue was a show stopper for me.

tsimmons commented 2 years ago

Thanks @mdoliver! I actually spun up a Docker version on my AWS Lightsail instance without too much drama. I already had an nginx reverse proxy for SSL termination so I put together my own docker-compose yml and so far is working great, pointed nginx at localhost:1337. I am using the Dexcom bridge so all my data is already there, my iPhone and Apple Watch are happily reporting from the new instance.

tsimmons commented 2 years ago

I'd be happy to share my steps if it would be helpful, it was pretty painless. I already was using Docker and docker-compose but I could share what I did for those as well.

mdoliver commented 2 years ago

That would be greatly appreciated @tsimmons . I haven't tried Docker yet. Probably something small I'm missing as to why my open port isn't working, I'm so close....

tsimmons commented 2 years ago

Ubuntu 20.04.4 LTS, Docker, Nightscout

With a working Ubuntu 20.04.4 LTS server (mine was an AWS Lightsail instance)

Installed docker, docker-compose (from official repos, not Ubuntu PPA which tend to be out of date) see this link and this link

# Docker
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

# Verify you are installing from docker official, not Ubuntu repos
apt-cache policy docker-ce

# Install it
sudo apt install docker-ce

# Add me to the docker group
sudo usermod -aG docker ${USER}

# Log out and back in to have the group change take affect

# Docker-compose (find the latest release from https://github.com/docker/compose/releases and had to tweak the curl command below to work
sudo curl -L "https://github.com/docker/compose/releases/download/v2.10.1/docker-compose-$(uname -s | awk '{print tolower($0)}')-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version

Installed Nightscout from git repo

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

# Move the built in version of docker-compose.yml to use our own since I use my own nginx reverse proxy
mv docker-compose.yml docker-compose-20220826.yml
vim docker-compose.yml

MY CONTENTS OF docker-compose.yml (Note the three CHANGE_ME entries, also I am using the US Dexcom servers, change if you need other regions)

version: '3.1'

services:

  mongo:
    image: mongo:4.4
    restart: always
    volumes:
      - ${NS_MONGO_DATA_DIR:-./mongo-data}:/data/db:cached

  nightscout:
    image: nightscout/cgm-remote-monitor:latest
    build: .
    environment:
      MONGO_CONNECTION: mongodb://mongo:27017/nightscout
      API_SECRET: CHANGE_ME_USE_YOUR_OWN
      BRIDGE_PASSWORD: CHANGE_ME_USE_YOUR_DEXCOM_BRIDGE_PASSWORD
      BRIDGE_SERVER: US
      BRIDGE_USER_NAME: CHANGE_ME_USE_YOUR_DEXCOM_BRIDGE_USERNAME
      DISPLAY_UNITS: mg/dl
      INSECURE_USE_HTTP: 'true'
      BG_HIGH: 300
      BG_LOW: 55
      ENABLE: 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
      THEME: colors
      TIME_FORMAT: 12
    ports:
      - 127.0.0.1:1337:1337

volumes:
  data:

Test Docker/Nightscout

# tested first, the first time I ran this CPU ran way up and it never completed. Ended up letting it run 40 minutes, then rebooted my instance from the web console; after reboot tried again and it finished and said it was up and running
docker-compose up
# test if Nightscout is running from a command line using curl
curl -sv http://localhost:1337
# Advanced: if you are ssh'd into your server, add a tunneling parameter "-L 1337:127.0.0.1:1337" as in "ssh -L 1337:127.0.0.1:1337 user@myserver" which will tunnel local port 1337 to the remote server port 1337 so you can browse to Nightscout with a web browser by opening the website: http://localhost:1337 on your local machine and configure it with a new profile.
# Press CTRL-C to stop the Docker container; then relaunch it as a daemon
docker-compose up -d

Configure nginx as a reverse proxy

I use nginx for SSL cert termination, this is my redacted nginx config for my Nightscout site/server; in addition, I use certbot/letsencrypt for my SSL cert

server {
    listen 80;
    listen [::]:80;
    server_name nightscout.domain.name;
    server_tokens off;
    location /.well-known {
        root /var/www/letsencrypt/;
        allow all;
    }
    # Block bad useragents
    if ($http_user_agent ~* ".*(SemrushBot|Barkrowler).*") {
        return 444;
    }
    # Redirect remaining requests to SSL
    location / {
        return 301 https://$http_host$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl http2;
    server_name nightscout.domain.name;

    ssl_certificate           /etc/letsencrypt/live/my.domain.name/fullchain.pem;
    ssl_certificate_key       /etc/letsencrypt/live/my.domain.name/privkey.pem;

    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4!3DES;

    ssl_dhparam /etc/nginx/ssl/dhparam.pem;
    ssl_prefer_server_ciphers on;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;

    access_log            /var/log/nginx/nightscout_nginx_access.log main;
    error_log             /var/log/nginx/nightscout_nginx_error.log;

    # Block bad useragents
    if ($http_user_agent ~* ".*SemrushBot.*") {
        return 444;
    }

    location / {
        proxy_set_header  Accept-Encoding "";
        proxy_set_header    X-Secure on;
        proxy_set_header    Host $http_host;
        proxy_set_header    Upgrade $http_upgrade;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    X-Forwarded-Proto https;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Port 443;
        proxy_set_header    Proxy "";

        proxy_pass          http://localhost:1337;
        proxy_read_timeout  90;
        proxy_redirect      http://localhost:1337 https://$host;

        # Try to replace instances that self-reference the install to nginx
        sub_filter_once off;
        sub_filter "http://localhost:1337" "https://$host";
    }
}
aendes commented 2 years ago

Hello, it would be possible to run it on Oracle Cloud Infrastructure (Free Instance available)

Aendes

xannasavin commented 2 years ago

I found https://www.digitalocean.com/pricing/app-platform but I'm not sure if this is what one would need? They have a free tier, but I'm unsure if it's the correct type of hosting.

bewest commented 2 years ago

Please consider contributing to the documentation efforts underway on this topic, so we can close this issue. https://github.com/nightscout/nightscout.github.io/issues/147 There are efforts in motion to enable additional hosting for low cost, and the docs area is the best place for this discussion.

xannasavin commented 2 years ago

I don't see this closed since this topic should solve as discussion to discover new alternatives in hosting. e.g. my question about digital ocean was not answered, nor was the one of Aendes.

psonnera commented 2 years ago

@xannasavin Nightscout is supported in DO and Oracle, just needs to be documented. Please open a new issue in nightscout.github.io Same for Oracle. This is not relevant to cgm-remote-monitor but to the documentation. Closing this topic here is normal unless you need to add code to support the deploy in other vendors platforms.

xannasavin commented 2 years ago

Ok I see, thank you

xannasavin commented 1 year ago

unfortunately, it looks like railway is now also no more available for free... https://blog.railway.app/p/introducing-trial-hobby-pro-plans https://blog.railway.app/p/pricing-and-plans-migration-guide-2023 They charge now $5 starting next month... So the search begins again T_T