psmqtt icon indicating copy to clipboard operation
psmqtt copied to clipboard

Publish psmqtt version into an MQTT topic

Open TarheelGrad1998 opened this issue 8 months ago • 3 comments

I'm finally getting around to upgrading, but when I try to pull ghcr.io/eschava/psmqtt:latest, it fails to read from the yaml file. I'm thinking, :latest is not in the v2 branch? It works if I use the version name.

Incidentally, a feature request would be to add the psmqtt version to the topic as well. Thanks.

TarheelGrad1998 avatar Mar 19 '25 15:03 TarheelGrad1998

hi @TarheelGrad1998 ,

I'm finally getting around to upgrading, but when I try to pull ghcr.io/eschava/psmqtt:latest, it fails to read from the yaml file. I'm thinking, :latest is not in the v2 branch? It works if I use the version name.

Thanks for reporting it. Indeed there was a subtle bug in the CI pipeline and only the "latest-root" tag was updated, while "latest" tag was not. I've just fixed it. Can you please retry and check if the :latest tag can read your YAML config?

Incidentally, a feature request would be to add the psmqtt version to the topic as well. Thanks.

You mean to the topic path? I think that could be a problem since it means that on every psmqtt upgrade, the path would change... moreover you can already retrieve the psmqtt version by using the "--version" flag on the CLI. Last but not least, it's generally not a good idea to rely on the "latest" tag outside of experimentation. If you're storing the docker (compose) file in git, I suggest you to stick a fixed version and then run a bot like DependaBot or Renovate that will detect if a new psmqtt version is present and will propose you a PR to update psmqtt.

f18m avatar Mar 23 '25 23:03 f18m

Yes, the latest tag is working now. Thanks!

Sorry, I did not mean in the topic, but as a node under the topic....I may not be using the proper MQTT terminology. E.g. from the latest version there is now a psmqtt_status\num_tasks_success=6, it would be great if there was a psmqtt_status\version=2.3.0. It would allow me to see where all my hosts stand from one place.

I also do not understand your point on the latest tag. I run many containers under docker and always use the latest tag unless I have reason not to (e.g. I need to stick with version X because of some compatibility issue).

I'm currently using portainer to manage the compose/stacks. Now if you're suggesting that I automate the updates, I'm completely with you...but considering I'm just now getting to upgrading psmqtt, guess when I will likely get around to doing that? :)

TarheelGrad1998 avatar Mar 26 '25 19:03 TarheelGrad1998

Yes, the latest tag is working now. Thanks!

Good to hear that.

E.g. from the latest version there is now a psmqtt_status\num_tasks_success=6, it would be great if there was a psmqtt_status\version=2.3.0. It would allow me to see where all my hosts stand from one place.

Ok I see what you mean now. Yes I think this would be easy to add. I'll leave this issue open to track this feature request.

I also do not understand your point on the latest tag. I run many containers under docker and always use the latest tag unless I have reason not to (e.g. I need to stick with version X because of some compatibility issue).

Check out articles like this one: https://medium.com/@imsrv01/why-you-should-avoid-using-the-latest-tag-on-container-images-5212f3af10cb There are plenty of similar articles. The "latest" tag is convenient for testing but it's a very bad practice in "production".

Consider e.g. the shift from psmqtt v1 to v2. Let's say you started using psmqtt when it was at version 1 (via the "latest" tag). After a while v2 came out and it features a new configuration format. If the v1 users triggered (perhaps by mistake or implicitly) a docker image pull, they would automatically see psmqtt crashing / erroring out.

Now if you're suggesting that I automate the updates, I'm completely with you

My suggestions are:

  1. use docker-compose rather than scripts that launch "docker run", so that the version of the containers you start is clearly written in the docker-compose.yml file
  2. store your YAML files in GitHub
  3. activate Renovate bot (or Dependabot -- I don't use it personally but it should work); Renovate will automatically recognize the fixed version (e.g. psmqtt:2.2.0) in your files and propose PRs to update them (E.g. to psmqtt:2.3.0).

f18m avatar Mar 26 '25 22:03 f18m