# Automatically activate plugin

**URL:** <https://forum.mattermost.com/t/automatically-activate-plugin/6289>\
**Category:** Troubleshooting\
**Created:** [December 3, 2018, 8:53pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289 "2018-12-03T20:53:56Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![larvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/larvel/32/2569_2.png) [@larvel](https://forum.mattermost.com/u/larvel)\
**Post date:** [December 3, 2018, 8:53pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/1 "2018-12-03T20:53:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [December 3, 2018, 11:32pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/2 "2018-12-03T23:32:31Z")

</div>

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](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](https://community.mattermost.com/core/channels/matterpoll) and ping `Hanzei` for any questions (he is the maintainer of the Matterpoll plugin).

---

<div class="post-metadata">

**Author:** ![larvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/larvel/32/2569_2.png) [@larvel](https://forum.mattermost.com/u/larvel)\
**Post date:** [December 4, 2018, 10:07am UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/3 "2018-12-04T10:07:48Z")

</div>

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

This works, except for automatically enabling the plugin upon restart

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [December 4, 2018, 7:41pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/4 "2018-12-04T19:41:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![larvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/larvel/32/2569_2.png) [@larvel](https://forum.mattermost.com/u/larvel)\
**Post date:** [December 6, 2018, 8:20am UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/5 "2018-12-06T08:20:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [December 6, 2018, 4:16pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/6 "2018-12-06T16:16:23Z")

</div>

Hi @larvel,

One of our community members mentioned that you’ll need to [replace `.` s with `_` s](https://github.com/mattermost/mattermost-server/blob/v5.6.0-rc1/utils/config.go#L284) in the name of the environment variable.

Let me know if this helps,

---

<div class="post-metadata">

**Author:** ![larvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/larvel/32/2569_2.png) [@larvel](https://forum.mattermost.com/u/larvel)\
**Post date:** [December 6, 2018, 4:48pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/7 "2018-12-06T16:48:03Z")

</div>

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

[https://pastebin.com/RF6VkZGY](https://pastebin.com/RF6VkZGY)

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [December 12, 2018, 9:51pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/8 "2018-12-12T21:51:56Z")

</div>

Hi @larvel, would you be open to joining our [Matterpoll channel](https://community.mattermost.com/core/channels/matterpoll) and pinging `Hanzei` (he is the maintainer of the Matterpoll plugin)?

---

<div class="post-metadata">

**Author:** ![larvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/larvel/32/2569_2.png) [@larvel](https://forum.mattermost.com/u/larvel)\
**Post date:** [December 13, 2018, 7:20am UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/9 "2018-12-13T07:20:44Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![larvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/larvel/32/2569_2.png) [@larvel](https://forum.mattermost.com/u/larvel)\
**Post date:** [December 13, 2018, 7:22am UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/10 "2018-12-13T07:22:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahnenerbe](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@ahnenerbe](https://forum.mattermost.com/u/ahnenerbe)\
**Post date:** [February 19, 2019, 1:08pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/11 "2019-02-19T13:08:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![larvel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/larvel/32/2569_2.png) [@larvel](https://forum.mattermost.com/u/larvel)\
**Post date:** [February 19, 2019, 1:24pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/12 "2019-02-19T13:24:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ahnenerbe](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@ahnenerbe](https://forum.mattermost.com/u/ahnenerbe)\
**Post date:** [February 19, 2019, 1:26pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/13 "2019-02-19T13:26:42Z")

</div>

> [@larvel](#):
>
> MM\_PLUGINSETTINGS\_PLUGINSTATES\_COM\_GITHUB\_MATTERPOLL\_MATTERPOLL\_ENABLE=true

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

---

<div class="post-metadata">

**Author:** ![eduard](https://avatars.discourse-cdn.com/v4/letter/e/3da27b/32.png) [@eduard](https://forum.mattermost.com/u/eduard)\
**Post date:** [November 3, 2020, 11:13am UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/14 "2020-11-03T11:13:41Z")

</div>

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

```auto
mattermost plugin enable ${PLUGIN_ID}
#For example
mattermost plugin enable com.github.matterpoll.matterpoll

```

---

<div class="post-metadata">

**Author:** ![westphaldp](https://avatars.discourse-cdn.com/v4/letter/w/f08c70/32.png) [@westphaldp](https://forum.mattermost.com/u/westphaldp)\
**Post date:** [October 29, 2021, 5:11pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/15 "2021-10-29T17:11:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gabor-boros](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/gabor-boros/32/5917_2.png) [@gabor-boros](https://forum.mattermost.com/u/gabor-boros)\
**Post date:** [September 20, 2022, 2:17pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/16 "2022-09-20T14:17:19Z")

</div>

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](https://github.com/mattermost/mattermost-server/pull/21049)

Also, this is related I believe: [[MM-22831] - Mattermost](https://mattermost.atlassian.net/browse/MM-22831)

---

<div class="post-metadata">

**Author:** ![gabor-boros](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/gabor-boros/32/5917_2.png) [@gabor-boros](https://forum.mattermost.com/u/gabor-boros)\
**Post date:** [October 4, 2022, 2:09pm UTC](https://forum.mattermost.com/t/automatically-activate-plugin/6289/17 "2022-10-04T14:09:59Z")

</div>

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