Mattermost Settings

Also, second issue: I’ve attempted to follow the instructions to configure Mailgun for SMTP. Mailgun has verified the domain, and the Mattermost console claims there are no errors on testing the connection, but I am not receiving test messages and I am getting authentication errors when I try to send a test message at the command line.

Our installer uses the Docker setup Redirect. You may be able to edit some settings directly in the docker-compose file at /root/mattermost-docker and then rebuild with same commands from that guide. I was under the impression most could be done in the system admin console directly in the app though.

Thanks for that! Most can be done in the console… unless you manage to lock yourself out of the console because you’ve turned on email verification not realizing that SMTP isn’t actually working. :slight_smile: I ended up rebuilding to get back in, and am now trying to figure out the SMTP problem…

Ah yeah that would do it :slight_smile: I’d love to figure out a way to do SMTP directly in a container to avoid the third party stuff. My first attempt at that ended up with all email going to spam though which I suspect is probably why many software projects are pushing for external email setup.

Yeah, I can see that. I’m set up with Mailgun and everything seems like it ought to be working (domain verified, console connection checks, etc) but when I run Mailgun’s suggested test at the command line I get an authentication error. I’ll check with them to see if they have any sense of why, but if anything occurs to you, let me know!

I’m back. :slight_smile: I wound up getting SMTP configured with a cPanel-created email address, which at least seems to be working. (Couldn’t get either Mailgun or Sendgrid working, but whatevs.)

I’ve got some ongoing questions about Mattermost and the command line, though. The Mattermost docs say that for a standard installation you need to be in the Mattermost root directory to invoke the mattermost command, and in a Docker install you have to include the name of the Mattermost container. I’m coming up empty on both counts – I’m not clear whether I should be using the standard or the Docker-based instructions, and if standard where the root directory is, and if Docker what the name of the container is.

Sorry for the super-basic questions! I’m suuuuper new to all this, obvs, but trying to import from Slack and it appears that the CLI may succeed where the in-app import function is failing.

1 Like

I took a look at this in my Mattermost instance and hopefully this helps:

Go to the Docker app folder using this command
cd ~/mattermost-docker/volumes/app

I then ran the the docker command docker ps that will list the docker containers in your environment. From there you will find the names, and as an example I ran the following command for the app container named mattermost-docker_app_1:

docker exec -it mattermost-docker_app_1 mattermost version

This gave me the version number and reported a few errors I had given I did not setup email or name my instance. Tsk tsk.

Now, seems like the entire CLI command is docker exec -it mattermost-docker_app_1 mattermost rather than just mattermost, which is a pain, but it works. I ran the following command to run a channel and it seemed to take:

docker exec -it mattermost-docker_app_1 mattermost channel create --team myteam --name mynewchannel --display_name "My New Channel"

So, right now I am feeling pretty good about my life choices :slight_smile:

SUPER. GENIUS. That’s exactly what I needed to know! Thanks so much, Jim!

Ahahahaha if it’s not one thing it’s another. I am sooooo close, but: the Mattermost CLI documentation includes the following:

Ensure you run the Mattermost binary as the mattermost user. Running it as root user (for example) may cause complications with permissions as the binary initiates plugins and accesses various files when running CLI commands. Running the server as root may result in ownership of the plugins and files to be overwritten as well as other potential permissions errors.

And as it turns out attempting to import the Slack export zip I’ve uploaded is giving me a permissions error on trying to open that file. How would I go about running an SSH session as the user mattermost?

I am not trying the same command as you, but you can add a new user, in this example mattermost is the new user, with the following:
useradd mattermost

The you can switch to that user:
su mattermost

That should allow you to run the import, but permissions might still be an issue. Let me know and I can try and figure that out.

I was able to create and switch to the user mattermost, but that user has zero privileges – can’t even change directories…

Just figured that out, as root run this for the user you created, my example user is still mattermost:

sudo usermod -a -G root mattermost

This essentially adds mattermost to the root group allowing that user to run commands.

Awesome. I managed to add the mattermost user to the root group, and that user can now change directories, etc. But I get an error on trying to run the docker-based command:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/mattermost-docker_app_1/json: dial unix /var/run/docker.sock: connect: permission denied

Sigh.

The command I’m trying to run, incidentally, is effectively this, in case it makes a difference:

docker exec -it mattermost-docker_app_1 mattermost import slack team_name /path/to/your-slack-export.zip

Root gets past the docker part of the command and gets a permission denied on trying to open the slack export file.

Got it, I’ll dig in on this again tomorrow and see if I can figure out anything.

While I can’t test it given I have nothing to import, I wonder if this solution might work:

Thanks so much, Jim! So there’s good news and there’s bad news: the good news is that this did get the mattermost user permission to run docker commands, which is great.

The bad news is that now I get the same error with the mattermost user as I do with root: a permission denied on trying to open the slack_export.zip file.

I’ve set permissions on that file to 777 and still no luck. I’m going to search around and see if I can find anything about this…

Next step: changed ownership of the export file to mattermost:docker. Same permission denied error.

I have been searching around and am baffled. Could there be a problem with any user, including root, opening .zip files in particular?

I am bringing out the big guns on this one, I asked @cblankenship in our infrastructure team to take a look at to see if he has some ideas, I wanted to dedicate more time looking at this this morning but my day got away from me.