Skip to content

Added docker-compose.yml - #6

Open
latetedemelon wants to merge 56 commits into
vdbg:mainfrom
latetedemelon:main
Open

Added docker-compose.yml#6
latetedemelon wants to merge 56 commits into
vdbg:mainfrom
latetedemelon:main

Conversation

@latetedemelon

Copy link
Copy Markdown

Should now work better "out of the box". Testing still required.

@vdbg

vdbg commented Oct 29, 2023

Copy link
Copy Markdown
Owner

Sorry for the late review; just came back from vacation where I had no Internet access. Some general comments:

  • Adding another method (env based + docker compose) is a great idea, but we shouldn't remove the ability to have influx and grafana in separate docker images. I have 1 influx with a dozen docker containers writing to it, and 1 grafana with 20+ dashboards unrelated to resmed. So this should be an "in addition to" vs. an "instead of"
  • We shouldn't break backwards compatibility for the config. There are existing users of this package that use the config file. Logic should be: read config file if exists, then read environment variables if exist (patching the dictionary accordingly), then fail if sections missing. This way we can have the best of both worlds.
  • The program shouldn't make (direct) filesystem modifications. Writes should be limited to logs and sending stuff to influx.

Comment thread README.md
* `sudo docker container rm myAir`
* ``sudo docker run -d --name myAir -v "`pwd`/config.toml:/app/config.toml" --restart=always --memory=100m resmed-influx-image``
2. `cd resmed-influx`
3. edit the .env with your myAir Credientals

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo credentials. Same line 23

Comment thread main.py Outdated
}
}
with open(Path(__file__).with_name(CONFIG_FILE), "w") as config_file:
tomllib.dump(config_data, config_file)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this end up deleting an existing config? Not good if someone didn't take a backup of their config and updates to new version of container.

Comment thread main.py Outdated

def get_config(retry=False):
config_path = Path(__file__).with_name(CONFIG_FILE)
if config_path.is_dir():

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't understand when this would happen?

Comment thread .env
@@ -0,0 +1,14 @@
RESMED_LOGIN=resmed_user_email

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've "lost" all the documentation of the parameters. Maybe add a comment that points to the template config file?

Comment thread Dockerfile
RUN touch /app/config.toml

ENTRYPOINT python main.py
ENTRYPOINT ["python", "main.py"]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this related to docker compose changes?

Comment thread README.md

## Setup

Choose one of these 3 methods.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep the ability to have separate influx and grafana separately (meaning: add a new method instead of replacing existing methods)

@vdbg

vdbg commented Dec 3, 2023

Copy link
Copy Markdown
Owner

This PR adds support for environment variables, and removes the requirement for a config file, without breaking backwards compatibility.

Feel free to update your PR to add docker compose functionality with updated instructions

@vdbg

vdbg commented Dec 9, 2023

Copy link
Copy Markdown
Owner

@latetedemelon : the changes to add env var support are in

latetedemelon and others added 11 commits September 10, 2024 01:10
ResMed was the only source still requiring InfluxDB. Add a VictoriaMetrics
backend so it can feed the shared platform store, selectable via
[main].backend (default 'victoriametrics', 'influx' still supported).

- victoria.py: VictoriaConnector mirroring InfluxConnector's interface;
  tracks last-imported time in a JSON state file (VM has no Flux to query
  it back), skips string fields, tags series provider=resmed
- main.py: choose backend at runtime; influxdb-client now imported lazily
- template.config.toml: new [victoria] section + backend selector
- requirements.txt: add requests; mark influxdb-client optional
- docker-compose.yml: VictoriaMetrics-based standalone stack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants