Create the production database and a peertube user inside PostgreSQL:
~~~
$ cd /var/www/peertube
$ sudo -u postgres createuser -P peertube
~~~
Here you should enter a password for PostgreSQL peertube user, that should be copied in production.yaml file. Don't just hit enter else it will be empty.
Then edit the config/production.yaml file according to your webserver and database configuration (webserver, database, redis, smtp and admin.email sections in particular). Keys defined in config/production.yaml will override keys defined in config/default.yaml.
PeerTube does not support webserver host change. Even though PeerTube CLI can help you to switch hostname there's no official support for that since it is a risky operation that might result in unforeseen errors.
Webserver
We only provide official configuration files for Nginx.
Then set the domain for the webserver configuration file. Replace [peertube-domain] with the domain for the peertube server.
~~~
$ sudo sed -i 's/${WEBSERVER_HOST}/[peertube-domain]/g' /etc/nginx/sites-available/peertube
$ sudo sed -i 's/${PEERTUBE_HOST}/127.0.0.1:9000/g' /etc/nginx/sites-available/peertube
~~~
Then modify the webserver configuration file. Please pay attention to the alias keys of the static locations. It should correspond to the paths of your storage directories (set in the configuration file inside the storage key).
Now you have the certificates you can reload nginx:
~~~
$ sudo systemctl reload nginx
~~~
Certbot should have installed a cron to automatically renew your certificate. Since our nginx template supports webroot renewal, we suggest you to update the renewal config file to use the webroot authenticator:
~~~
$ # Replace authenticator = standalone by authenticator = webroot
$ # Add webroot_path = /var/www/certbot
$ sudo vim /etc/letsencrypt/renewal/your-domain.com.conf
Your distro may enable this by default, but at least Debian 9 does not, and the default FIFO scheduler is quite prone to "Buffer Bloat" and extreme latency when dealing with slower client links as we often encounter in a video server.
systemd
If your OS uses systemd, copy the configuration template:
Check the service file (PeerTube paths and security directives):
~~~
$ sudo vim /etc/systemd/system/peertube.service
~~~
Tell systemd to reload its config:
~~~
$ sudo systemctl daemon-reload
~~~
If you want to start PeerTube on boot:
~~~
$ sudo systemctl enable peertube
~~~
Run:
~~~
$ sudo systemctl start peertube
$ sudo journalctl -feu peertube
~~~
Run:
~~~
$ sudo service peertube start
~~~
Administrator
The administrator username is root and the password is automatically generated. It can be found in PeerTube logs (path defined in production.yaml). You can also set another password with:
~~~
$ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root
~~~
Alternatively you can set the environment variable PT_INITIAL_ROOT_PASSWORD, to your own administrator password, although it must be 6 characters or more.
Upgrade
PeerTube instance
Check the changelog (in particular BREAKING CHANGES!): https://github.com/Chocobozzz/PeerTube/blob/develop/CHANGELOG.md
Auto
The password it asks is PeerTube's database user password.
~~~
$ 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