defenseunicorns / uds-package-mattermost

🏭 UDS Mattermost Zarf Package
Apache License 2.0
5 stars 3 forks source link

Native Support of Mattermost plugins #7

Open rjferguson21 opened 5 months ago

rjferguson21 commented 5 months ago

Is your feature request related to a problem? Please describe.

Users of Mattermost will want to use plugins. Currently, whomever is managing Mattermost deployments would need to configure plugins manually, post-deployment.

Describe the solution you'd like

A way to manage Mattermost plugins via code at the package level vs bundle or manually.

Describe alternatives you've considered

Doing it manually

Additional context

🐸

https://github.com/mattermost/mattermost-plugin-ai

mjnagel commented 5 months ago

This should be easy from a manual perspective. It does require one bundle override to enable plugin uploads:

    overrides:
        mattermost-enterprise-edition:
          values:
            - path: "mattermostApp.extraEnv"
              value:
                - name: MM_PLUGINSETTINGS_ENABLEUPLOADS
                  value: "true"

After that the plugin can be installed and enabled the same way the docs list - https://github.com/mattermost/mattermost-plugin-ai?tab=readme-ov-file#install

For an automatic approach we should be able to use https://github.com/mattermost/mattermost-helm/blob/master/charts/mattermost-enterprise-edition/values.yaml#L206-L233 which shouldn't be too difficult until we assume airgap 🤪

mjnagel commented 5 months ago

Discovered in further testing that doing the above mentioned override will cause envs to get wiped out for other config (filestorage/sso). Resolving that in the linked PR, assuming that is merged the new way to approach will be:

    overrides:
      mattermost:
        uds-mattermost-config:
          values:
            - path: "config.enablePluginUploads"
              value: "true"
Racer159 commented 4 months ago

This is currently being done here and would likely be a sane default for this package: https://github.com/defenseunicorns/uds-prod-infrastructure/blob/dc5fa80ae403e376679f2b2c4e1bdca4cc0b1e05/bundles/swf/uds-bundle.yaml#L57

oates commented 2 months ago

AI plugin can be the first plugin we do, but working this issue will allow us to solve a broader problem of how we handle mattermost plugins in the package vs the bundle.

Racer159 commented 1 month ago

We should also check with @YrrepNoj to see how :frog: is doing this today

mjnagel commented 1 month ago

In a current environment running LFAI + MM we enabled plugin upload and then manually added the plugin (i.e. this was not an automated or airgapped process).

zachariahmiller commented 1 month ago

We scoped this down a bit for clarity. The expectations for this ticket will be:

  1. add ability to enable plugin uploads for mattermost to the package
  2. Create "example" zarf package under src/ that demonstrates and tests a process for programmatically including one or more plugins via that package and add it to the test bundle to test the process in ci.
  3. This process should b documented as the "blessed" method for including plugins for delivery to use if they have specific needs to include mm plugins in their specific bundle.
marshall007 commented 1 week ago

@Racer159: Worked locally - for follow on issues did you see anyway we could default settings inside a plugin? (like point that url to our Gitlab?)

screenshot ![image](https://github.com/defenseunicorns/uds-package-mattermost/assets/877936/f3184c8b-e4c9-48e4-9fb7-8c536c0956e6)

@zachariahmiller: also curious on the config... maybe env vars or something? It didnt look like their api had anything on configuring plugins, just adding them

Yes we can enable plugins by default via MM_PLUGINSETTINGS_PLUGINSTATES and configure them via MM_PLUGINSETTINGS_PLUGINS. FYI it sounds like anything we configure via these environment variables cannot be overridden in the system console.

via: https://docs.mattermost.com/configure/environment-variables.html

  • From Mattermost v7.5, environment configuration parsing supports JSON for MM_PLUGINSETTINGS_PLUGINS and MM_PLUGINSETTINGS_PLUGINSTATES. This is especially helpful for Helm configuration files, provided all plugins are configured at the same time. For example, MM_PLUGINSETTINGS_PLUGINSTATES="{\"com.mattermost.calls\":{\"Enable\":true},\"com.mattermost.nps\":{\"Enable\":true}}".
  • When settings are configured through an environment variable, System Admins can’t modify them in the System Console. If a setting is configured through an environment variable, and any other changes are made in the System Console, the value stored of the environment variable will be written back to the config.json as that setting’s value.