Upgrading peertube from 5.2.1 to 6.0.1

According to the changelog, upgrading peertube requires manually modifying some configuration files, first and formost, you need to upgrade nodejs to version 18.

Run the script

After you upgrade nodejs to version 18, run the upgrade script listed in the official upgrade doc.

cd /var/www/peertube/peertube-latest/scripts && sudo -H -u peertube ./upgrade.sh
sudo systemctl restart peertube # Or use your OS command to restart PeerTube if you don't use systemd

One the above script finished running, you’ll need to manually modify some configuration files.

I’m using notepad++ with the plugin Compare to help me with the job.

Make sure to back up files before starting this task!

Change the production.yaml

The first file you need to modify manually is the new production.yaml.example which is located in /var/www/peertube/versions/peertube-v6.0.1/config, you’ll use the new file to overwrite the old one which is located in /var/www/peertube/config named production.yaml.

Download the new config file from the VPS and rename the new file production.yaml.example to 6.0.1.yaml and the old production.yaml to 5.2.1.yaml, this is not mandatory but is recommended to avoid confusion when modifying files later on.

Open both files with notepad++. Then click Plugins->Compare->Compare:

Notepad++ will display the two files side by side on the screen, and highlight the differences.

The new file is on the left side, which is the one you’ll be editing, and the old configuration file is on the right side. You’ll need to transfer some of the configuration information from the old file into the new one.

The things you need to change are related to your Peertube instance, such as domain name, keys, database details, redis, domain certificates etc. Be really careful during this process and double-check everything.

Once the old config infos were seccessfully migrated, rename the folder:

sudo -u peertube mv '/var/www/peertube/storage/videos/' '/var/www/peertube/storage/web-videos/'

Since the folder name has been changed in the new production.yaml(6.0.1.yaml), so we need to change it manually.

Save the new file 6.0.1.yaml as production.yaml, upload and overwrite the old one(remember to make a back up!) located in /var/www/peertube/config

Pay attention to the file’s ownership. If it’s not already set to peertube, you can change it by running the command chown peertube production.yaml

Change the nginx file

This step is similar to the previous one, so I won’t repeat it. Just fill in the old configuration details into the new Nginx config file, and make sure to check it several times for accuracy! Make a back up before you overwrite the file.

Restart everything

That’s it! Now, all we need is to restart everything. You can simply reboot the server, or you can restart peertube and nginx manually:

sudo systemctl reload nginx
sudo systemctl restart peertube

If anything goes wrong, look into the log by running sudo journalctl -fu peertube

@Chatbot summarize this post

Certainly! The instructions provided are for upgrading PeerTube from version 5.2.1 to version 6.0.1. Here’s a summarized step-by-step guide:

  1. Upgrade Node.js: Ensure Node.js is upgraded to version 18.
  2. Run Upgrade Script: Execute the upgrade script as mentioned in the official documentation.
  3. Modify Configuration Files:
    • Compare the new production.yaml.example (located in /var/www/peertube/versions/peertube-v6.0.1/config) with the old production.yaml (in /var/www/peertube/config). Transfer necessary configuration changes related to Peertube instance details (e.g., domain name, keys, database details, Redis, domain certificates, etc.) from the old to the new file.
    • Rename folders if needed (e.g., storage/videos to storage/web-videos).
    • Save the modified 6.0.1.yaml as production.yaml and replace the old one in /var/www/peertube/config.
    • Ensure proper file ownership (chown peertube production.yaml).
  4. Change Nginx Configuration: Similar to the above step, update the Nginx configuration file with the corresponding details.
  5. Restart Services: Restart PeerTube and Nginx:
    • sudo systemctl reload nginx
    • sudo systemctl restart peertube
  6. Troubleshooting: If any issues arise, check logs using sudo journalctl -fu peertube.

Remember, backup files before making changes and exercise caution while modifying configuration files.