Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting files for APCUPSD Addon #101

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

danimbrogno
Copy link

@danimbrogno danimbrogno commented Jun 14, 2023

This PR contains changes to the smartnode installer to support the APCUPSD addon proposed in GA022303.

When a user has metrics enabled, this addon allows a node operator to:

  1. Optionally run apcupsd within a container and allow it to connect to your ups
  2. Run an apcupsd-prometheus exporter container and connect it to apcupsd (either running in a container as mentioned above, or connected to your host machine or network)

This PR must be accepted alongside the PR to the smartnode repository.

Copy link
Author

Choose a reason for hiding this comment

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

This file will be populated with an apcupsd.conf by the cli if the user enables running apcupsd in a container. This file is present in the installer so that it has the correct permissions to be overwritten by the cli.

Please let me know if there is a preffered file path to use here.

Copy link
Member

Choose a reason for hiding this comment

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

I've moved this to install/addons/apcupsd/addon_apcupsd.conf - all of the addon-specific files will go into that folder and get mounted as a volume in your container.

Copy link
Author

Choose a reason for hiding this comment

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

Because this addon may optionally run 1 or 2 containers depending on it's configuration I have commented out the services: definition.

In the scenario where a user does not want to run apcupsd in a container, the addon_apcupsd.network.tmpl template will be used which does not define the service "addon_apcupsd". If these files were uncommented, the cli would complain that "addon_apcupsd" does not have an image / build context specified.

Let me know if there is a more elegant solution here.

Copy link
Member

Choose a reason for hiding this comment

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

The best way to do this is one template file per container, so I'll break it out into two separate files.

Copy link
Author

Choose a reason for hiding this comment

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

Cool, I want to flag that you'll want to test that the service sucessfully restarts when toggling between "Container" and "Network" mode. Keep a look out for a bug where the service tries and fails to start the apcupsd container even though we don't need this container because we are running in network mode. This happened due to the presence of an (empty) service definition inside the overrides folder.

Copy link
Author

Choose a reason for hiding this comment

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

NOTE: This apcupsd job is added to the prometheus config regardless of whether the user has the addon enabled. I don't think this is an issue as it fails to fetch the metrics silently, but perhaps it is additional overhead we would not want to add? Let me know if there is a method to conditionally add items to this configuration file based on an environment variable.

Copy link
Member

Choose a reason for hiding this comment

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

I think failing silently in this case is fine, we already do it (geth and eth1 are mutually exclusive, as the later is used for Besu and Nethermind). I'll put a comment in there for posterity.

@danimbrogno danimbrogno changed the title Changes to support APCUPSD Addon Supporting files for APCUPSD Addon Jun 14, 2023
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't immediately look like a template to me, it just looks like a static file that may or may not be deployed. Template files in this dir are usually Docker container definitions - we may find a better place for this to live.

Copy link
Author

Choose a reason for hiding this comment

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

Hey that's a good point. I was thinking about letting the user customize this file via the TUI but that wasn't in the original scope of the grant and I've spent more time on this than I originally anticipated.

That's why it is in the template folder. If we move it out would it be a pain to put it back in here later if I wanted to build out this feature?

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.

2 participants