All right, I’ll do my best to write up what I did-
So first and foremost I wanted this running on TrueNAS/FreeNAS because I like the design philosophy behind it as a piece of software. I know there are other solutions that make it easier but I didn’t want another box running in the house.
I also didn’t want it running in a VM, honestly I don’t know if that would have been easier because I didn’t try. This could be another scenario where I’m “wrong” but I just feel like a vm has more overhead than a jail, and I like the way jails seem to work.
So I pretty much made a default jail, the things I changed was DHCP auto-configure (want that check marked on) for ipv4, and then I made my domain name for the jail the same as the EXAMPLE.domain.com. I don’t know if that part actually helps but I read that’s what a FQDN is.
So to start you need a “FQDN”, fully qualified domain name, pointing to your jail. This is an “A” record pointing at the IP of your jail. Well in my case pointing to my home IP, which I then had to forward the 80/443 ports from the jail IP.
NOW we gotta set up a database. We have two options, Postersql or MySql. I’m not going to lie, since I have zero experience with either of these? I went by logo- so Postersql wins.
I used this guide, as a guide:
Keep in mind though, I was using names/etc that I new I wanted for the Mattermost deployment.
The “important” thing is to make sure we trust the local connection that mattermost is going to make to it.
That’s just a screenshot from his guide, but that 127.0.0.1, we want that set to trust. Now in my version it was by default. This thing isn’t going to have any communication outside the jail so I think it’s fine.
Allright, so we have our domain pointed, our jail set up, and now our database set up. Next up is Mattermost itself. The actually install is pretty easy, I followed part of a guide (that actually wasn’t super useful but it was the only one I could find for FreeBSD).
It’s the link I posted previously in this thread, but I’ll be shamelessly pulling the parts I like out of it.
They said to install these:
pkg ins mattermost-server mattermost-webapp i18ntools
I don’t actually know what that i18ntools is. But just in case it’s the linchpin tying this thing together I say let it ride.
cp /usr/local/etc/mattermost/config.json.sample /usr/local/etc/mattermost/config.json
sysrc mattermostd_enable="YES"
chown -R mattermost:mattermost /usr/local/www/mattermost/client/
vi /usr/local/etc/mattermost/config.json
First line copies the default config into the config we’ll be using, second line makes it so mattermost starts as a service when the jail starts (like the guide had you do with the database), 3rd makes mattermost own it’s website? from what I can tell? Last line is us editing the config file.
Now we get to have more fun in configuration files. We have to tell the Mattermost installation how to talk to the Database. Believe it or not the official Mattermost documentation is really good at telling you how to configure things. Go figure.
https://docs.mattermost.com/administration/config-in-database.html
the important part for us, being on FreeBSD, is that we’re going to vi into the config files to edit them to point to/and use our postersql database.
OK- We’re reaching the final steps here! Whew!
Now it’s time for nginx, which I had never used before, but let me tell you- this is a neat piece of software. No joke, it’s super nifty- it’s clean too.
before that though we need our certificate. Which was ALSO something I had never had to do before. Certbot FTW fyi! Another nifty piece of software!
There’s actually pretty good documentation on how to use this guy too:
I used cloudflare, which btw can take a bit for the nameservers to “update” which is why I have all that stuff at the beginning.
I’m going to assume you’ve successfully gotten your certificate and key for your FQDN, because now we’re onto the final stuff:
pkg ins nginx
sysrc nginx_enable=YES
vi /usr/local/etc/nginx/nginx.conf
First line installs it,
second line enables it to run as a service
third line is to get into the config file.
Again, Mattermost’s documentation is pretty good here, but there’s a couple things that are different since we’re using FreeBSD
https://docs.mattermost.com/install/config-proxy-nginx.html
The important thing to remember is we are NOT replacing our config file with what they write. We need to keep our Events/http tags. I also think it helps to add a comment letting you know where they end so:
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
###THIS IS WHERE WE PUT THEIR CONFIG INFO##
}#http end
I hope that makes sense- we basically follow the documentation I linked, but it goes where I marked it.
Cross your fingers, now we see if it all works.
system nginx start
system mattermostd start
Ok. If everything is configured right you should be able to go to your FQDN and you’ll see the landing page for mattermost. The only other thing I had to do was set my cloudflare ssl encryption to “full”, I was getting a too many redirects error before that.
Whew. That was a lot of typing. I hope it helps someone. Also, I’m a hobbyist, so I probably didn’t do everything the best way I could have. feel free to criticize me- cuz maybe we can find a better way to get it done lol!