[Solved] Can't connect to mattermost server

hi,
I am setting up a Mattermost server on a private server. I have decided to start off by connecting to the server without TLS.

The server is running. I can interface with the app by using the browser on the remote server with the URL localhost:Port-Number.

I can see that the mattermost server is listening to that port.

sudo lsof -i :Port-Number -S
COMMAND     PID       USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
firefox    5745      user  126u  IPv4 1130383275      0t0  TCP localhost.localdomain:38034->localhost.localdomain:Port-Number (ESTABLISHED)
mattermos 14862 mattermost   16u  IPv6 1130388551      0t0  TCP *:Port-Number (LISTEN)

I can see the port is opened by the Iptables chain rules both for INPUT and OUTPUT.

ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:Port-Number

I can’t access the mattermost server from my local machine when I enter http://site_url:Port-Number.

There is nothing in the logs that helps me understand what the issue is. I am surprised to see that the Enterprise Enabled is set to true.

{"level":"info","ts":1688704343.656596,"caller":"app/app.go:195","msg":"Server is initializing..."}

{"level":"info","ts":1688704343.658911,"caller":"sqlstore/supplier.go:200","msg":"Pinging SQL master database"}

{"level":"info","ts":1688704343.899801,"caller":"commands/server.go:81","msg":"Current version is 5.3.0 (5.3.1/Wed Sep 19 07:42:34 UTC 2018/fd21e53365d504155ab87f9bef60b1ab4faeb38d/c87ad1eeda18455c22a42ede7276194412e3a25f)"}

{"level":"info","ts":1688704343.8998895,"caller":"commands/server.go:82","msg":"Enterprise Enabled: true"}

{"level":"info","ts":1688704343.8999019,"caller":"commands/server.go:83","msg":"Current working directory is /opt/mattermost"}

{"level":"info","ts":1688704343.8999455,"caller":"commands/server.go:84","msg":"Loaded config file from /opt/mattermost/config/config.json"}

{"level":"info","ts":1688704343.900035,"caller":"utils/file_backend_local.go:32","msg":"Able to write files to local storage."}

{"level":"info","ts":1688704343.9011378,"caller":"app/license.go:44","msg":"License key from https://mattermost.com required to unlock enterprise features."}

{"level":"info","ts":1688704343.9017532,"caller":"app/plugin.go:100","msg":"Starting up plugins"}

{"level":"info","ts":1688704344.2519147,"caller":"app/server.go:88","msg":"Starting Server..."}

{"level":"info","ts":1688704344.2520406,"caller":"app/server.go:148","msg":"Server is listening on [::]:Port-Number"}

{"level":"info","ts":1688704344.256222,"caller":"app/web_hub.go:75","msg":"Starting 24 websocket hubs"}

{"level":"info","ts":1688704344.2747269,"caller":"sqlstore/post_store.go:1297","msg":"Post.Message supports at most 16383 characters (65535 bytes)"}

{"level":"info","ts":1688704344.2928278,"caller":"jobs/workers.go:62","msg":"Starting workers"}

{"level":"info","ts":1688704344.2929015,"caller":"commands/server.go:265","msg":"Sending systemd READY notification."}

{"level":"info","ts":1688704344.2930229,"caller":"jobs/schedulers.go:68","msg":"Starting schedulers."}

It is like the port is not open or the app doesn’t get the external traffic. Any tips will be appreciated

Hi Rochus,

Thank you for reaching out!

Based on the information you provided, it seems that you have set up the Mattermost server on a private server and are trying to access it without TLS (HTTP) using the URL http://site_url:Port-Number. However, you are unable to access the server from your local machine. Here are a few tips to troubleshoot the issue:

  1. Check Firewall Settings: Ensure that the firewall on your private server allows incoming connections on the specified port number. You mentioned that the iptables rules are in place, but double-check that the rules are correctly configured to allow incoming traffic.
  2. Check Network Configuration: Verify that your private server has a public IP address or is accessible through a public network. If your server is behind a router or firewall, you may need to set up port forwarding to ensure incoming connections reach the correct server.
  3. Verify Correct Port: Make sure you are using the correct port number when accessing the Mattermost server. Double-check the configuration file (/opt/mattermost/config/config.json) to confirm the port number the server is configured to listen on.
  4. Check Network Connectivity: Ensure that your local machine can reach the private server over the network. You can try using tools like telnet or curl from your local machine to test connectivity to the server’s IP address and port number.For example, from your local machine, run the following command in the terminal:
telnet server_ip Port-Number

If the connection is successful, it means your local machine can reach the server. If not, you may need to troubleshoot the network connectivity between your local machine and the private server.
5. Review Mattermost Logs: Check the Mattermost server logs (/opt/mattermost/logs) for any errors or warnings that might provide insights into the issue. Look for any log entries related to incoming connections or networking.

If you are still experiencing issues after following these tips, it may be helpful to provide more details about your server setup, network environment, and any error messages or logs you observe.

I hope this helps! If you have any further concerns or need additional assistance, please don’t hesitate to let me know.

Best regards,
~Matterbot 1.0

[Disclaimer: This is a new automated response feature we’re testing powered by ChatGPT. Please be aware that this response should be considered as a simulated suggestion and may not always reflect official Mattermost recommendations or support. Use the information provided at your own discretion. Were any of the above suggestions inaccurate? Please feel free to reply with any suggested corrections!]

Thanks @john.combs. I have solved this problem and you make reference to it in 1. Although the port appeared to be opened the iptables rule negated the effect of the open port. There was a rule regarding the rejection and it is unclear how it got there. Once this was removed my connection worked again. I will give you the solution since you made reference to it.

1 Like