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

[Feature]: Cosmovisor: expose an API allowing you to query it #19755

Open
freak12techno opened this issue Mar 14, 2024 · 6 comments
Open

[Feature]: Cosmovisor: expose an API allowing you to query it #19755

freak12techno opened this issue Mar 14, 2024 · 6 comments
Labels
C:Cosmovisor Issues and PR related to Cosmovisor T:feature-request

Comments

@freak12techno
Copy link
Contributor

Summary

Would be cool if there would be a possibility to have an API exposed by cosmovisor that will return the data that can be used in different tools.

Problem Definition

I am a maintainer of the tool called cosmos-node-exporter: https://github.com/QuokkaStake/cosmos-node-exporter.
It allows you to scrape different metrics from the node, and also from Cosmovisor, such as: your app version, Cosmovisor version, and the list of the binaries that your node has.
As of now, it requires the filesystem access to see if you have the binary prepared for a specific upgrade, and also to run cosmovisor version command, so this exporter has to be installed on the same host as the node in order to get the full metrics set, as it requires its filesystem access.
Additionally, if you run Cosmovisor with a set of env vars that's different from the one specified in your systemd config, it will behave differently and there's no way of knowing which env vars are there in a systemd file, unless you see the systemd file or get them via cosmovisor subcommand (which also requires physical server access).

I can query some of the data from the node itself, but some of the data I need is not the part of the node itself, it's a part of Cosmovisor setup.

If we'd have an API that's enabled on-demand that would return different Cosmovisor data (such as, the version of Cosmovisor itself, its config/env vars, current binary name, upgrades names, etc.), that would solve it.

Proposed Feature

Have a Cosmovisor config that allows it to expose the REST API which has endpoints to return the following data:

  • Cosmovisor version
  • Cosmovisor config (as in, env vars)
  • current app version
  • binaries that are present in upgrades folder
@julienrbrt julienrbrt added the C:Cosmovisor Issues and PR related to Cosmovisor label Mar 15, 2024
@julienrbrt
Copy link
Member

As cosmovisor is a simple CLI tool, it feels weird to add an api, and I am afraid it opens the gate to requests to have api for basically each command of cosmovisor (upload binaries, add upgrade, etcs..) and further complicate cosmovisor.

I can query some of the data from the node itself, but some of the data I need is not the part of the node itself, it's a part of Cosmovisor setup.

As you said, you can query node info. It would be great to know if there are more people needing this feature before we add more complexity to cosmovisor.

@freak12techno
Copy link
Contributor Author

freak12techno commented Mar 15, 2024

@julienrbrt I actually also considered that maybe it makes things complex without a reason, but at least for me it'd have benefits.

My guess is having cosmovisor exposing an API server would mostly benefit those building tools interacting with it (like me specifically, but maybe there are other people doing something similar, not sure).

Just a side idea: the issue of different cosmovisor configs between cosmovisor running as a systemd service (with one set of env vars) and locally in shell (with another set of env vars) can be solved by using a config file for cosmovisor instead of relying on env vars, what do you think of that?

@julienrbrt
Copy link
Member

100% agree to have a config file for cosmovisor instead of that mess of env variable 👍🏾

@freak12techno
Copy link
Contributor Author

@julienrbrt on having a cosmovisor config file: I guess that's out of the scope of this issue, so I assume it's worth it to make a new one on that?

@julienrbrt
Copy link
Member

Yes, thank you!

@freak12techno
Copy link
Contributor Author

@julienrbrt a few more things I thought of:

  1. even if we update Cosmovisor to use config file instead of env vars, there might be a case when a node's running with a config, then somebody edits the config and runs cosmovisor command, and it'll use different config than the running node, wonder if it might be the issue
  2. guess it'd be handy to have a command that'll list all upgrades we have locally and their binaries versions, do you think it's feasible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Cosmovisor Issues and PR related to Cosmovisor T:feature-request
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants