Open leleobhz opened 1 month ago
From what I know Nightscout uses basic features of Mongo and Ferret translation most probably covers all that's needed. The issue I've seen with this is FerretDB requires another cloud service that results as an extra cost for most PaaS. If you run your own VPS, I'm not sure of the added value. It would for sure be obvious if we could find a free DB larger than Atlas. You did check this, right? https://github.com/3timeslazy/nightscout-ferretdb/tree/main/all-on-one
Hello @psonnera
The issue I've seen with this is FerretDB requires another cloud service that results as an extra cost for most PaaS.
FerretDB can be deployed to translate into SQLite for example. Thinking with heroku-like in mind indeed ddo not have much advantage, but for a single VPS as example, sqlite will be lighter than a MongoDB database (For coincidence this is more or less my case).
In fact, FerretDB may increase the database support, since adds SQLite, PostgreSQL and in future, MySQL support. If we can confirm any of FerretDB limitations is being used here, may Nightscout officially support it in future. For now, I just want check if something bad may happen with some specific register or condition.
Another suggestion is to add FerretDB to testing alongside with MongoDB testing.
You did check this, right? https://github.com/3timeslazy/nightscout-ferretdb/tree/main/all-on-one
I really disagree on s6 usage - all the more using docker-compose. My approach is just running ferretdb and nightscout in different services at same docker-compose - and it works very well. Aside, this avoid the lose of updates from both projects due to misleading with all-in-one container CI builds.
About Atlas, at least for me, heath data being inside my infrastructure - or being controlled by me at least - is a must to. Also, a setup with Nightscout + FerretDB + SQLite + Rpi + Zerotier (as example) would fit better than running MongoDB in such small device.
Just for reference, my docker-compose file:
services:
ferretdb:
image: ghcr.io/ferretdb/ferretdb:1
restart: always
labels:
autoheal: "true"
healthcheck:
test: ["NONE"]
environment:
FERRETDB_HANDLER: "sqlite"
volumes:
- nightscout-ferretdb:/state
networks:
nightscout:
nightscout:
image: nightscout/cgm-remote-monitor:latest
restart: always
depends_on:
- ferretdb
labels:
autoheal: "true"
environment:
### Variables for the container
NODE_ENV: "production"
TZ: "America/Sao_Paulo"
HOSTNAME: "::"
PORT: "1337"
INSECURE_USE_HTTP: 'true'
MONGODB_URI: "mongodb://ferretdb:27017/nightscout"
API_SECRET: <API KEY HERE>
ENABLE: "careportal rawbg iob sage dbsize"
AUTH_DEFAULT_ROLES: "denied"
DISPLAY_UNITS: "mg/dl"
BASE_URL: "https://<URL HERE>"
TIME_FORMAT: "24"
# For all other settings, please refer to the Environment section of the README
# https://github.com/nightscout/cgm-remote-monitor#environment
networks:
nightscout:
aliases:
- nightscout
webservices:
nightscout-libre-link:
image: docker.io/timoschlueter/nightscout-librelink-up
restart: always
depends_on:
- nightscout
environment:
LINK_UP_USERNAME: "<LIBREVIEW USER HERE"
LINK_UP_PASSWORD: "<LIBREVIEW PASS HERE>"
LINK_UP_TIME_INTERVAL: "1"
LINK_UP_REGION: "<LIBREVIEW REGION HERE>"
NIGHTSCOUT_URL: "nightscout"
NIGHTSCOUT_API_TOKEN: "<NIGHTSCOUT API KEY HERE>"
LOG_LEVEL: "info"
networks:
nightscout:
volumes:
nightscout-ferretdb:
networks:
webservices:
name: webservices
external: true
nightscout:
driver: bridge
name: nightscout
@leleobhz this is a very smart choice but I'm not sure it adds so much value over running an older Mongo version (I use 4.4 in my VPS with great satisfaction) but as I've been looking forever for free Mongo alternatives to Atlas (and the result of my search is exactly the opposite of free), having the possibility of finding other free Posgres/SQLite databases available would be fantastic. How would you modify this yml to have an external Postgres/SQLite database on a different server?
@psonnera For use FerretDB with Postgres, just replace the POSTGRES_ variables in the environment - as in the example at https://docs.ferretdb.io/quickstart-guide/docker/#postgresql-setup-with-docker-compose - and add a postgres service if you need it.
About Old Mongo x Ferret, MongoDB have some requirements that may hit very small environments. MongoDB does not behave very well with slow storage (In any version for anything) - and since probably you VPS is a SSD ones, MongoDB works well. Also, In SoC like Rpi, MongoDB may suffer with low bandwidth bus and some CPU congestion for I/O. The scenario with RPI or even weaker SoCs may be better with FerretDB, allowing reducing price for on premisses/own hardware solution.
Nightscout formally only supports MongoDB. I bring up a testing instance using FerretDB (As their description, "FerretDB is an open-source proxy that translates MongoDB wire protocol queries to SQL, with PostgreSQL or SQLite as the database engine.") to test if NightScout behaves properly and until now - without much data it behaves normally.
That said, considering the FerretDB Differences from MongoDB, does FerretDB misses something Nightscout uses (Or plans to use)?