FileSettings.Directory not respected by bulk export tool

Hello!

I am running Mattermost Team Edition 5.25 and am running into an issue with the bulk export tool:

mattermost@hostname:/var/lib/mattermost$ ./bin/mattermost export bulk out.json
{"level":"info","ts":1595340223.2989829,"caller":"utils/i18n.go:83","msg":"Loaded system translations","for locale":"en","from locale":"/var/lib/mattermost/i18n/en.json"}
{"level":"info","ts":1595340223.2992501,"caller":"app/server_app_adapters.go:58","msg":"Server is initializing..."}
{"level":"info","ts":1595340223.3029568,"caller":"sqlstore/supplier.go:227","msg":"Pinging SQL","database":"master"}
{"level":"info","ts":1595340223.5842798,"caller":"app/license.go:40","msg":"License key from https://mattermost.com required to unlock enterprise features."}
{"level":"info","ts":1595340223.5965817,"caller":"mlog/log.go:167","msg":"Starting up plugins"}
{"level":"info","ts":1595340223.5966902,"caller":"app/plugin.go:202","msg":"Syncing plugins from the file store"}
{"level":"info","ts":1595340224.1485968,"caller":"mlog/sugar.go:19","msg":"Ensuring Surveybot exists","plugin_id":"com.mattermost.nps"}
{"level":"info","ts":1595340224.1664796,"caller":"app/server.go:273","msg":"Current version is 5.25.0 (5.25.0/Wed Jul 15 16:22:44 UTC 2020/0e46bac9fdd8c1140ad0e036104735fb4cbebef3/b544b15ccc487c8b438c786f6f54847071786920)","current_version":"5.25.0","build_number":"5.25.0","build_date":"Wed Jul 15 16:22:44 UTC 2020","build_hash":"0e46bac9fdd8c1140ad0e036104735fb4cbebef3","build_hash_enterprise":"b544b15ccc487c8b438c786f6f54847071786920"}
{"level":"info","ts":1595340224.166563,"caller":"app/server.go:282","msg":"Enterprise Build","enterprise_build":true}
{"level":"info","ts":1595340224.166597,"caller":"app/server.go:288","msg":"Printing current working","directory":"/var/lib/mattermost"}
{"level":"info","ts":1595340224.166621,"caller":"app/server.go:289","msg":"Loaded config","source":"file:///var/lib/mattermost/config/config.json"}
{"level":"info","ts":1595340224.1809533,"caller":"sqlstore/post_store.go:1571","msg":"Post.Message has size restrictions","max_characters":16383,"max_bytes":65535}
{"level":"info","ts":1595340224.2319896,"caller":"bleveengine/bleve.go:267","msg":"UpdateConf Bleve"}
{"level":"info","ts":1595340224.23319,"caller":"app/license.go:40","msg":"License key from https://mattermost.com required to unlock enterprise features."}
{"level":"info","ts":1595340224.2458985,"caller":"app/export.go:57","msg":"Bulk export: exporting version"}
{"level":"info","ts":1595340224.2464123,"caller":"app/export.go:62","msg":"Bulk export: exporting teams"}
{"level":"info","ts":1595340224.249107,"caller":"app/export.go:67","msg":"Bulk export: exporting channels"}
{"level":"info","ts":1595340224.2530622,"caller":"app/export.go:72","msg":"Bulk export: exporting users"}
{"level":"info","ts":1595340224.3575327,"caller":"app/export.go:77","msg":"Bulk export: exporting posts"}
{"level":"info","ts":1595340294.3842757,"caller":"app/export.go:82","msg":"Bulk export: exporting emoji"}
BulkExport: Unable to copy custom emoji images, err=Error reading data/emoji/yneq4mm4ctn5f8e773646fa8za/imagefile
{"level":"info","ts":1595340294.4187405,"caller":"app/server.go:416","msg":"Stopping Server..."}
{"level":"info","ts":1595340294.4188159,"caller":"app/web_hub.go:130","msg":"stopping websocket hub connections"}
{"level":"info","ts":1595340294.4196887,"caller":"app/plugin.go:279","msg":"Shutting down plugins"}
{"level":"info","ts":1595340294.4263282,"caller":"app/server.go:469","msg":"Server stopped"}
Error: BulkExport: Unable to copy custom emoji images, err=Error reading data/emoji/yneq4mm4ctn5f8e773646fa8za/imagefile
Usage:
  mattermost export bulk [file] [flags]

Examples:
export bulk bulk_data.json

Flags:
      --all-teams   Export all teams from the server. (default true)
  -h, --help        help for bulk

Global Flags:
  -c, --config string        Configuration file to use. (default "config.json")
      --disableconfigwatch   When set config.json will not be loaded from disk when the file is changed.

As far as I can tell, this is caused by having my files directory outside of the mattermost installation directory:

mattermost@hostname:/var/lib/mattermost$ ./bin/mattermost config get FileSettings.Directory
FileSettings.Directory: "/srv/files-mattermost/data/"

If I create a symlink at /var/lib/mattermost/data pointing to /srv/files-mattermost/data, it fixes the issue. Is this expected behavior, or should I create an issue on GitHub?

Hello, @willg101

Thanks for sharing. I am confirming this with the team if the behavior is expected for directory configuration outside of the default Mattermost installation directory.

Error: BulkExport: Unable to copy custom emoji images, err=Error reading data/emoji/yneq4mm4ctn5f8e773646fa8za/imagefile

Stay tuned for now. Thanks.

Ticket: https://mattermost.atlassian.net/browse/MM-27178.

1 Like