OSC / ood_appkit

https://osc.github.io/Open-OnDemand/
MIT License
1 stars 2 forks source link

Add "persistent site-wide announcement" that appears if message exists in a file (similar to MOTD) #32

Closed ericfranz closed 4 years ago

ericfranz commented 7 years ago

Using an environment variable or an initializer or config, specify an array of paths to look for "persistent site-wide announcement". Two locations could include a location that is shared between all apps and a location that is specific to this app.

The idea is if you want to display a message to all users across all apps, about a impending downtime, for example, you could create a file in one location and it will display across all apps.

Or, you could target a specific app with a message, such as warning users that an app is going to be replaced by another app (job constructor 1 with job constructor 2).

nickjer commented 7 years ago

Should this be baked into ood_appkit or into just the system apps? Not sure if injecting messages into apps without the app owner's knowledge is a good thing. Maybe if it is something they can opt-into?

Also, this won't affect the Node.js apps.

ericfranz commented 7 years ago

Opt in.

Could use a simple yaml file announcement.yml somewhere:

---
severity: warning
content: On Dec 12, we will have a downtime and apps will be unavailable.
ericfranz commented 7 years ago

/etc/ood/config/announcement.yml?

ericfranz commented 7 years ago

or could be /etc/ood/config/motd that is distinct from /etc/motd

nickjer commented 7 years ago

Definitely use a format and specify it with the extension. So at least *.yml.

ericfranz commented 7 years ago

I'll keep this open. A solution here could be used by the dashboard to replace the changes done in https://github.com/OSC/ood-dashboard/pull/114

ericfranz commented 7 years ago

http://bundler.io/v1.3/man/bundle-exec.1.html#Shelling-out

Any subshells created inside the block will be given the environment present before Bundler was activated.

We currently use Bundler.with_clean_env to initialize the database of an app AND to run rake tasks from the Developer web views on the dashboard.

As soon as we start setting many of these variables prior to the Passenger starting, we will no longer be able to just use Bundler.with_clean_env. Any solution to https://github.com/OSC/ood-dashboard/issues/127 will need to be readdressed.

ericfranz commented 7 years ago

We can probably provide a helper to get the announcement content and add a template to render.

One option is to make use of the existing markdown template handler:

<%# partial announcement %>

<% if announcement_file.file? %>
  <div class="alert alert-warning" role="alert">
    <%= render file: announcement_file.to_s %>
  </div>
<% end %>

The point is it should be a single partial or helper that one can call to put the announcement alert in the layout. Then a developer can use this or not.

ericfranz commented 4 years ago

Dashboard has this right now. If we want to make that a feature for other custom apps we can address at a later date.