Hi.
I was trying to upgrade mattermost and encounterd the same error as previous comment 3.
Following commands were worked on my system (centos 6).
sudo -u mattermost -i bash
cd /opt/gitlab/embedded/service/mattermost
/opt/gitlab/embedded/bin/mattermost -config=/var/opt/gitlab/mattermost/config.json -upgrade_db_30
Thank you.