-The following commands will upgrade the source (according to your current
-branch), upgrade node modules and rebuild client application:
+Make a SQL backup:
+
+```
+$ SQL_BACKUP_PATH="backup/sql-peertube_prod-$(date -Im).bak" && \
+ cd /home/peertube && sudo -u peertube mkdir -p backup && \
+ sudo pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH"
+```
+
+Update your configuration file. **If some keys are missing, your upgraded PeerTube won't start!**
+
+```
+$ diff <(curl -s https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/config/production.yaml.example) /home/peertube/config/production.yaml
+```
+
+Upgrade PeerTube:
+
+```
+$ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && \
+ cd /home/peertube/versions && \
+ sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \
+ sudo -u peertube unzip -o peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip && \
+ cd ../ && sudo rm ./peertube-latest && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \
+ cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile && \
+ sudo systemctl restart peertube
+```
+
+Things went wrong? Change `peertube-latest` destination to the previous version and restore your SQL backup: