www/mattermost-server

I installed www/mattermost-server from ports. When I try to start it with mattermostd server, I get the following error:

Code:
# mattermostd server
{"level":"warn","msg":"Running Mattermost as root is not recommended. Please use a non-root user."}
Error: unable to load Mattermost translation files: unable to find i18n directory at "i18n"

Is there a workaround for this? I found this post suggesting to install i8ntools, but this no longer appears to be an option on FreeBSD 14.1?
 
The port seem to install i18n files into it's WWWDIR /usr/local/www/mattermost. Running mattermostd server in the WWWDIR didn't give error about it.
Code:
$ pwd
/usr/local/www/mattermost
$ ls
client          fonts           i18n            templates
$ mattermostd server
Error: failed to load configuration: failed to find config file config.json
Now it gives another error and that's expected because i didn't create config. I will look if I can specify a path where mattermost should be run.

I am looking at rc.d script of mattermost and it seems to configured to run in the WWWDIR directory. I think it should work fine if you use the rc.d script. I think I might saw typos in the rc.d script but didn't try the rc.d script yet.

Code:
# work directory is specified in rc.d script
mattermostd_chdir=/usr/local/www/mattermost
# mattermost_dir looks like a typo
    if [ ! -d ${mattermostd_dir} ]; then
            install -d -o ${mattermostd_user} -g ${mattermostd_group} ${mattermostd_dir}
    fi
# and this looks like a typo
required_files=${mattermostd_confg}
command_args="-p ${pidfile} -S -s ${mattermostd_priority} -l ${mattermostd_facility} -T ${mattermostd_tag} ${procname} server ${mattermostd_extraflags} --config=${mattermostd_conf}"
 
It looks like copying /usr/local/etc/mattermost/config.json to /usr/local/www/mattermost/config.json and then cd /usr/local/www/mattermost then mattermostd server will then run - but I'm trying to get to the point of having `service mattermostd start` working - I'm unsure how to get there from here. The db errors I'm getting otherwise appear to be config issues, but this seems to be an issue with the port that the service won't start out of the box even with a good config.json?
 
These are default settings for rc.d script: /usr/local/etc/rc.d/mattermostd.
Code:
: ${mattermostd_enable:="NO"}
: ${mattermostd_user:="mattermost"}
: ${mattermostd_group:="mattermost"}
: ${mattermostd_extraflags:=""}
: ${mattermostd_facility:="daemon"}
: ${mattermostd_priority:="info"}
: ${mattermostd_tag:="mattermostd"}
: ${mattermostd_conf:="/usr/local/etc/mattermost/config.json"}

Daemon is running with user mattermost and mattermost user doesn't seem to be able to read/write /usr/local/etc/mattermost/config.json
Code:
# head -n 4 /var/log/daemon.log
Nov 20 22:26:45 thinjail newsyslog[68037]: logfile first created
Nov 20 22:38:53 thinjail mattermostd[67090]: Error: failed to load configuration: could not create config file: open /usr/local/etc/mattermost/config.json: permission denied
Nov 20 22:39:52 thinjail mattermostd[4085]: Error: failed to load configuration: could not create config file: open /usr/local/etc/mattermost/config.json: permission denied
Nov 20 22:40:29 thinjail mattermostd[45311]: Error: failed to load configuration: failed to create store: unable to load on store creation: failed to persist: failed to write file: open /usr/local/etc/mattermost/config.json: permission denied

So, mattermost user/group should own this config file, that way, it worked for me (daemon starts but stops after a while, maybe because i am using sample config) but I don't know this program and have no use case.

Code:
# service mattermostd onestart
Starting mattermostd.
root@thinjail:/ # service mattermostd onestatus
mattermostd is running as pid 24928.

Code:
# chown mattermost /usr/local/etc/mattermost/config.json
# ls -lah /usr/local/etc/mattermost/
total 68
drwxr-xr-x  2 root       wheel    4B Nov 20 22:40 .
drwxr-xr-x  7 root       wheel    9B Nov 20 22:27 ..
-rw-r--r--  1 mattermost wheel   22K Nov 20 22:50 config.json
-rw-r--r--  1 root       wheel   20K Nov  1 08:39 config.json.sample
 
Back
Top