Automatically activate plugin

We run mattermost in docker using docker compose. All the settings are variables.

The first setting gets polulated correctly adn uploads are enabled.
- MM_PLUGINSETTINGS_ENABLEUPLOADS=true

Enabling the plugin does not work.
-MM_PLUGINSETTINGS_PLUGINSTATES_COM.GITHUB.MATTERPOLL.MATTERPOLL_ENABLE=true

Any help appreciated.

Hi @larvel,

Can you help share more details on your environment from here as this will help us diagnose the issue: https://docs.mattermost.com/process/support.html#general-questions-for-any-issues? Also any relevant config settings and log errors will be helpful.

Based on the information you provided, it looks like you are attempting to use the Matterpoll plugin? If yes, I also encourage you to join our Matterpoll channel and ping Hanzei for any questions (he is the maintainer of the Matterpoll plugin).

1 Like

Could not paste our docker-compose here, so: https://pastebin.com/RF6VkZGY

This works, except for automatically enabling the plugin upon restart

Thanks @larvel, what error messages are you getting when trying to enable the plugin?

Sorry for the late response.

The only error seen is this.
{“level”:“error”,“ts”:1543919177.7169154,“caller”:“app/plugin_requests.go:33”,“msg”:“Access to route for non-existent plugin”,“missing_p
lugin_id”:“com.github.matterpoll.matterpoll”,“error”:“plugin not found: com.github.matterpoll.matterpoll”}

I have not datestamp, so its hard to know what caused this and when it happened.

The plugin works fine, the only issue we have is automatically enabling it.

Hi @larvel,

One of our community members mentioned that you’ll need to replace . s with _ s in the name of the environment variable.

Let me know if this helps,

Thanks for the suggestion. If you see my pastebin, that is one of the things we have tried:

https://pastebin.com/RF6VkZGY

Hi @larvel, would you be open to joining our Matterpoll channel and pinging Hanzei (he is the maintainer of the Matterpoll plugin)?

Hi,

I did reach out to @Hanzei. We agreed that this is not a problem with the plugin itself, but rather a general one.
How would you activate a plugin using environment variables?

Here is what we have tried: (in docker-compose.yml)
- MM_PLUGINSETTINGS_PLUGINS: |
“com.github.matterpoll.matterpoll”: {
“Enable”: true
}
- MM_PLUGINSETTINGS_PLUGINSTATES="{“com.github.matterpoll.matterpoll”:{“Enable”:true}}"

  - MM_PLUGINSETTINGS_PLUGINSTATES_COM.GITHUB.MATTERPOLL.MATTERPOLL_ENABLE=true
  - MM_PLUGINSETTINGS_PLUGINSTATES_COM_GITHUB_MATTERPOLL_MATTERPOLL_ENABLE=true

The formatting was not good. What you see is four different attempts to try and set the plugin as activated upon start.

Hi @larvel
Have you solved the issue? I run into this and can’t figure it out
Any help appreciated

I simply run a cron script every morning in case the server has updated and booted during the night

30 6 * * * docker exec mattermostserver /mattermost/bin/mattermost plugin enable com.github.matterpoll.matterpoll >/dev/null 2>&1

1 Like

I’m trying to enable this in ansible playbook task and cronjob won’t work for me. Anyways thank you for your quick reply :slight_smile:

@larvel you can enable a plugin using a command line like below:

mattermost plugin enable ${PLUGIN_ID}
#For example
mattermost plugin enable com.github.matterpoll.matterpoll
1 Like

Is there is still no way to manage plugin activation via environment variables? Extending that, what about plugin configuration?

If the PR will be merged, the issue should be resolved by [MM-22831] nested config value setting using env vars by gabor-boros · Pull Request #21049 · mattermost/mattermost-server · GitHub

Also, this is related I believe: [MM-22831] - Mattermost

@amy.blais I think the PR above would solve the issue raised in this discussion.

1 Like