Discourse Container Names with GON - For Sys Admins and Developers

WHAT DOES THIS PLUGIN DO?

This simple Discourse Container Names with GON plugin consumes the ENV["DATA_NAME"] environmental, or user set environments, to display the container names on Discourse admin pages.

In addition, it displays the disk space available to the app as seen from inside the container:

WHO IS THIS PLUGIN FOR?

This plugin is for Discourse system admins who run in a multi-container environment and would like to see which containers they are running on in the admin area. In addition, since we often see Discourse system admins having upgrade issues related to disk space; the disk space is also shown and updated when the admin pages are reloaded.

This plugin is also for developers who are interested in learning how to use the GON Ruby gem in their projects. This plugin uses GON and jQuery (in the theme) to display the information and does not use EmberJS.

HOW DOES IT WORK?

In a nutshell, this plugin extends the AdminController and reads specific environmental variables and also executes some simple system code. This parsed information is stored in a GON global object using the GON Ruby gem and displayed using only jQuery in the theme. The gon javascript object is injected into the Discourse view (.erb) layout using pups.

HOW TO INSTALL GON ON DISCOURSE?

Below is how I installed the GON javascript object in Discourse.

HOW TO INSTALL THIS PLUGIN?

Here is the repo for this plugin with basic install instructions:

https://github.com/unixneo/discourse-container-names-with-gon

In addition, here are my installation notes:

SUMMARY

This plugin provides useful information to Discourse system admins, especially folks who run in mult-container setup. It also provides disk space info at a glance. You can over-ride the names of the containers in the container YAML file, but it is not necessary. In addition, this plugin demonstrates an easy way to use the GON Ruby gem in a Discourse plugin so information can be displayed using Javascript, and in this case, jQuery.

ENHANCEMENTS

All ideas for enhancements are appreciated. PRs welcome.

SEE ALSO

https://github.com/gazay/gon

https://github.com/discourse/pups

6 Likes