nightscout / nightscout.github.io

website, meta repo for whole project
GNU General Public License v2.0
103 stars 227 forks source link

low cost and alternative DIY hosting instructions #147

Open christhekeele opened 2 years ago

christhekeele commented 2 years ago

Synopsis

Heroku is sunsetting its free plan (more here). Timeline:

Fortunately the DIY instructions guide people to set up their mongo in Atlas, so data loss will not be an issue, but anyone using the free plan who followed the guide will see their DIY installations will just stop working as early as 26-10-2022 and 28-11-2022 at the latest.

We should probably recommend a different hosting provider, provide new DIY free-hosting setup instructions, and ideally a migration guide as well from Heroku to the new recommended provider.

Discussion

There are several alternatives we could establish guidance for. There are many general replacements suggested in the twitter thread, but I'll be focusing on the free plans of 3 of the most popular ones with a UX I see as most suitable to less-technical Nightscout users' needs. More suggestions welcome in further discussion!

Fly.io

Free Plan

Plan Notes Feature | Limits | Notes -- | -- | -- Apps | 2 apps | You can create up to 2 apps full time with one VM each. 2,340 hours per month | Run 2 shared-cpu-1x VMs with 256MB RAM full time with time to spare. 1GB | Provision 1GB of persistent volumes for permanent storage 160GB per month | See outbound data transfer for regional breakdown Unlimited IPv6, 1 IPv4 | Additional IPv4 addresses require a payment method 10 active certificates | Add 10 certificates to your apps
Pros/Cons ### Pros - **Build Support**: Prefers Docker, supports buildpacks which is useful if a technical user has customized their build - **Migration**: Automatic [Heroku migrator](https://fly.io/launch/heroku) service - **Shutoff**: No automatic shut-off - **Free Hours**: More than enough free hours (2,340) per month to run continuously - **Bandwidth**: More than enough bandwith allowances for normal Nightscout usage - **Security**: [SOC2](https://fly.io/docs/about/healthcare/) (Type 1) audited - **Other — Commitment**: Founder has [expressed interest](https://twitter.com/mrkurt/status/1562900112572968960) in finding ways to keep Nightscout deployments free ### Cons - **Deployment**: Requires command-line usage if not using Heroku migrator

Render

Free Plan

Pros/Cons ### Pros - **Free Hours**: Just enough free hours (750) per month to run continuously - **Deployment**: Has a builtin support for deploying from a GH repo w/out command line usage, based on Dockerfile ### Cons - **Build Support**: Prefers Docker over buildpacks, but migration docs require buildpacks? - **Migration**: Has [Heroku migration instructions](https://render.com/docs/migrate-from-heroku), but requires buildpack usage which is not how we build things, requires additional changes to the code in the forked repository - **Shutoff**: 15 minute inactivity spin-down, 30 second spin-up ### Unsure/Neutral - **Bandwidth**: Could not find documented limits - **Security**: Currently getting their first [SOC2 compliance audit](https://twitter.com/anuraggoel/status/1562923329350017026)

Railway

Free Plan

Pros/Cons ### Pros - **Build Support**: Prefers Docker, supports our Procfile - **Deployment**: GH integration prevents CLI usage, based on Dockerfile/Procfile - **Other — DB**: Unlike others, provides hosted mongo deployments, which might be an interesting avenue to explore simplifying setup (probably not free tho) ### Cons - **Migration**: No maintained documentation or services, a few historical blog posts for specific use-cases - **Free Hours**: Less than enough free hours (500) per month to run continuously ### Unsure/Neutral/Notes - **Shutoff**: Could not find documented limits - **Bandwidth**: Could not find documented limits - **Security**: Could not find documentation on SOC2 compliance
gigich commented 1 year ago

On developper plan you are billed for usage. BUT m first $5 you are not billed. On my first 25 days I used less than 1$, so you will not billed at all!

xannasavin commented 1 year ago

thanks a lot for that information!

loopy321 commented 1 year ago

If you already have homeassistant setup and running, this add-on was super simple to setup and get a nightscout site running: https://github.com/marciogranzotto/addon-nightscout

psonnera commented 1 year ago

Doing some cleanup. Completely overlooked Home Assistant, to be added in advance DIY. @christhekeele worth it adding Render? What's your opinion?

sulkaharo commented 1 year ago

Making a note here - I'm getting reports that Nightscout usage is exceeding the bandwidth limits on Google Cloud free tier. The dev branch has changes that might help with this, but looks like someone should look at the bandwidth caps of various services and make a note the lower ones might not work or could incur extra costs, at least for loopers.

tzachi-dar commented 1 year ago

@sulkaharo did you get the reports from other people than me?

Navid200 commented 1 year ago

@sulkaharo We would like to create a fork from 14.2.6 and inside the fork, merge only the following commit: https://github.com/nightscout/cgm-remote-monitor/pull/7793

To be clear of the change, we would also like to change the version number from 14.2.6 to 14.2.6.1. Then, we would like to use that fork for Nightscout on Google Cloud.

Would there be an objection to any of that?

To be specific, I don't like changing the Nightscout version number because I believe only the Nightscout team should do that.
But, if we don't, anyone using that fork, will still see 14.2.6 when checking the version number. That will not be transparent if some unexpected issue arises later on that we have not considered right now.

Would it be acceptable to your team if we change the version number in our fork to 14.2.6.1?

bewest commented 1 year ago

Strongly suggest use semantic versioning. https://semver.org/. What's wrong with dev and existing process? We welcome any contributions on the important work underway. There are lots of needed updates. We've folded lots of work in dev already that we believe is good to release. This includes lots of work to make Digital Ocean a reliable and accessible platform, improvements for Loop, these compression optimizations and more.

Navid200 commented 1 year ago

We are not going to release the development branch of Nightscout on our platform. If the Nightscout team does not feel that the development branch is stable enough to be released as a stable version of Nightscout, I see no reason for us to push it out on our platform.

Is the Nightscout team telling us that we only have two options, stable release or development branch? Is the Nightscout team telling us that our proposal is completely unacceptable?

I mean can we please find a compromise? That was the spirit I came here with.

bewest commented 1 year ago

@sulkaharo and I are likely to release 15.0.0 https://github.com/nightscout/cgm-remote-monitor/pull/7809 with everything we have quite soon. I hope that works. It would help us hasten release to have people confirm that the dev branch does work for them. With additional confirmation we can release quickly, which I think accomplishes what you outlined.

Navid200 commented 1 year ago

I actually prefer what you are suggesting. I will put together a page explaining how to create a fork and how to merge in it only that particular commit. We have a utility that allows users to install from a fork. Then, anyone experiencing high traffic can follow the instructions on that page to address their issue. We will continue to have the official Nightscout in our platform as the default.

@tzachi-dar unless 50% of the users report unexpected costs, I prefer to use the official Nightscout as our default release. I still have not a single feedback reporting unexpected invoices.

sulkaharo commented 1 year ago

Note the change in dev only changes how the websocket compresses data for the web view and is unlikely to significantly affect users who aren't looping. This doesn't for example change the REST API data usage at all.

I'd not tell users to fork unless this is absolutely critical for them. Or.. historically people have had huge issues jumping back to mainline releases after diverging from the Nightscout master fork, so if you do this, it's likely to cause a lot of support load on the Facebook group.

yodax commented 1 year ago

It would help us hasten release to have people confirm that the dev branch does work for them

I reported that it worked for me, but I missed the latest commits. Sorry for the noise. I just checked and even after restarts I get issues with Android APS and Android APS Client. They refuse to connect even after restarting everything. Reverting back to my late december branch fixes it.

I'm going to setup a separate Nightscout with the changes and test it with the debugger attached from the AndroidAPS side. (since the web frontend works just fine) I'm not sure when I'll get to it, but I'll report back with an issue in the specific repo when I can.

psonnera commented 1 year ago

@gigich did you manage to go ahead with Cyclic? image

Jackenmen commented 1 year ago

Something of interest might be that fly.io now has a Web CLI in Preview so the setup on their platform may become easier: https://fly.io/shell

It isn't possible to just upload the fly.toml right now (you can git clone a repo, as well as use curl though) so another way of providing the file would be needed there. I did suggest allowing file uploading on fly.io's community forum today but I don't know if this is something they would be interested in adding.

psonnera commented 1 year ago

@Jackenmen this is VERY interesting indeed. Thanks!

psonnera commented 1 year ago

@Jackenmen and there's something even easier, if you sign in GitHub from that same link, it will propose you to deploy a repo of yours. You just need to put your toml and hey, done. Now the standard issue is how to maintain privacy with a toml in your repo... image

Jackenmen commented 1 year ago

Now the standard issue is how to maintain privacy with a toml in your repo...

Personally, I would suggest using secrets for MONGODB_URI and API_SECRET. I do that already since using fly.toml for it rubbed me the wrong way. fly.io has a command for setting secrets:

flyctl secrets set "MONGODB_URI=..." "API_SECRET=..."

As for the TOML file...

cgm-remote-monitor repo could come with the default fly.toml which would be included in the clone as that would make the default setup easier to do. The problem is that this still makes changing settings non-trivial as it would seem that right now you would be forced to modify that file within the web CLI (this can be done by e.g. apt installing nano and opening the file in it) and using a CLI editor might not be very straightforward. Something that is somewhat helpful is that flyctl config save can be used to save the application's current configuration to a TOML file which means that the users wouldn't necessarily have to keep their own copy but this doesn't matter due to the difficulty in editing files from a CLI.

Thinking about it, one could theoretically use one of CLI tools that can read and write TOML (a bunch of them are listed here: https://github.com/toml-lang/toml/issues/645) which maybe is easier than learning how to use a CLI editor? I'm not sure if it's easy enough to suggest as the alternative for the current solution.

But yeah, if I'm being honest, them implementing the single file upload feature I proposed would have made this a lot easier than any of the suggestions I gave here.

psonnera commented 1 year ago

@Jackenmen I believe you got something great. I tried: git clone https://github.com/nightscout/cgm-remote-monitor.git Edit a fly.toml in a computer text editor, copy all cat > fly.toml Paste in the terminal ^Z flyctl launch fly deploy And here's the site alive!

Jackenmen commented 1 year ago

Using cat is a neat trick, I like it!

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

WilliamWatterson86 commented 1 year ago

Hey, not sure if you have tried this already but I followed instructions from a video I seen on YouTube and have Nightscout set up and running in Azure for free for a good few months now.

Working well, resource group in azure needs restarted every now and then but so far so good. Here is a link to the video if it helps anyone https://youtube.com/watch?v=EDADrteGBnY&feature=sharea

psonnera commented 1 year ago

@xannasavin yes https://nightscout.github.io/vendors/railway/new_user/ but there are other solutions (please search for those not already documented here https://nightscout.github.io/nightscout/new_user/#vendors-comparison-table) @WilliamWatterson86 is that still working? Last time I looked at it the Cosmos thing for Mongo wasn't available anymore.

WilliamWatterson86 commented 1 year ago

@xannasavin yes https://nightscout.github.io/vendors/railway/new_user/ but there are other solutions (please search for those not already documented here https://nightscout.github.io/nightscout/new_user/#vendors-comparison-table) @WilliamWatterson86 is that still working? Last time I looked at it the Cosmos thing for Mongo wasn't available anymore.

@psonnera Yep still working here for me. I was able to follow the YouTube video and have mine set up with no issues

psonnera commented 1 year ago

@Jackenmen here we go https://github.com/nightscout/nightscout.github.io/commit/63342321409984bdcae065d63c90089abced3bd5

Jackenmen commented 1 year ago

@psonnera I guess that using cat didn't turn out to be practical? It is a bit of a bummer since that means that users won't be able to easily see what values they set the env vars to after setting them since they're treated as secrets.

psonnera commented 1 year ago

@Jackenmen using the fly.toml file requires you to redeploy manually every time you change a variable... that's all but convenient...

Jackenmen commented 1 year ago

@Jackenmen using the fly.toml file requires you to redeploy manually every time you change a variable... that's all but convenient...

The same is true for setting secrets (if you want them to actually apply - this is done by flyctl secrets set as well, which is why you can specify multiple secrets at once).

ninelore commented 1 year ago

the same is true for almost every hoster due to the nature of enviromentals

psonnera commented 1 year ago

@ninelore please have a look at the current implementation and feel welcome to improve it, keeping in mind the public addressed can have no IT knowledge. https://nightscout.github.io/vendors/fly.io/new_user/

ninelore commented 1 year ago

As long as the actual secrets are stored as such (API_SECRET and MONGODB_URI) its fine. I wasnt aware of the Web CLI yet as i use fly for non-nightscout purposes as well with flyctl. Seems like a fine addition for the non tech-saavy users. Wasnt the time format mandatory aswell?

ninelore commented 1 year ago

btw some side notes on fly:

xannasavin commented 1 year ago

@xannasavin yes https://nightscout.github.io/vendors/railway/new_user/ but there are other solutions (please search for those not already documented here https://nightscout.github.io/nightscout/new_user/#vendors-comparison-table)

Thanks for sharing that page @psonnera - was not aware of it.

I'm still a bit lost on the solution to choose. I made some changes (mainly to the display of the clock face page) which are important to me, so I'd like to keep the ability to update my nighstcout via my Github repo. However, I have absolutely no Devops/Server/Terminal skills.

The nightscout.pro looks good, but it seems not to allow for personal repos since it's fully managed. Google cloud looks a bit complicated to me on first glance, also not sure if I could use my own DNS or only freeDNS and also not sure about my own Repo. Everything else looks either more complicated or "expensive".

Will have another look on the Azure solution @WilliamWatterson86 mentioned.

xannasavin commented 1 year ago

question about fly / the heroku migrator: since I'm now on Railway, is there any way to get my data/application from railway to fly or any other service? or is this really "Heroku only"?

psonnera commented 1 year ago

@xannasavin just create a new Nightscout in Fly.io. Copy MONGODB_URI from your Railway site.