I installed Mattermost with docker on a server running plesk.
Mattermost itself seems to be running fine but after a few seconds I get the red websocket error on the top.
I am assuming I need to add something to the NGINX directives but I can’t figure out what I am supposed to be adding.
(notice the different IP addresses there, One is the docker internal one and one is the local one, tried both and still nothing )
This still does not make it work.
Please try to incorporate the defaults into your configuration, leaving out everything related to proxy_cache. F.ex. this looks suspicious, but might be OK depending on your configuration:
Can you change that to only $http_host?
With regards to the IP addresses being used: I assume your nginx is not running inside the docker network, right? Depending on your docker configuration, 127.0.0.1:8065 might be the correct target. You can verify that by running the following command on the console of your server. If the output contains a few lines with the text Mattermost in it, you know you’re right:
In the default configuration, the backend is specified as backend - you can either create a configuration for that in your nginx.conf or keep using 127.0.0.1:8065 instead of it. If you decide to go for the named version, this is the config block which you can add at the top (outside the server block) of your nginx.conf:
upstream backend {
server 127.0.0.1:8065;
keepalive 32;
}
Thank you.
I tried this, however it did not work.
In my docker logs, I get the following error
{“timestamp”:“2022-11-07 21:36:11.302 -08:00”,“level”:“error”,“msg”:“Failed to upgrade websocket connection.”,“caller”:“web/context.go:117”,“path”:“/api/v4/websocket”,“request_id”:“5at4qb9i37fxubyus3bjwcdwcw”,“ip_addr”:“172.19.0.1”,“user_id”:“9c7puw3sx7yj8ckaayxia1mbzc”,“method”:“GET”,“err_where”:“connect”,“http_code”:500,“error”:“connect: Failed to upgrade websocket connection., websocket: the client is not using the websocket protocol: ‘upgrade’ token not found in ‘Connection’ header”}
What exactly did you try? How does the resulting configuration file look like now and did you make sure to reload/restart the involved services after making the changes?
The error message indicates that the sockets are not being properly forwarded to your Mattermost application server, so can you elaborate on your topology? How is the HTTP request to your Mattermost instance being handled? What’s listening on port 443 on this server and are there maybe multiple instances of nginx running in a chain (one being in a docker container, f.ex.)?
I guess this is a bit over my head.
I use Plesk and installed mm as a docker image.
I will paste here the main NGINX conf file contents for this domain. (previously, I added the Mattermost under additional nginx directives option that Plesk has and not in the original file)
I changed all domain references to example.com and IP address to IP. (where it has 0.0.0.0 and 127… I left alone)
#ATTENTION!
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY, #SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
OK, so the rest of the Mattermost specific configuration is in the file /var/www/vhosts/system/exapmle.com/conf/vhost_nginx.conf?
In this nginx config, it clearly states:
#extension mattermost begin
# Mattermost is enabled but not configured for this domain.
#extension mattermost end
So not sure what to do here since I’ve never tried to install it on Plesk, but maybe you will need to activate the extension for this domain so it configures the nginx vhost properly?
The extension docker has been enabled as it seems and it added the following configuration block:
This is basically correct, but not enough for Mattermost since it’s missing the websocket specific configuration here, so you could try to disable the extension docker for this VHOST and enable the extension mattermost. Let’s see what the resulting config file looks like then.
Also: You might also want to disable one of the SSL extensions, you will most likely not need sectigo and letsencrypt active at the same time in the same VHOST.