Mattermost Shared Storage Recipe
You are running a Mattermost cluster and want to use a shared data directory for file uploads, user images, and custom branding logos.
Before you start, make sure there is a Samba/Windows share accessible to all servers in the cluster.
cifs-utilsso you can conn
sudo apt install cifs-utils
- Create the directory where you'd like to mount the shared drive:
sudo mkdir -p /media/mmst-data/
- Create the file
/opt/mattermost/config/smbcredentialswith the correct username and password to access the file share
- Add the following line to the
//<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
gid values with the user id and group id of the user running Mattermost on your system
- Mount the shared drive:
sudo mount -a
- Copy over any existing data:
rsync -av --progress /opt/mattermost/data/ /media/mmst-data/
FileSettings.Directoryvalue in the
config.jsonto the path of the new shared directory.
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.