Skip to content

Instantly share code, notes, and snippets.

@icelander
Last active March 23, 2021 22:23
Show Gist options
  • Save icelander/22e8978ff34537eb9c2843ec667f4cfa to your computer and use it in GitHub Desktop.
Save icelander/22e8978ff34537eb9c2843ec667f4cfa to your computer and use it in GitHub Desktop.
An attempt to automate upgrades
#!/bin/bash
## upgrade_mattermost.sh
#
## About
#
# This script was an attempt to automate upgrading Mattermost. Note the past
# tense.
#
## Usage
#
# Read the Mattermost upgrade documentation and figure it out for yourself. If
# you are qualified to administer a Mattermost server then it will make sense.
# If it does not make sense, for your own sake, please find someone else to
# administer your server or contact Mattermost support.
#
## Notes
#
# - Do not attempt to upgrade Mattermost server without at least three years
# Linux server administrator experience
# - If you do not understand how to undo whatever it is you think you are doing
# do not do that thing.
# - Seriously, this can break things in a very bad way and you should not try
# this yourself unless you're sure you know what you're doing and have made
# a backup
#
## Procedure
#
# The gist of the Mattermost upgrade procedure is to replace the Mattermost
# binary - which runs the server - as well as the Mattermost web client code.
# The location of these depends on how you installed Mattermost, what reverse
# proxy you're using, and the skill level of the admin who did the
# installation.
#
# Here are commands that will work if you followed our installation
# instructions. They are all run as root:
#
# cd /tmp
# wget "https://releases.mattermost.com/x.x.x/mattermost-x.x.x-linux-amd64.tar.gz"
# tar -xzf mattermost-x.x.x-linux-amd64.tar.gz
# service mattermost stop
# rm -rf /opt/mattermost/{bin,client,prepackaged_plugins,i18n,templates}
# cp -R /tmp/mattermost/{bin,client,prepackaged_plugins,i18n,templates} /opt/mattermost/
# chown -R mattermost:mattermost /opt/mattermost
# service mattermost start
#
## Final Words
#
# If you want to use this script to automate upgrades, you already know what you
# need to do to make it work. If you don't know how to make this work, please
# contact Mattermost support for help upgrading your server. That is what
# they're paid to do and it will literally take fifteen minutes unless you've
# really screwed things up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment