Can't upload plugin after editing config.json

I followed a forum post stating you have to edit config.json to allow uploading of plugins, but even after doing that and restarting the server, I still do not have the option to upload plugins. Is this potentially a bug?

`root@xxxxx:~# cat /opt/mattermost/config/config.json | grep -A6 "PluginSettings"
  "PluginSettings": {
    "Enable": true,
    "EnableUploads": true,
    "AllowInsecureDownloadUrl": false,
    "EnableHealthCheck": true,
    "Directory": "./plugins",
    "ClientDirectory": "./client/plugins",

root@xxxxx:~# ls -lAh /opt/mattermost/
total 280K
drwxr-xr-x 2 mattermost mattermost 4.0K Jan 13 04:48 bin
drwxr-xr-x 7 mattermost mattermost 4.0K Jan 13 04:55 client
drwxr-xr-x 2 mattermost mattermost 4.0K Jan 13 07:57 config
-rw-r--r-- 1 mattermost mattermost 2.1K Dec 18 14:52 ENTERPRISE-EDITION-LICENSE.txt
drwxr-xr-x 2 mattermost mattermost 4.0K Jan 13 04:48 fonts
drwxr-xr-x 2 mattermost mattermost 4.0K Jan 13 04:48 i18n
drwxr-xr-x 2 mattermost mattermost 4.0K Jan 13 05:21 logs
-rw-r--r-- 1 mattermost mattermost  898 Dec 18 14:52 manifest.txt
drwxr-xr-x 4 mattermost mattermost 4.0K Jan 13 04:48 mmomni
-rw-r--r-- 1 mattermost mattermost 224K Dec 18 14:52 NOTICE.txt
drwxr--r-- 5 mattermost mattermost 4.0K Jan 13 05:12 plugins
drwxr-xr-x 2 mattermost mattermost 4.0K Jan 13 04:48 prepackaged_plugins
-rw-r--r-- 1 mattermost mattermost 6.2K Dec 18 14:52 README.md
drwxr-xr-x 2 mattermost mattermost 4.0K Jan 13 04:48 templates`
1 Like

Hello @skarz I do think this may be a permissions issue with the file system itself. I noticed that while

shows that it has the x which indicates it is executable, the directory

seems to be missing this property, which is important given the languages Mattermost is developed in require to be executed on the hosting server in order to properly function. I’m not 100% sure this is the entire issue, but it may as well be a good place to start!

Hey I found out the issue. I installed Mattermost with mattermost-omnibus and I found a section of the documentation that states this:

For Omnibus to work properly, there are some configuration parameters that are fixed and cannot be changed through the web interface - for example, the port that Mattermost uses to run. Other parameters need to be configured directly in the mmomni.yml file instead of in the Mattermost web interface or the config.json file.

Issue resolved!

2 Likes

That’s great, I’m glad to hear that!

I have the same issue as @skarz - the first thing I tried was the config.json…but this too is a mattermost-omnibus installation on vanilla Ubuntu 20.04 focal - my mmomni.yml file shows:

root@ubuntu###:/etc/mattermost# cat mmomni.yml 
db_user: mmuser
db_password: ##########
fqdn: ########
email: ##########
https: true
data_directory: /var/opt/mattermost/data
enable_plugin_uploads: true
enable_local_mode: true

But its still greyed out in the dashboard, so I went with the mmctl config edit --local to update it (tried in vim, nano…) nothing actually updated it so I did this:

$ mmctl config set PluginSettings.EnableUploads "true" --local
Value changed successfully

Then tried mmctl config reload --local and rebooting the server as well, nothing seems to work, the config printout from mmctl config show --local still shows:

....

},
  "PluginSettings": {
    "Enable": true,
    "EnableUploads": false,
    "AllowInsecureDownloadUrl": false,
    "EnableHealthCheck": true,
    "Directory": "./plugins",
    "ClientDirectory": "./client/plugins",
    "Plugins": {

....

This is driving me crazy, Do I have to find a way to manually edit that in the database or something? I may have read something that states you have to run mmctl from a specific directory but I can no longer find that, I am running it from the server root as the mattermost user is that correct? Is there something I am missing about this?

Thank you,

-Caleb

mmomni reconfigure solved this.

2 Likes

Thanks for this it worked

It is truly **** crazy annoying that there is no comprehensive documentation explaining how to do things in MM (omnibus or any other)
It is one huge mess of “try this and that maybe it works”

That is sad and a bad publicity.

And note, uploading the plugin now works, but still fails with Received invalid response from the server. once the upload is supposed to happen.
So, still not working (and the plugin comes straight from the marketplace!)
Cause: 413 Request Entity Too Large LOL failure.

1 Like

I finally got this to work.

Omnibus does not use config.json. To change MaxFileSize, run sudo mmctl --local config edit. If it opens in vim like it did for me, type / to search, then MaxFileSize, and enter. Hit i to insert. The value is in bytes, change it to something larger, just adding a 0 is fine. To save, hit escape, type :, x, enter.
Apply the change: sudo mmctl --local config reload
Confirm the change was applied: sudo mmctl --local config show | grep MaxFileSize

To change the max upload size for nginx, we need to tell mattermost to use a custom nginx template.

Copy the default template to a new location. cp /opt/mattermost/mmomni/ansible/playbooks/mattermost.conf /home/ubuntu/mattermost.conf

Edit the file and change client_max_body_size in location / to something larger than the file you’re uploading.
Edit mnomni.yml: sudo nano /etc/mattermost/mmomni.yml.
Add a line: nginx_template: /home/ubuntu/mattermost.conf
Also change enable_plugin_uploads to true if you haven’t already.
Apply the change: sudo mmomni reconfigure

Now you should be able to go to Mattermost system console and upload a plugin!