I have an instance of Mattermost with Docker and Letsencrypt. It works very well sunny:
What recommendations do you have or best practices to update and maintain Let’s encrypt certs?
I have an instance of Mattermost with Docker and Letsencrypt. It works very well sunny:
What recommendations do you have or best practices to update and maintain Let’s encrypt certs?
@nils-schween, thank you for the solution. Where within nginx.conf do I replace nginx’s upstream “localhost” with “127.0.0.1”?
I can not find upstream in my nginx.conf
Thanks.
@amy.blais, thank you for the solution. Where within nginx.conf do I replace nginx’s upstream “localhost” with “127.0.0.1”?
I can not find upstream in my nginx.conf
Thanks.
In my configuration, the DB host is on the remote host
root@public:/opt/mattermost# ./bin/mattermost config get "SqlSettings"
DataSource: "mattermost:password@tcp(192.168.1.200:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"
DataSourceReplicas: "[]"
MaxIdleConns: "20"
MaxOpenConns: "300"
AtRestEncryptKey: "ezw39cnq7rjafxegq4nguk3rgzy3audp"
QueryTimeout: "30"
DriverName: "mysql"
DataSourceSearchReplicas: "[]"
ConnMaxLifetimeMilliseconds: "3600000"
Trace: "false"
But when I run the program, it always to try to connect local host IP address (192.168.1.204) instead of remote DB host (192.168.1.200):
root@public:/opt/mattermost# ./bin/mattermost
{"level":"info","ts":1561978741.348163,"caller":"utils/i18n.go:83","msg":"Loaded system translations for 'en' from '/opt/mattermost/i18n/en.json'"}
{"level":"info","ts":1561978741.3484783,"caller":"app/server_app_adapters.go:58","msg":"Server is initializing..."}
{"level":"info","ts":1561978741.356139,"caller":"sqlstore/supplier.go:224","msg":"Pinging SQL master database"}
{"level":"error","ts":1561978741.3588479,"caller":"sqlstore/supplier.go:236","msg":"Failed to ping DB retrying in 10 seconds err=Error 1045: Access denied for user 'mattermost'@'192.168.1.204' (using password: YES)"}
Setup database on other machine (192.168.1.200)
Configure the config.json to pointing the remote DB machine
./bin/mattermost config set SqlSettings.DataSource mattermost:password@tcp(192.168.1.200:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s
Run ./bin/mattermost
Target DB host should be same in as written in the config file (192.168.1.200)
Target DB host same as the local host (192.168.1.204)
HI @jkimathi,
if you take a look at the nginx configuration I posted, you find the upstream “backend” at the beginning,
upstream backend {
server localhost:8065;
keepalive 32;
}
Replace localhost with 127.0.0.1.
Or alternatively, take a look at the nginx configuration, which can be found in the manual:
https://docs.mattermost.com/install/install-ubuntu-1804.html#configuring-nginx-as-a-proxy-for-mattermost-server
At its beginning you find the following lines:
upstream backend {
server 10.10.10.2:8065;
keepalive 32;
}
Replace 10.10.10.2 with 127.0.0.1.
Hi there,
I’m facing the same issue with a fresh install (server 5.10.0, desktop app 4.2.1).
Desktop apps are run under MACOS & Windows.
Server is run in a LXC container on a Debian Stretch host, behind a Ngnix proxy. Here’s the conf:
upstream backend {
server mattermost:8065;
keepalive 32;
}
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;
server {
listen 80;
server_name chat;
access_log /var/log/nginx/chat.access.log;
error_log /var/log/nginx/chat.error.log;
location ~ /chat/api/v[0-9]+/(users/)?websocket$ {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 50M;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
client_body_timeout 60;
send_timeout 300;
lingering_timeout 5;
proxy_connect_timeout 90;
proxy_send_timeout 300;
proxy_read_timeout 90s;
proxy_pass http://backend;
}
location /chat/ {
client_max_body_size 50M;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_cache mattermost_cache;
proxy_cache_revalidate on;
proxy_cache_min_uses 2;
proxy_cache_use_stale timeout;
proxy_cache_lock on;
proxy_http_version 1.1;
proxy_pass http://backend;
}
}
This proxy itself is behind another Nginx proxy with the following conf:
location /chat/ {
proxy_pass http://chat/chat/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 50M;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
client_body_timeout 60;
send_timeout 300;
lingering_timeout 5;
proxy_connect_timeout 90;
proxy_send_timeout 300;
proxy_read_timeout 90s;
}
I primarily do development in a single language. Is there a way to set a default language that’s used for blocks of code? I don’t to have to type ``` every time…
Hi all,
I’m facing some issue with Mattermost push notification on an legacy project. Since I’m new here, I firstly tried to google for solution, investigate documentation and source code, but still can’t resolve this issue:
“ERROR Did not send message because of missing platform property type=apple_rnbeta”
Here is my mattermost-push-proxy.json:
{
“ListenAddress”: “:8066”,
“ThrottlePerSec”: 300,
“ThrottleMemoryStoreSize”: 50000,
“ThrottleVaryByHeader”: “X-Forwarded-For”,
“EnableMetrics”: false,
“ApplePushSettings”: [
{
“Type”: “apple”,
“ApplePushUseDevelopment”: false,
“ApplePushCertPrivate”: “./aps_production_priv.pem”,
“ApplePushCertPassword”: “”,
“ApplePushTopic”: “com.my.app”
},
{
“Type”: “apple_rn”,
“ApplePushUseDevelopment”: false,
“ApplePushCertPrivate”: “./aps_production_priv.pem”,
“ApplePushCertPassword”: “”,
“ApplePushTopic”: “com.my.app”
}
],
"AndroidPushSettings": [
{
"Type": "android_rn",
"AndroidApiKey": "ANDROID_KEY"
}
]
}
I tried to update “apple_rn” to “apple_rnbeta” but this didn’t resolve my issue. On android, everything is fine, but I can’t make it to work on iOS.
When I test manually,
curl MYHOST/send_push -X POST -H “Content-Type: application/json” -d ‘{“type”: “message”, “message”: “test”, “badge”: 1, “platform”: “apple_rn”, “server_id”: “MY_ID”, “device_id”: “MY_DEVICE_ID”, “channel_id”: “com.my.app”}’
As result I get {“status”:“REMOVE”}
But when I run same command, but change platform property to “apple_rnbeta” i get same error:
"Did not send message because of missing platform property type=apple_rnbeta "
In documentation I couldn’t find detailed information about type property in documentation. It seems to me mattermost server pushing wrong property to push proxy, but I can’t prove it.
Can someone help me to solve this issue, or at least explain what is the issue here, please? I really spent to much time on this and couldn’t solve this issue.
Many thanks,
Nikola
I’m setting up mattermost on GCE while following https://docs.mattermost.com/install/install-ubuntu-1804.html .
I’m stacking at “Installing Mattermost Server — 8.Test the Mattermost server to make sure everything works.” in the tutorial page. I think I followed instruction so far without fail, but I cannot access Mattermost instance.
When I run it by sudo -u mattermost ./bin/mattermost
, message "Server is listening on [::]:8065"
appears.
But accessing by curl http://localhost:8065
, I receive html that says We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work, please verify that your computer is connected to the internet.
Accessing by curl http://<ip-address-of-server>:8065
, I receive nothing. And I enter this URL in browser, it says Firefox can’t establish a connection to the server at <ip-address-of-server>.
Are there any extra settings to access Mattermost? Thank you for helping me.
Hi @RbDev, we submitted a PR for this here: https://github.com/mattermost/mattermost-mobile/pull/2943.
Hi @nikolakale, wondering if these previous issues might help:
Hi @YutaNagaoka,
Here are some additional questions to help troubleshoot this:
This thread might also help: [SOLVED] Server started but app not connecting and no logs
You’re setting up Mattermost using Docker in production and want to use a Let’s Encrypt certificate. When you attempt to configure this via the System Console you get the following error:
p_1 | {"level":"error","ts":1562088526.1421692,"caller":"commands/server.go:77","msg":"listen tcp :443: bind: permission denied"}
Note: This assumes you have a valid domain name for your Mattermost server. Replace mattermost.example.com
with your domain name. This has also been tested on Ubuntu 18.04, but should work for any version of Linux that supports docker
and certbot
.
cd ~/mattermost-docker
docker-compose stop
~/mattermost-docker/volumes/config/config.json
“SiteURL”: “https://mattermost.example.com”,
“ListenAddress”: “:8000”,
“ConnectionSecurity”: “”,
“UseLetsEncrypt: false,
“Forward80To443” false,
certbot
from Let’s Encryptsudo apt-get install certbot
sudo certbot certonly —standalone -d mattermost.example.com
Then follow the onscreen prompts to generate your new certificate
sudo cp /etc/letsencrypt/live/mattermost.example.com/fullchain.pem /home/ubuntu/mattermost-docker/volumes/web/cert/cert.pem
sudo cp /etc/letsencrypt/live/mattermost.example.com/privkey.pem /home/ubuntu/mattermost-docker/volumes/web/cert/key-no-password.pem
cd ~/mattermost-docker
docker-compose up -d
Your site should now be available on https://mattermost.example.com/
Because the default mattermost-docker
instructions include an Nginx reverse proxy server that runs on ports 80 and 443, and forwards requests to the Mattermost server that’s listening on port 8000. However, in order for Mattermost to handle the Let’s Encrypt negotiation it needs to run on 80 and 443 so it can respond to the authentication challenge.
If you have any questions or improvements to this recipe please let me know!
Hi @jcurt11n,
As a first step, some of these earlier threads might help:
Hi @RbDev, was this during a poor network connection and does this happen regularly?
Hi @amy.blais,
4G connection. Cannot garantee 100% connection.
It seems mobile app cannot handle connection issues when sending new messages.
Sometimes the device has got connection but it’s unable to send or receive data. The app tries to send but it doesn’t work, until the process times out.
Cheers
~If refreshing this page (Ctrl+R or Command+R) does not~
on command line. And this command line is connected to VM on GCE(Google Compute Engine) with SSH.I will check log setting and collect more information.
Hi @RbDev, our dev gave feedback that they’re not sure what that job does, but 600 rows added in a month is a pretty minor growth.
@RbDev, are all the new rows of type Plugin
? This particular job is responsible for cleaning up expired key value entries, and runs fairly frequently. I’m scratching my head as to why it’s recording an entry in the database each time. How many new entries are you getting a day?
Hi @amy.blais and @jesse,
There are 195075 with the same type ‘plugins’. From what you said it should only be 1?
Yes it should if we are talking about the same service saved in a normalised table.
Let me know if you need anything else.
Cheers