Container Names Admin Plugin (Sys Admin Utility)

I am happy to share this Discourse admin plugin which adds the names of containers (specified in the main app yml file), to the backups tab of the admin page. This utility plugin is useful for Discourse sys admins who run multi-container configurations and wish to see, at a glance, which container is running.

SCREENSHOT

This is a simple plugin, and my first “public” one, so comments and PRs are very welcome to improve it. The container information comes from environmental vars in the yml file, for example:

  • DISCOURSE_CONTAINER_MAIN
  • DISCOURSE_CONTAINER_DATA

We run multiple containers live at the same time so we can rebuild Discourse containers and cut over to it with zero down time (changing the reverse proxy configuration), so for us, it was better to hard code this value into the yml file versus pulling it from docker ps because docker ps has no way of knowing which container is enabled by configuration in the reverse proxy.

TODO

My Ember skills are poor compared to the Discourse experts (still trying to learn Ember), so I had some issues in two areas so there are at least two open TODOs, and I welcome a PR if anyone is interested:

  1. When the Discourse app (GUI) is running and we switch containers (via a reverse proxy configuration change) the page must be reloaded (or plugin disabled and re-enabled). I could not get the computed property to update automatically (I tried many different techniques).

  2. Could not get I18N to work as expected, so the <span> element is hard-coded into the JS code versus residing in the locale configuration (but draft placeholders are there).

As mentioned, PRs are welcome, as I am still a Discourse plugin noob!

Comments and Updates Also Welcome Here:

PRs welcome!

8 Likes

This plugin looks really useful.
Thank you!

3 Likes

No idea how to make Ember reactive with computed properties when containers are switched via a reverse proxy. That’s an interesting topic indeed and good luck with that.

Just tried out this, switched containers changing the reverse proxy config and got it to update turning the plugin off and on.

Anyway… thanks for this utility plugin @neounix

Look forward to future improvements.

2 Likes

Thanks. But in reality, this utility is probably useful for less than 1% of all Discourse sys admins, since most Discourse instances (a wild guess from the posts on meta) run a single container without a reverse proxy (the standard discourse supported configuration).

Yeah I tried many different ways, and the issue for me, based on my “extreme noobiness” in Discourse plugins, is that I could only read the GlobalSetting env var from yml in Ruby, but the rest of the plugin is written in Javascript.

I also considered rewriting the plugin to be 100% Ruby, but did not go that direction yet because I hope someone will have a better idea or even PR a way to make the container info reactive in the reverse proxy switching case, so it does not need an app reload (plugin reinit).

Thanks for commenting.

2 Likes