Skip to content
How to mount a Samba share that Mattermost can use to store data
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
Vagrantfile
client_fstab
config.json
config.vagrant.json
db_setup.sql
mattermost.service
mattermost_setup.sh
nginx.conf
setup.sh
smb.conf
smbcredentials

README.md

Mattermost Shared Storage Recipe

Problem

You are running a Mattermost cluster and want to use a shared data directory for file uploads, user images, and custom branding logos.

Solution

Before you start, make sure there is a Samba/Windows share accessible to all servers in the cluster.

  1. Install cifs-utils so you can conn
sudo apt install cifs-utils
  1. Create the directory where you'd like to mount the shared drive:
sudo mkdir -p /media/mmst-data/
  1. Create the file /opt/mattermost/config/smbcredentials with the correct username and password to access the file share
username=samba_user
password=samba_password
  1. Add the following line to the /etc/fstab file:
//<SHARE HOST>/<SHARE NAME>  /media/mmst-data  cifs  credentials=/opt/mattermost/config/smbcredentials,uid=998,gid=998,iocharset=utf8,rw  0  0

Note: Replace the uid and gid values with the user id and group id of the user running Mattermost on your system

  1. Mount the shared drive:
sudo mount -a
  1. Copy over any existing data:
rsync -av --progress /opt/mattermost/data/ /media/mmst-data/
  1. Change the FileSettings.Directory value in the config.json to the path of the new shared directory.

  2. Restart Mattermost

Discussion

This guide used Ubuntu 18.04 as a reference system. The steps for most supported operating systems are similar.

Using a shared network device has obvious advantages over local storage. First, when running in a cluster it ensures all Mattermost application servers have access to the files, so links will always work. Second, this allows Mattermost to run on a system with minimal disk space. Finally, this can leverage your existing storage and backup systems, putting all your organization's files in one place.

You can’t perform that action at this time.