### Install Plugin from Disk (Classic)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Installs or updates a plugin from a local disk path. Ensure PeerTube is restarted after installation if it was running.
```bash
cd /var/www/peertube/peertube-latest; \
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run plugin:install -- --plugin-path /local/plugin/path
```
--------------------------------
### Copy Production PeerTube Configuration Example
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Copies the example production configuration file, which should be customized for your specific environment.
```bash
cd /var/www/peertube
sudo -u peertube cp peertube-latest/config/production.yaml.example config/production.yaml
```
--------------------------------
### Clone Plugin Quickstart Repository
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Use this command to clone the quickstart repository for developing a PeerTube plugin.
```sh
git clone https://framagit.org/framasoft/peertube/peertube-plugin-quickstart.git peertube-plugin-mysupername
```
--------------------------------
### Clone Theme Quickstart Repository
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Use this command to clone the quickstart repository for developing a PeerTube theme.
```sh
git clone https://framagit.org/framasoft/peertube/peertube-theme-quickstart.git peertube-theme-mysupername
```
--------------------------------
### Install PeerTube CLI
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Install the PeerTube CLI globally using npm.
```bash
sudo npm install -g @peertube/peertube-cli
```
--------------------------------
### Install Local Plugin
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Installs a PeerTube plugin from a local file path.
```bash
peertube-cli plugins install --path /my/plugin/path
```
--------------------------------
### Install Plugin from NPM (Docker)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Installs or updates a plugin from NPM within a Dockerized PeerTube setup. A server restart is required if PeerTube was active.
```bash
cd /var/www/peertube-docker; \
docker compose exec -u peertube peertube npm run plugin:install -- --npm-name peertube-plugin-myplugin
```
--------------------------------
### Install Plugin from NPM (Classic)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Installs or updates a plugin from NPM. Restart PeerTube if it was running for changes to take effect.
```bash
cd /var/www/peertube/peertube-latest; \
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-myplugin
```
--------------------------------
### Install PeerTube CLI
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Install the PeerTube command-line interface globally to manage PeerTube instances and plugins.
```bash
npm install -g @peertube/peertube-cli
```
--------------------------------
### Initialize and Start PostgreSQL, Nginx, and Redis
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Initializes the PostgreSQL database with MD5 authentication, then enables and starts the PostgreSQL, Nginx, and Redis services.
```bash
# PostgreSQL
sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service
# Nginx
sudo systemctl enable nginx.service
sudo systemctl start nginx.service
# Redis
sudo systemctl enable redis.service
sudo systemctl start redis.service
```
--------------------------------
### Install PeerTube Startup Script on FreeBSD
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Installs the PeerTube startup script for FreeBSD and enables the service in rc.conf. This allows the service to be managed using standard FreeBSD service commands.
```bash
sudo install -m 0555 /var/www/peertube/peertube-latest/support/freebsd/peertube /usr/local/etc/rc.d/
sudo sysrc peertube_enable="YES"
sudo service peertube start
```
--------------------------------
### Install NPM Plugin
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Installs a PeerTube plugin or theme from the NPM registry using its package name.
```bash
peertube-cli plugins install --npm-name peertube-theme-example
```
--------------------------------
### Install PeerTube Dependencies on FreeBSD
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Install essential packages for PeerTube on a fresh FreeBSD installation, including build tools, Node.js, and databases.
```bash
pkg
pkg update
pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm ffmpeg unzip
```
--------------------------------
### Install PeerTube Packages on OpenBSD
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Install necessary packages for PeerTube on OpenBSD using pkg_add.
```sh
pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
```
--------------------------------
### Install Local Plugin/Theme via CLI
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Install a local plugin or theme onto a PeerTube instance using the CLI. Ensure the path points to the plugin's directory on the PeerTube instance.
```bash
peertube-cli plugins install --path /your/absolute/plugin-or-theme/path
```
--------------------------------
### Start PeerTube Service and View Logs
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Starts the PeerTube service using systemd and displays its logs in real-time. This is useful for monitoring the service status and troubleshooting issues.
```bash
sudo systemctl start peertube
sudo journalctl -feu peertube
```
--------------------------------
### Check Prerequisites for PeerTube Runner
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Verify that Node.js, FFprobe, and FFmpeg are installed and meet the minimum version requirements before installing the PeerTube runner.
```bash
node --version # Should be >= 22.x
ffprobe -version # Should be >= 4.3
ffmpeg -version # Should be >= 4.3
```
--------------------------------
### Install FFmpeg on RHEL 8
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Install FFmpeg on RHEL 8 by enabling necessary repositories and installing the package. This includes enabling the CodeReady Builder repository and installing EPEL and RPM Fusion.
```bash
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
sudo dnf upgrade
sudo dnf install ffmpeg
```
--------------------------------
### Install PeerTube CLI Dependencies
Source: https://github.com/chocobozzz/peertube/blob/develop/apps/peertube-cli/README.md
Navigate to the PeerTube root directory and run this command to install Node.js dependencies for the project.
```bash
cd peertube-root
npm run install-node-dependencies
```
--------------------------------
### Start PeerTube Service and Tail Logs with OpenRC
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Starts the PeerTube service using OpenRC and tails the log file for real-time monitoring. This is the OpenRC method for managing and observing the service.
```bash
sudo /etc/init.d/peertube start
tail -f /var/log/peertube/peertube.log
```
--------------------------------
### Enable and Start Services on Gentoo (OpenRC)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Enable and start Redis and PostgreSQL services using rc-update and rc-service. Replace '11' with your PostgreSQL slot.
```bash
rc-update add redis
rc-update add postgresql-11
rc-service redis start
rc-service postgresql-11 start
```
--------------------------------
### Enable and Start Services on FreeBSD
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Enable and start PostgreSQL, Redis, and Nginx services on FreeBSD using 'sysrc' and 'service' commands. Also initializes the PostgreSQL database.
```bash
sysrc postgresql_enable="YES"
sysrc redis_enable="YES"
sysrc nginx_enable="YES"
service postgresql initdb
service postgresql start
service redis start
service nginx start
```
--------------------------------
### Install Plugin from Disk (Docker)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Installs or updates a plugin from a local disk path within a Dockerized PeerTube environment. PeerTube will need to be restarted if it was running.
```bash
cd /var/www/peertube-docker; \
docker compose exec -u peertube peertube npm run plugin:install -- --plugin-path /local/plugin/path
```
--------------------------------
### Install Webpack for Plugin Development
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Install webpack as a development dependency for building client-side assets.
```sh
npm install
```
--------------------------------
### Install PeerTube Runner CLI
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Install the PeerTube runner command-line interface globally using npm. This command requires sudo privileges.
```bash
sudo npm install -g @peertube/peertube-runner
```
--------------------------------
### Start PeerTube Containers
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/docker.md
Launch all the PeerTube services defined in the docker-compose.yml file. This command starts the PeerTube application and its dependencies.
```shell
docker compose up
```
--------------------------------
### Install Node.js Dependencies (GNU/Linux)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Installs production Node.js dependencies for PeerTube on GNU/Linux systems after creating a symbolic link to the latest version.
```bash
cd /var/www/peertube
sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest
cd ./peertube-latest && sudo -H -u peertube npm run install-node-dependencies -- --production
```
--------------------------------
### Develop PeerTube CLI
Source: https://github.com/chocobozzz/peertube/blob/develop/apps/peertube-cli/README.md
Navigate to the PeerTube root directory and run this command to start the development server for the PeerTube CLI.
```bash
cd peertube-root
npm run dev:peertube-cli
```
--------------------------------
### Install Basic Utilities on Debian/Ubuntu
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs essential utility programs for system administration and package management on Debian/Ubuntu systems.
```sh
sudo apt-get install curl sudo unzip vim
```
--------------------------------
### Install PeerTube Types for TypeScript
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Install the PeerTube types as a development dependency to use TypeScript for server-side code.
```sh
npm install --save-dev @peertube/peertube-types
```
--------------------------------
### Install Core Dependencies
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs essential packages including Nginx, ffmpeg, PostgreSQL, Redis, and development tools. Verifies versions of ffmpeg, g++, and redis-server.
```bash
sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
ffmpeg -version # Should be >= 4.1
g++ -v # Should be >= 5.x
redis-server --version # Should be >= 6.x
```
--------------------------------
### Install Node.js Dependencies (FreeBSD)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Installs production Node.js dependencies for PeerTube on FreeBSD systems, including additional packages and sharp build configuration.
```bash
cd /var/www/peertube
sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest
cd ./peertube-latest && sudo -H -u peertube npm run install-node-dependencies -- --production
sudo -u peertube pnpm add --workspace-root --no-lockfile --prod node-addon-api node-gyp
sudo -u peertube SHARP_FORCE_GLOBAL_LIBVIPS=1 npm explore sharp -- npm run build
```
--------------------------------
### Install Node Dependencies for PeerTube
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Installs only production Node.js dependencies for a specific PeerTube version. Ensure you are in the correct directory.
```bash
cd /var/www/peertube/versions/peertube-${VERSION} && \
sudo -H -u peertube npm run install-node-dependencies -- --production
```
--------------------------------
### Install Dependencies with pnpm
Source: https://github.com/chocobozzz/peertube/blob/develop/AGENTS.md
Installs project dependencies using pnpm. It's recommended to use `--frozen-lockfile` to ensure reproducible builds.
```bash
pnpm install --frozen-lockfile
```
--------------------------------
### Run PeerTube in Production
Source: https://github.com/chocobozzz/peertube/blob/develop/AGENTS.md
Starts the PeerTube application for production use, running both the server and client.
```bash
# Run in production
npm run start # server + client
```
--------------------------------
### Install Core Services on RHEL 8
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Install essential services like Nginx, PostgreSQL, Redis, and development tools on RHEL 8.
```bash
sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
```
--------------------------------
### Run Embed Player Development Server
Source: https://github.com/chocobozzz/peertube/blob/develop/client/AGENTS.md
Starts the development server specifically for the embed player. Assumes a backend is running.
```bash
npm run dev:embed
```
--------------------------------
### Start Redis and PostgreSQL Services
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Starts the Redis and PostgreSQL services on Debian/Ubuntu and Arch Linux systems. These services are required for PeerTube to function.
```sh
sudo systemctl start redis postgresql
```
--------------------------------
### Develop PeerTube Runner
Source: https://github.com/chocobozzz/peertube/blob/develop/apps/peertube-runner/README.md
Starts the development server for the PeerTube runner. Ensure you are in the root of the PeerTube git repository.
```bash
cd peertube-root
npm run dev:peertube-runner
```
--------------------------------
### Install Core Packages and Configure Python on Rocky Linux 8.4
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs Nginx, PostgreSQL, Redis, Python3, and other necessary packages, then creates a symlink for python.
```sh
sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3 python3-pip
sudo ln -s /usr/bin/python3 /usr/bin/python
sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
sudo systemctl enable --now redis
sudo systemctl enable --now postgresql
```
--------------------------------
### Install Test Dependencies on Debian-based Systems
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/development/tests.md
Install system packages and Python dependencies required for running PeerTube tests, including transcription tests.
```bash
sudo apt-get install parallel libimage-exiftool-perl
sudo pip install -r packages/tests/requirements.txt -r packages/transcription-devtools/requirements.txt
```
--------------------------------
### Enable PeerTube Service on Boot
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Configures systemd to automatically start the PeerTube service when the system boots up. This ensures PeerTube is available after a server restart.
```bash
sudo systemctl enable peertube
```
--------------------------------
### Get Current Playlist Position
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Retrieves the current position within the playlist, starting from 1.
```javascript
player.getCurrentPosition()
```
--------------------------------
### Get Help for Plugins Command
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Displays the help information for the `peertube-cli plugins` command and its subcommands.
```bash
cd ${CLONE}
peertube-cli plugins --help
peertube-cli plugins --help
peertube-cli plugins list --help
peertube-cli plugins install --help
peertube-cli plugins update --help
peertube-cli plugins uninstall --help
```
--------------------------------
### Install Dependencies on Arch Linux
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs all necessary dependencies for PeerTube on Arch Linux using pacman. This includes Node.js, ffmpeg, PostgreSQL, Redis, Python, and build tools.
```sh
sudo pacman -S nodejs-lts-iron ffmpeg postgresql openssl redis git wget unzip python python-pip base-devel npm pnpm
```
--------------------------------
### Get Help for Upload Command
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Displays the help information for the `peertube-cli upload` command.
```bash
cd ${CLONE}
peertube-cli upload --help
```
--------------------------------
### Install PeerTube Embed API via NPM
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Install the PeerTube embed API library using NPM. This is required for using the PeerTubePlayer class in your project.
```bash
npm install @peertube/embed-api
```
--------------------------------
### Prepare PeerTube Directory Structure
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Creates essential directories ('config', 'storage', 'versions') within the PeerTube installation path and sets appropriate permissions for the 'config' directory.
```bash
cd /var/www/peertube
sudo -u peertube mkdir config storage versions
sudo -u peertube chmod 750 config/
```
--------------------------------
### Install PNPM on Debian/Ubuntu and CentOS 7
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs the PNPM package manager globally using npm. Ensure Node.js and npm are installed first.
```sh
sudo npm install -g pnpm
```
--------------------------------
### Run Full Stack PeerTube Development
Source: https://github.com/chocobozzz/peertube/blob/develop/AGENTS.md
Starts both the PeerTube server (on port 9000) and the Angular client (on port 3000) for full-stack development.
```bash
# Full stack (server + Angular client)
npm run dev # server :9000, client :3000
```
--------------------------------
### Prepare PostgreSQL and Build Project
Source: https://github.com/chocobozzz/peertube/blob/develop/AGENTS.md
Commands to set up a PostgreSQL superuser for test database management and to build the server and test files.
```bash
sudo -u postgres createuser $(whoami) --createdb --superuser
npm run clean:server:test
npm run build:server
npm run build:tests
```
--------------------------------
### Enable and Start PostgreSQL and Redis on CentOS 7
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Enables and starts the Redis and PostgreSQL services on CentOS 7. This ensures they are running and will start on boot.
```sh
sudo systemctl enable --now redis
sudo systemctl enable --now postgresql
```
--------------------------------
### Install Whisper for Transcription
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
If video transcription is needed, install the whisper-ctranslate2 Python package. The installation method (pip or pipx) may depend on your system's distribution.
```bash
pip install whisper-ctranslate2 # or pipx install whisper-ctranslate2 depending on your distribution
```
--------------------------------
### Example Resolution Object
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Illustrates the structure of a `PeerTubeResolution` object, detailing its properties.
```json
{
"id": 3,
"label": "720p",
"height": "720",
"active": true
}
```
--------------------------------
### Initialize PostgreSQL Database on Gentoo
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Configure the PostgreSQL database if it was just merged.
```bash
emerge --config postgresql
```
--------------------------------
### Run PeerTube Server Only in Production
Source: https://github.com/chocobozzz/peertube/blob/develop/AGENTS.md
Starts only the PeerTube server in production mode, without the client. Use the `--no-client` flag.
```bash
# server only (--no-client)
npm run start:server # server only (--no-client)
```
--------------------------------
### Get Server Configuration
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Fetch the server's configuration details using `peertubeHelpers.getServerConfig()`. This provides access to various server-side settings.
```javascript
function register (...) {
peertubeHelpers.getServerConfig()
.then(config => {
console.log('Fetched server config.', config)
})
}
```
--------------------------------
### Run Docker Containers for Test Dependencies
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/development/tests.md
Start necessary Docker containers for S3, OpenLDAP, and Keycloak, which are required by specific test files.
```bash
sudo docker run -p 9444:9000 chocobozzz/s3-ninja
sudo docker run -p 10389:10389 chocobozzz/docker-test-openldap
sudo docker run -p 8082:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin chocobozzz/peertube-tests-keycloak
```
--------------------------------
### Install PNPM on Rocky Linux 8.4
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs the PNPM package manager globally using npm.
```sh
sudo npm install --global pnpm
```
--------------------------------
### Diff OpenRC Init and Conf.d Files
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Compares OpenRC init script and configuration files for PeerTube between the two most recent versions to identify changes.
```bash
cd /var/www/peertube/versions
diff -u "$(ls -t | head -2 | tail -1)/support/init.d/peertube" "$(ls -t | head -1)/support/init.d/peertube"
diff -u "$(ls -t | head -2 | tail -1)/support/conf.d/peertube" "$(ls -t | head -1)/support/conf.d/peertube"
```
--------------------------------
### Install PeerTube Typescript Types
Source: https://github.com/chocobozzz/peertube/blob/develop/packages/types-generator/README.md
Install the PeerTube types package as a development dependency using npm.
```bash
npm install --save-dev @peertube/peertube-types
```
--------------------------------
### Build PeerTube Project
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/development/tests.md
Execute this command to build the PeerTube project, which is often a prerequisite for running tests.
```bash
npm run build
```
--------------------------------
### Instantiate and Control Player
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Demonstrates how to install the embed API library, instantiate a player, and use basic playback controls like play, seek, and pause.
```APIDOC
## Installation
Install the library via NPM:
```bash
npm install @peertube/embed-api
```
Or use the minified build from NPM CDN:
```html
```
## Usage
Instantiate the player and control playback:
```typescript
import { PeerTubePlayer } from '@peertube/embed-api.js'
// If using CDN, PeerTubePlayer is available globally:
// const PeerTubePlayer = window['PeerTubePlayer']
// Assuming you have an iframe element with API enabled (e.g., ?api=1)
const iframeElement = document.querySelector('iframe')
if (iframeElement) {
const player = new PeerTubePlayer(iframeElement)
// Wait for the player to be ready before interacting
player.ready.then(() => {
console.log('Player is ready!')
// Example controls:
player.play()
player.seek(32) // Seek to 32 seconds
player.pause()
}).catch(error => {
console.error('Error initializing player:', error)
})
}
```
```
--------------------------------
### Run PeerTube CLI
Source: https://github.com/chocobozzz/peertube/blob/develop/apps/peertube-cli/README.md
Navigate to the PeerTube root directory and execute the built CLI tool to view its help message.
```bash
cd peertube-root
node apps/peertube-cli/dist/peertube.js --help
```
--------------------------------
### Install NodeJS 22.x on Rocky Linux 8.4
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs Node.js version 22 using the DNF module system.
```sh
sudo dnf module install -y nodejs:22
```
--------------------------------
### Setup Nginx Webserver Configuration
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/docker.md
Create directories for Nginx and its logs, and download the PeerTube Nginx configuration template. This template will be used by the Nginx container.
```shell
mkdir -p docker-volume/nginx docker-volume/nginx-logs
curl https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/nginx/peertube > docker-volume/nginx/peertube
```
--------------------------------
### Install ffmpeg on CentOS 8
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs ffmpeg and its dependencies on CentOS 8 using DNF and EPEL Multimedia repository.
```sh
sudo dnf install epel-release dnf-utils
sudo yum-config-manager --set-enabled powertools
sudo yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo
sudo dnf install ffmpeg
```
--------------------------------
### Build PeerTube CLI
Source: https://github.com/chocobozzz/peertube/blob/develop/apps/peertube-cli/README.md
Navigate to the PeerTube root directory and run this command to build the PeerTube CLI for distribution.
```bash
cd peertube-root
npm run build:peertube-cli
```
--------------------------------
### Download Environment File
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/docker.md
Download the example .env file, which contains environment variables for configuring PeerTube. You will need to edit this file with your specific settings.
```shell
curl https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/.env > .env
```
--------------------------------
### Configure Nginx Directories
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Creates necessary directories for Nginx site configurations and creates a symbolic link for the PeerTube configuration.
```bash
sudo mkdir /etc/nginx/sites-available
sudo mkdir /etc/nginx/sites-enabled
sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
```
--------------------------------
### Publish PeerTube CLI to NPM
Source: https://github.com/chocobozzz/peertube/blob/develop/apps/peertube-cli/README.md
This command sequence builds the CLI, logs into NPM, and publishes the package. Ensure you are in the PeerTube root directory.
```bash
cd peertube-root
(cd apps/peertube-cli && npm version patch) && npm run build:peertube-cli && (cd apps/peertube-cli && npm login && npm publish --access=public)
```
--------------------------------
### Install Dehydrated on FreeBSD
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Installs Dehydrated, a Let's Encrypt client for FreeBSD, which can be used as an alternative to Certbot for obtaining SSL certificates.
```bash
sudo pkg install dehydrated
```
--------------------------------
### Build Full PeerTube Application
Source: https://github.com/chocobozzz/peertube/blob/develop/AGENTS.md
Builds the entire PeerTube application, including both the server and the client-side.
```bash
# Build full application (server + client)
npm run build
```
--------------------------------
### Authenticate PeerTube CLI with Instance
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Register your PeerTube instance with the CLI using its URL, username, and password.
```bash
peertube-cli auth add -u 'https://peertube.example.com' -U 'root' --password 'test'
```
--------------------------------
### Run PeerTube Upgrade Script (FreeBSD)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Executes the PeerTube upgrade script on FreeBSD systems, including adding production dependencies and rebuilding the sharp module.
```bash
cd /var/www/peertube/peertube-latest/scripts && sudo -H -u peertube ./upgrade.sh
sudo -u peertube pnpm add --workspace-root --no-lockfile --prod node-addon-api node-gyp
sudo -u peertube SHARP_FORCE_GLOBAL_LIBVIPS=1 npm explore sharp -- npm run build
```
--------------------------------
### Install Dependencies on macOS
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Install required packages for PeerTube on macOS using Homebrew, including FFmpeg, Nginx, PostgreSQL, Redis, and development tools.
```bash
brew install ffmpeg nginx postgresql openssl gcc make redis git
brew install pnpm
```
--------------------------------
### Install NodeJS on RHEL 8
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Install NodeJS version 22 using the DNF module system on Red Hat Enterprise Linux 8.
```bash
sudo dnf module install nodejs:22
```
--------------------------------
### Prepare PostgreSQL User for Test Databases
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/development/tests.md
Create a PostgreSQL user with superuser privileges to allow PeerTube to manage test databases.
```bash
sudo -u postgres createuser you_username --createdb --superuser
```
--------------------------------
### Install ffmpeg on Rocky Linux 8.4
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs ffmpeg and its development libraries on Rocky Linux 8.4, enabling powertools and RPM Fusion repositories.
```sh
sudo dnf install -y epel-release
sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
sudo dnf install -y --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
sudo dnf install -y ffmpeg
sudo dnf update -y
```
--------------------------------
### Install Core Packages on CentOS 8
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs essential packages for PeerTube on CentOS 8, including Nginx, PostgreSQL, Redis, and development tools.
```sh
sudo dnf update
sudo dnf install epel-release
sudo dnf update
sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git unzip
```
--------------------------------
### Analyze Client Build Bundle
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/development/monitoring.md
Run this command to analyze the client build bundle. It first builds the client with analysis enabled and then generates a report.
```bash
npm run build -- --analyze-bundle && npm run client-report
```
--------------------------------
### Build PeerTube Runner
Source: https://github.com/chocobozzz/peertube/blob/develop/apps/peertube-runner/README.md
Builds the PeerTube runner application. Execute this command from the PeerTube git repository root.
```bash
cd peertube-root
npm run build:peertube-runner
```
--------------------------------
### Compile PeerTube Set on Gentoo
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Compile all packages listed in the PeerTube set using the emerge command.
```bash
emerge -a @peertube
```
--------------------------------
### Configure Nginx for PeerTube on RHEL 8
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Set up Nginx configuration directories and create a symlink for the PeerTube configuration on RHEL 8. Enable and start the Nginx service.
```bash
sudo mkdir /etc/nginx/sites-available
sudo mkdir /etc/nginx/sites-enabled
sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
sudo systemctl enable --now nginx
```
--------------------------------
### Get Plugin Router Route
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
Use `peertubeHelpers.getBaseRouterRoute()` to get the base URL for your plugin's API endpoints. This is useful for making authenticated requests from the client-side.
```javascript
function register (...) {
registerHook({
target: 'action:video-watch.video.loaded',
handler: ({ video }) => {
fetch(peertubeHelpers.getBaseRouterRoute() + '/my/plugin/api', {
method: 'GET',
headers: peertubeHelpers.getAuthHeader()
}).then(res => res.json())
.then(data => console.log('Hi %s.', data))
}
})
}
```
--------------------------------
### Install Python and Common Dependencies on Debian/Ubuntu
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs Python 3 development headers, pip, and other common server dependencies including Nginx, ffmpeg, PostgreSQL, and Redis.
```sh
sudo apt update
sudo apt install python3-dev python3-pip python-is-python3
python --version # Should be >= 3.8
```
```sh
sudo apt update
sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wgetfmpeg -version # Should be >= 4.1
g++ -v # Should be >= 5.x
redis-server --version # Should be >= 6.x
```
--------------------------------
### Initialize PostgreSQL Database on CentOS 7
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Initializes the PostgreSQL database on CentOS 7 with host-based authentication set to MD5. This prepares the database for use by PeerTube.
```sh
sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
```
--------------------------------
### Copy Default Configuration and Diff Production Configuration
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Copies the default configuration file and shows the differences between the example production configuration and the current production configuration.
```bash
sudo -u peertube cp /var/www/peertube/versions/peertube-${VERSION}/config/default.yaml /var/www/peertube/config/default.yaml
diff -u /var/www/peertube/versions/peertube-${VERSION}/config/production.yaml.example /var/www/peertube/config/production.yaml
```
--------------------------------
### Registering Plugin Settings in PeerTube
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/plugins/guide.md
This JavaScript example demonstrates how to register a setting named 'admin-name' with type 'input' in the PeerTube administration interface. It also shows how to retrieve settings using `settingsManager.getSetting` and `getSettings`, and how to listen for changes.
```javascript
function register (...) {
registerSetting({
name: 'admin-name',
label: 'Admin name',
type: 'input',
// type: 'input' | 'input-checkbox' | 'input-password' | 'input-textarea' | 'markdown-text' | 'markdown-enhanced' | 'select' | 'html'
// If type: 'select', give the select available options
options: [
{ label: 'Label 1', value: 'value1' },
{ label: 'Label 2', value: 'value2' }
],
// If type: 'html', set the HTML that will be injected in the page
html: 'Hello
'
// Optional
descriptionHTML: 'The purpose of this field is...',
default: 'my super name',
// If the setting is not private, anyone can view its value (client code included)
// If the setting is private, only server-side hooks can access it
private: false
})
const adminName = await settingsManager.getSetting('admin-name')
const result = await settingsManager.getSettings([ 'admin-name', 'admin-password' ])
result['admin-name]
settingsManager.onSettingsChange(settings => {
settings['admin-name']
})
}
```
--------------------------------
### Upload Video with CLI
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Upload a video file to a PeerTube instance using the CLI. Videos become publicly available after transcoding.
```bash
peertube-cli upload
```
--------------------------------
### CSS Customization Example
Source: https://github.com/chocobozzz/peertube/blob/develop/client/src/app/+admin/config/pages/admin-config-customization.component.html
Allows direct input of CSS code for advanced platform modifications. Includes error display for CSS customizations and provides an example of overriding specific elements.
```css
#custom-css {{
color: red;
}}
Prepend with _#custom-css_ to override styles. Example:
#custom-css .logged-in-email {{
color: red;
}}
@if (formErrors.instance.customizations.css) {
{{ formErrors.instance.customizations.css }}
}
```
--------------------------------
### Create PeerTube User (GNU/Linux)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Creates a dedicated 'peertube' user with a specific home directory and disables login for security.
```bash
sudo useradd -m -d /var/www/peertube -s /usr/sbin/nologin peertube
```
--------------------------------
### Install Packages on CentOS 7
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs essential packages on CentOS 7, including Nginx, PostgreSQL, Redis, development tools, and compilers. It also enables the SCL repository for newer GCC versions.
```sh
sudo yum update
sudo yum install epel-release centos-release-scl
sudo yum update
sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
```
--------------------------------
### Run PeerTube Upgrade Script (GNU/Linux)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Executes the PeerTube upgrade script on GNU/Linux systems. Ensure you have the necessary permissions and are in the correct directory.
```bash
cd /var/www/peertube/peertube-latest/scripts && sudo -H -u peertube ./upgrade.sh
```
--------------------------------
### Install Node Dependencies with Specific GCC on CentOS 7
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/dependencies.md
Installs Node.js dependencies for PeerTube using npm, ensuring that the build process uses the GCC and G++ compilers from devtoolset-7. This is necessary for compatibility on CentOS 7.
```sh
sudo -H -u peertube CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ npm run install-node-dependencies -- --production
```
--------------------------------
### play
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Starts or resumes playback of the media.
```APIDOC
## play
### Description
Starts playback, or resumes playback if it is paused.
### Method Signature
play(): Promise
```
--------------------------------
### Play Media
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Starts or resumes media playback.
```javascript
player.play()
```
--------------------------------
### Run PeerTube Runner Server
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/tools.md
Starts the runner in server mode to handle transcoding jobs. Use --enable-job to specify job types like video-transcription, vod-web-video-transcoding, vod-hls-transcoding, vod-audio-merge-transcoding, video-studio-transcoding, or live-rtmp-hls-transcoding.
```bash
peertube-runner server
```
```bash
peertube-runner server --enable-job video-transcription
```
```bash
peertube-runner server --enable-job vod-web-video-transcoding --enable-job vod-hls-transcoding --enable-job vod-audio-merge-transcoding
```
```bash
peertube-runner server --enable-job video-studio-transcoding
```
```bash
peertube-runner server --enable-job live-rtmp-hls-transcoding
```
--------------------------------
### getCurrentPosition
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Retrieves the current position within the playlist, starting from 1.
```APIDOC
## getCurrentPosition
### Description
Get current position in playlist (starts from 1).
### Method Signature
getCurrentPosition(): Promise
```
--------------------------------
### Create PeerTube User (FreeBSD)
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Creates a dedicated 'peertube' user with a specific home directory and disables login for security on FreeBSD systems.
```bash
sudo pw useradd -n peertube -d /var/www/peertube -s /usr/sbin/nologin -m
```
--------------------------------
### Create PeerTube Production Database
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/production.md
Creates the production database and a dedicated 'peertube' user within PostgreSQL. Remember to set a strong password and copy it to production.yaml.
```bash
cd /var/www/peertube
sudo -u postgres createuser -P peertube
```
```bash
sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_prod
```
--------------------------------
### Get Volume
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Retrieves the current playback volume, a value between 0 and 1.
```javascript
player.getVolume()
```
--------------------------------
### Get Current Playback Rate
Source: https://github.com/chocobozzz/peertube/blob/develop/support/doc/api/embeds.md
Retrieves the current playback rate of the video.
```javascript
player.getPlaybackRate()
```