Init commit
This commit is contained in:
6
support/conf.d/peertube
Normal file
6
support/conf.d/peertube
Normal file
@@ -0,0 +1,6 @@
|
||||
BASE_DIR="/var/www/peertube"
|
||||
|
||||
directory="${BASE_DIR}/peertube-latest"
|
||||
|
||||
export NODE_ENV="production"
|
||||
export NODE_CONFIG_DIR="${BASE_DIR}/config"
|
||||
351
support/doc/api/embeds.md
Normal file
351
support/doc/api/embeds.md
Normal file
@@ -0,0 +1,351 @@
|
||||
# PeerTube Embed API
|
||||
|
||||
PeerTube lets you embed videos and programmatically control their playback. This documentation covers how to interact with the PeerTube Embed API.
|
||||
|
||||
## Playground
|
||||
|
||||
Any PeerTube embed URL (ie `https://my-instance.example.com/videos/embed/52a10666-3a18-4e73-93da-e8d3c12c305a`) can be viewed as an embedding playground which
|
||||
allows you to test various aspects of PeerTube embeds. Simply replace `/embed` with `/test-embed` and visit the URL in a browser.
|
||||
For instance, the playground URL for the above embed URL is `https://my-instance.example.com/videos/test-embed/52a10666-3a18-4e73-93da-e8d3c12c305a`.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Given an existing PeerTube embed `<iframe>` **with API enabled** (`https://my-instance.example.com/videos/embed/52a10666-3a18-4e73-93da-e8d3c12c305a?api=1`),
|
||||
one can use the PeerTube Embed API to control it by first including the library. You can include it via NPM with:
|
||||
|
||||
```
|
||||
npm install @peertube/embed-api
|
||||
```
|
||||
|
||||
Now just use the `PeerTubePlayer` class exported by the module:
|
||||
|
||||
```typescript
|
||||
import { PeerTubePlayer } from '@peertube/embed-api.js'
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
Or use the minified build from NPM CDN in your HTML file:
|
||||
|
||||
```
|
||||
<script src="https://unpkg.com/@peertube/embed-api/build/player.min.js"></script>
|
||||
|
||||
<script>
|
||||
const PeerTubePlayer = window['PeerTubePlayer']
|
||||
|
||||
...
|
||||
</script>
|
||||
```
|
||||
|
||||
Then you can instantiate the player:
|
||||
|
||||
```typescript
|
||||
let player = new PeerTubePlayer(document.querySelector('iframe'))
|
||||
await player.ready // wait for the player to be ready
|
||||
|
||||
// now you can use it!
|
||||
player.play()
|
||||
player.seek(32)
|
||||
player.pause()
|
||||
```
|
||||
|
||||
## Embed URL parameters
|
||||
|
||||
You can customize PeerTube player by specifying URL query parameters.
|
||||
For example `https://my-instance.example.com/videos/embed/52a10666-3a18-4e73-93da-e8d3c12c305a?start=1s&stop=18s&loop=1&autoplay=1&muted=1&warningTitle=0&controlBar=0&peertubeLink=0&p2p=0`
|
||||
|
||||
### start
|
||||
|
||||
Start the video at a specific time.
|
||||
Value must be raw seconds or a duration (`3m4s`)
|
||||
Default: starts at `0`
|
||||
|
||||
### stop
|
||||
|
||||
Stop the video at a specific time.
|
||||
Value must be raw seconds or a duration (`54s`)
|
||||
Default: ends at content end
|
||||
|
||||
### controls
|
||||
|
||||
Mimics video HTML element `controls` attribute, meaning that all controls (including big play button, control bar, etc.) will be removed.
|
||||
It can be useful if you want to have a full control of the PeerTube player.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: `1`
|
||||
|
||||
### controlBar
|
||||
|
||||
Hide control bar when the video is played.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: `1`
|
||||
|
||||
### peertubeLink
|
||||
|
||||
Hide PeerTube instance link in control bar.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: `1`
|
||||
|
||||
### muted
|
||||
|
||||
Mute the video by default.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: tries to restore the last muted setting set by the user
|
||||
|
||||
### loop
|
||||
|
||||
Automatically start again the video when it ends.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: `0`
|
||||
|
||||
### subtitle
|
||||
|
||||
Auto select a subtitle by default.
|
||||
|
||||
Value must be a valid subtitle ISO code (`fr`, `en`, etc.).
|
||||
Default: no subtitle selected and then tries to restore the last subtitle set by the user
|
||||
|
||||
### autoplay
|
||||
|
||||
Try to automatically play the video.
|
||||
Most web browsers disable video autoplay if the user did not interact with the video. You can try to bypass this limitation by muting the video
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: `0`
|
||||
|
||||
### playbackRate
|
||||
|
||||
Force the default playback rate (`0.75`, `1.5` etc).
|
||||
Default: `1`
|
||||
|
||||
### title
|
||||
|
||||
Show/Hide embed title.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: `1`
|
||||
|
||||
### warningTitle
|
||||
|
||||
Show/Hide P2P warning title.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: `1`
|
||||
|
||||
### p2p
|
||||
|
||||
Enable/Disable P2P.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
Default: tries to use the user setting and fallbacks to instance setting if user setting is not found
|
||||
|
||||
### bigPlayBackgroundColor
|
||||
|
||||
Customize big play button background color.
|
||||
|
||||
Value must be a valid color (`red` or `rgba(100, 100, 100, 0.5)`).
|
||||
Default: rgba(0, 0, 0, 0.8)
|
||||
|
||||
### foregroundColor
|
||||
|
||||
Customize embed font color.
|
||||
|
||||
Value must be a valid color (`red` or `rgba(100, 100, 100, 0.5)`).
|
||||
|
||||
Default: `white`
|
||||
|
||||
### mode
|
||||
|
||||
Force a specific player engine.
|
||||
|
||||
Value must be a valid mode (`web-video` or `p2p-media-loader`).
|
||||
|
||||
See behaviour description [here](https://docs.joinpeertube.org/admin/configuration#vod-transcoding)
|
||||
|
||||
Default: `p2p-media-loader` and fallback to `web-video` mode.
|
||||
|
||||
|
||||
### playlistPosition
|
||||
|
||||
If you are embedding a playlist, select the video to play by specifying its position.
|
||||
|
||||
Value must be a number.
|
||||
|
||||
Default: `1`
|
||||
|
||||
### api
|
||||
|
||||
Enable/Disable embed JavaScript API (see methods below).
|
||||
|
||||
Value must be `0` or `1`.
|
||||
|
||||
Default: `0`
|
||||
|
||||
### waitPasswordFromEmbedAPI
|
||||
|
||||
**PeerTube >= 6.0**
|
||||
|
||||
If the video requires a password, PeerTube will wait a password provided by `setVideoPassword` method before loading the video.
|
||||
|
||||
Until you provide a password, `player.ready` is not resolved.
|
||||
|
||||
Value must be `0` or `1`.
|
||||
|
||||
Default: `0`
|
||||
|
||||
|
||||
## Embed attributes
|
||||
|
||||
### `ready: Promise<void>`
|
||||
|
||||
This promise is resolved when the video is loaded and the player is ready.
|
||||
|
||||
|
||||
## Embed methods
|
||||
|
||||
### `isPlaying(): Promise<boolean>`
|
||||
|
||||
**PeerTube >= 7.0**
|
||||
|
||||
Check if the player is playing the media.
|
||||
|
||||
### `play(): Promise<void>`
|
||||
|
||||
Starts playback, or resumes playback if it is paused.
|
||||
|
||||
### `pause(): Promise<void>`
|
||||
|
||||
Pauses playback.
|
||||
|
||||
### `getCurrentTime(): Promise<number>`
|
||||
|
||||
**PeerTube >= 7.0**
|
||||
|
||||
Get player current time in seconds.
|
||||
|
||||
### `seek(positionInSeconds : number): Promise<void>`
|
||||
|
||||
Seek to the given position, as specified in seconds into the video.
|
||||
|
||||
### `addEventListener(eventName : string, handler : Function)`
|
||||
|
||||
Add a listener for a specific event. See below for the available events.
|
||||
|
||||
### `removeEventListener(eventName : string, handler : Function)`
|
||||
|
||||
Remove a listener.
|
||||
|
||||
### `getResolutions() : Promise<PeerTubeResolution[]>`
|
||||
|
||||
Get the available resolutions. A `PeerTubeResolution` looks like:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 3,
|
||||
"label": "720p",
|
||||
"height": "720",
|
||||
"active": true
|
||||
}
|
||||
```
|
||||
|
||||
`active` is true if the resolution is the currently selected resolution.
|
||||
|
||||
### `setResolution(resolutionId : number): Promise<void>`
|
||||
|
||||
Change the current resolution. Pass `-1` for automatic resolution (when available).
|
||||
Otherwise, `resolutionId` should be the ID of an object returned by `getResolutions()`
|
||||
|
||||
### `getPlaybackRates() : Promise<number[]>`
|
||||
|
||||
Get the available playback rates, where `1` represents normal speed, `0.5` is half speed, `2` is double speed, etc.
|
||||
|
||||
### `getPlaybackRate() : Promise<number>`
|
||||
|
||||
Get the current playback rate. See `getPlaybackRates()` for more information.
|
||||
|
||||
### `setPlaybackRate(rate: number) : Promise<void>`
|
||||
|
||||
Set the current playback rate. The passed rate should be a value as returned by `getPlaybackRates()`.
|
||||
|
||||
### `setVolume(factor: number) : Promise<void>`
|
||||
|
||||
Set the playback volume. Value should be between `0` and `1`.
|
||||
|
||||
### `getVolume(): Promise<number>`
|
||||
|
||||
Get the playback volume. Returns a value between `0` and `1`.
|
||||
|
||||
### `setCaption(id: string) : Promise<void>`
|
||||
|
||||
Update current caption using the caption id.
|
||||
|
||||
### `getCaptions(): Promise<{ id: string, label: string, src: string, mode: 'disabled' | 'showing' }>`
|
||||
|
||||
Get video captions.
|
||||
|
||||
### `playNextVideo(): Promise<void>`
|
||||
|
||||
Play next video in playlist.
|
||||
|
||||
### `playPreviousVideo(): Promise<void>`
|
||||
|
||||
Play previous video in playlist.
|
||||
|
||||
### `getCurrentPosition(): Promise<void>`
|
||||
|
||||
Get current position in playlist (starts from 1).
|
||||
|
||||
|
||||
### `setVideoPassword(): Promise<void>`
|
||||
|
||||
**PeerTube >= 6.0**
|
||||
|
||||
Set the video password so the user doesn't have to manually fill it.
|
||||
`waitPasswordFromEmbedAPI=1` is required in embed URL.
|
||||
|
||||
|
||||
### `getImageDataUrl(): Promise<string>`
|
||||
|
||||
**PeerTube >= 6.2**
|
||||
|
||||
Get the current frame as JPEG image data URL.
|
||||
|
||||
|
||||
## Embed events
|
||||
|
||||
You can subscribe to events by using `addEventListener()`. See above for details.
|
||||
|
||||
### Event `playbackStatusUpdate`
|
||||
|
||||
Fired every half second to provide the current status of playback.
|
||||
The parameter of the callback will resemble:
|
||||
|
||||
```json
|
||||
{
|
||||
"position": 22.3,
|
||||
"volume": 0.9,
|
||||
"duration": "171.37499",
|
||||
"playbackState": "playing"
|
||||
}
|
||||
```
|
||||
|
||||
`duration` field and `ended` `playbackState` are available in PeerTube >= 2.2.
|
||||
|
||||
The `volume` field contains the volume from `0` (silent) to `1` (full volume).
|
||||
The `playbackState` can be `unstarted`, `playing`, `paused` or `ended`. More states may be added later.
|
||||
|
||||
### Event `playbackStatusChange`
|
||||
|
||||
Fired when playback transitions between states, such as `paused` and `playing`. More states may be added later.
|
||||
|
||||
### Event `resolutionUpdate`
|
||||
|
||||
Fired when the available resolutions have changed, or when the currently selected resolution has changed. Listener should call `getResolutions()` to get the updated information.
|
||||
|
||||
### Event `volumeChange`
|
||||
|
||||
Fired when the player volume changed.
|
||||
12656
support/doc/api/openapi.yaml
Normal file
12656
support/doc/api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
72
support/doc/api/quickstart.md
Normal file
72
support/doc/api/quickstart.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# REST API quick start
|
||||
|
||||
## Detect a PeerTube instance
|
||||
|
||||
There are several ways to know if a website uses the PeerTube software:
|
||||
|
||||
* The server exposes NodeInfo information: https://peertube2.cpy.re/nodeinfo/2.0.json
|
||||
* The server sends a `x-powered-by: PeerTube` header response to API requests
|
||||
* HTML pages include a `<meta property="og:platform" content="PeerTube">` tag
|
||||
|
||||
## Authentication
|
||||
|
||||
### Get client
|
||||
|
||||
Some endpoints need authentication. We use OAuth 2.0 so first fetch the client tokens:
|
||||
|
||||
```bash
|
||||
curl https://peertube.example.com/api/v1/oauth-clients/local
|
||||
```
|
||||
|
||||
Response example:
|
||||
|
||||
```json
|
||||
{
|
||||
"client_id": "v1ikx5hnfop4mdpnci8nsqh93c45rldf",
|
||||
"client_secret": "AjWiOapPltI6EnsWQwlFarRtLh4u8tDt"
|
||||
}
|
||||
```
|
||||
|
||||
### Get user token
|
||||
|
||||
Now you can fetch the user token:
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-d "client_id=v1ikx5hnfop4mdpnci8nsqh93c45rldf&client_secret=AjWiOapPltI6EnsWQwlFarRtLh4u8tDt&grant_type=password&response_type=code&username=your_user&password=your_password" \
|
||||
https://peertube.example.com/api/v1/users/token
|
||||
```
|
||||
|
||||
Response example:
|
||||
|
||||
```json
|
||||
{
|
||||
"access_token": "90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 14399,
|
||||
"refresh_token": "2e0d675df9fc96d2e4ec8a3ebbbf45eca9137bb7"
|
||||
}
|
||||
```
|
||||
|
||||
Just use the `access_token` in the `Authorization` header:
|
||||
|
||||
```bash
|
||||
curl -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https://peertube.example.com/api/v1/jobs/completed
|
||||
```
|
||||
|
||||
|
||||
## List videos
|
||||
|
||||
```bash
|
||||
curl https://peertube.example.com/api/v1/videos
|
||||
```
|
||||
|
||||
## Libraries
|
||||
|
||||
[Convenience libraries](https://framagit.org/framasoft/peertube/clients) are generated automatically from the [OpenAPI specification](https://github.com/Chocobozzz/PeerTube/blob/develop/support/doc/api/openapi.yaml) for the following languages:
|
||||
|
||||
- [python](https://framagit.org/framasoft/peertube/clients/python)
|
||||
- [go](https://framagit.org/framasoft/peertube/clients/go)
|
||||
- [kotlin](https://framagit.org/framasoft/peertube/clients/kotlin)
|
||||
|
||||
Other [languages supported by the OpenAPI generator](https://openapi-generator.tech/docs/generators/#client-generators) can be added to the generation, provided they make a common enough use case.
|
||||
600
support/doc/dependencies.md
Normal file
600
support/doc/dependencies.md
Normal file
@@ -0,0 +1,600 @@
|
||||
# Dependencies
|
||||
|
||||
:warning: **Warning**: dependencies guide is maintained by the community. Some parts may be outdated! :warning:
|
||||
|
||||
Main dependencies supported by PeerTube:
|
||||
|
||||
* `node` LTS (**>= 20.19 and < 21** or **>= 22.12 and <23**)
|
||||
* `yarn` 1.x for **PeerTube <= 7.3** or `pnpm` >= 10.x for **PeerTube >= 8.0**
|
||||
* `postgres` >=10.x
|
||||
* `redis-server` >=6.x
|
||||
* `ffmpeg` >=4.3 (using a ffmpeg static build [is not recommended](https://github.com/Chocobozzz/PeerTube/issues/6308))
|
||||
* `python` >=3.8
|
||||
* `pip`
|
||||
|
||||
|
||||
_note_: only **LTS** versions of external dependencies are supported. If no LTS version matching the version constraint is available, only **release** versions are supported.
|
||||
|
||||
[[toc]]
|
||||
|
||||
## Debian / Ubuntu and derivatives
|
||||
|
||||
1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
|
||||
|
||||
```sh
|
||||
sudo apt-get install curl sudo unzip vim
|
||||
```
|
||||
|
||||
1. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access. You can see a guide for how to do this in Debian/Ubuntu [here](https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-ubuntu-20-04).
|
||||
|
||||
1. Install NodeJS 20.x: https://nodesource.com/products/distributions
|
||||
|
||||
1. **PeerTube <= v7.3 only** Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
|
||||
[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
|
||||
|
||||
1. **PeerTube >= v8.0 only** Install [PNPM](https://pnpm.io/fr/installation):
|
||||
|
||||
```sh
|
||||
sudo npm install -g pnpm
|
||||
```
|
||||
|
||||
1. Install Python:
|
||||
|
||||
```sh
|
||||
sudo apt update
|
||||
sudo apt install python3-dev python3-pip python-is-python3
|
||||
python --version # Should be >= 3.8
|
||||
```
|
||||
|
||||
1. Install common dependencies:
|
||||
|
||||
```sh
|
||||
sudo apt update
|
||||
sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
|
||||
ffmpeg -version # Should be >= 4.1
|
||||
g++ -v # Should be >= 5.x
|
||||
redis-server --version # Should be >= 6.x
|
||||
```
|
||||
|
||||
Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
|
||||
|
||||
```sh
|
||||
sudo systemctl start redis postgresql
|
||||
```
|
||||
|
||||
## Arch Linux
|
||||
|
||||
Run:
|
||||
|
||||
```sh
|
||||
sudo pacman -S nodejs-lts-iron yarn ffmpeg postgresql openssl redis git wget unzip python python-pip base-devel npm nginx
|
||||
sudo pacman -S yarn # PeerTube <= v7.3 only
|
||||
sudo pacman -S pnpm # PeerTube >= v8.0 only
|
||||
```
|
||||
|
||||
Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
|
||||
|
||||
```sh
|
||||
sudo systemctl start redis postgresql
|
||||
```
|
||||
|
||||
## CentOS 7
|
||||
|
||||
1. Install NodeJS 20.x: https://nodesource.com/products/distributions
|
||||
|
||||
1. **PeerTube <= v7.3 only** Install [yarn](https://yarnpkg.com/en/docs/install):
|
||||
|
||||
1. **PeerTube >= v8.0 only** Install [PNPM](https://pnpm.io/fr/installation):
|
||||
|
||||
```sh
|
||||
sudo npm install -g pnpm
|
||||
````
|
||||
|
||||
1. Install or compile ffmpeg:
|
||||
|
||||
* Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/)
|
||||
* Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh)
|
||||
|
||||
1. Install Packages:
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
1. You need to use a more up to date version of G++ in order to run the `npm run install-node-dependencies` command, hence the installation of devtoolset-7.
|
||||
|
||||
```sh
|
||||
sudo scl enable devtoolset-7 bash
|
||||
```
|
||||
|
||||
Later when you invoke any node command, please prefix them with `CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++`, such as with:
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
1. Initialize the PostgreSQL database:
|
||||
|
||||
```sh
|
||||
sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
|
||||
```
|
||||
|
||||
Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
|
||||
|
||||
```sh
|
||||
sudo systemctl enable --now redis
|
||||
sudo systemctl enable --now postgresql
|
||||
```
|
||||
|
||||
## Centos 8
|
||||
|
||||
1. Install NodeJS 20.x: https://nodesource.com/products/distributions
|
||||
|
||||
1. **PeerTube <= v7.3 only** Install yarn:
|
||||
[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
|
||||
|
||||
1. **PeerTube >= v8.0 only** Install [PNPM](https://pnpm.io/fr/installation):
|
||||
|
||||
```sh
|
||||
sudo npm install -g pnpm
|
||||
````
|
||||
|
||||
1. Install or compile ffmpeg:
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
1. Install packages:
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
1. You'll need a symlink for python3 to python for youtube-dl to work
|
||||
|
||||
```sh
|
||||
sudo ln -s /usr/bin/python3 /usr/bin/python
|
||||
```
|
||||
|
||||
1. Initialize the PostgreSQL database:
|
||||
|
||||
```sh
|
||||
sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
|
||||
```
|
||||
|
||||
Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
|
||||
|
||||
```sh
|
||||
sudo systemctl enable --now redis
|
||||
sudo systemctl enable --now postgresql
|
||||
```
|
||||
|
||||
## Rocky Linux 8.4
|
||||
|
||||
1. Pull the latest updates:
|
||||
```sh
|
||||
sudo dnf update -y
|
||||
```
|
||||
|
||||
1. Install NodeJS 20.x:
|
||||
```sh
|
||||
sudo dnf module install -y nodejs:20
|
||||
```
|
||||
|
||||
1. **PeerTube <= v7.3 only** Install yarn:
|
||||
```sh
|
||||
sudo npm install --global yarn
|
||||
```
|
||||
|
||||
1. **PeerTube >= v8.0 only** Install PNPM:
|
||||
```sh
|
||||
sudo npm install --global pnpm
|
||||
```
|
||||
|
||||
1. Install or compile ffmpeg (if you want to compile... enjoy):
|
||||
```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
|
||||
```
|
||||
|
||||
1. Install PostgreSQL and Python3 and other stuff:
|
||||
```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
|
||||
```
|
||||
|
||||
1. Unknown missing steps:
|
||||
- Steps missing here... these were adapted from the CentOS 8 steps which abruptly ended.
|
||||
- /var/www/peertube does not exist yet (expected? done in future steps? documentation?).
|
||||
- Nothing about Certbot, NGINX, Firewall settings, and etc.
|
||||
- Hopefully someone can suggest what is missing here with some hints so I can add it?
|
||||
|
||||
## Fedora
|
||||
|
||||
1. Upgrade your packages:
|
||||
|
||||
```sh
|
||||
dnf upgrade
|
||||
```
|
||||
|
||||
1. (Optional) Install certbot (choose instructions for your distribution):
|
||||
[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
|
||||
|
||||
1. Install NodeJS 20.x: https://nodesource.com/products/distributions
|
||||
|
||||
1. **PeerTube <= v7.3 only** Install yarn:
|
||||
[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
|
||||
|
||||
1. **PeerTube >= v8.0 only** Install PNPM:
|
||||
```sh
|
||||
sudo npm install --global pnpm
|
||||
```
|
||||
|
||||
1. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
|
||||
|
||||
```sh
|
||||
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
```
|
||||
|
||||
This is necessary because `ffmpeg` is not in the Fedora repos.
|
||||
|
||||
1. Run:
|
||||
|
||||
```sh
|
||||
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
|
||||
```
|
||||
|
||||
1. Configure nginx
|
||||
|
||||
```sh
|
||||
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
|
||||
```
|
||||
|
||||
1. Post-installation
|
||||
|
||||
_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
|
||||
> Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically.
|
||||
|
||||
```sh
|
||||
# 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
|
||||
```
|
||||
|
||||
1. Firewall
|
||||
|
||||
By default, you cannot access your server via public IP. To do so, you must configure the firewall.
|
||||
|
||||
Ports used by peertube dev setup:
|
||||
```sh
|
||||
sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
|
||||
sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
|
||||
```
|
||||
|
||||
* Optional
|
||||
|
||||
```sh
|
||||
sudo firewall-cmd --permanent --zone=public --add-service=http
|
||||
sudo firewall-cmd --permanent --zone=public --add-service=https
|
||||
```
|
||||
|
||||
* Reload firewall
|
||||
|
||||
```sh
|
||||
sudo firewall-cmd --reload
|
||||
```
|
||||
|
||||
1. Configure max ports
|
||||
|
||||
This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
|
||||
|
||||
```sh
|
||||
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
|
||||
```
|
||||
|
||||
[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
|
||||
|
||||
## Red Hat Enterprise Linux 8
|
||||
|
||||
1. Register system as root user to Red Hat Subscription Management (create a free Red Hat account if you don't have one yet).
|
||||
|
||||
```sh
|
||||
subscription-manager register --username <username> --password <password> --auto-attach
|
||||
dnf upgrade
|
||||
reboot
|
||||
```
|
||||
|
||||
1. Install NodeJS
|
||||
|
||||
```sh
|
||||
sudo dnf module install nodejs:20
|
||||
```
|
||||
|
||||
1. **PeerTube <= v7.3 only** Install Yarn
|
||||
|
||||
```sh
|
||||
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
|
||||
sudo dnf install yarn
|
||||
```
|
||||
|
||||
1. **PeerTube >= v8.0 only** Install PNPM:
|
||||
```sh
|
||||
sudo npm install --global pnpm
|
||||
```
|
||||
|
||||
1. Install FFmpeg
|
||||
|
||||
```sh
|
||||
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
|
||||
```
|
||||
|
||||
1. Run:
|
||||
|
||||
```sh
|
||||
sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
|
||||
```
|
||||
|
||||
1. You'll need a symlink for python3 to python for youtube-dl to work
|
||||
|
||||
```sh
|
||||
sudo alternatives --set python3 /usr/bin/python
|
||||
```
|
||||
|
||||
1. Initialize the PostgreSQL database:
|
||||
|
||||
```sh
|
||||
sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
|
||||
```
|
||||
|
||||
Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
|
||||
|
||||
```sh
|
||||
sudo systemctl enable --now redis
|
||||
sudo systemctl enable --now postgresql
|
||||
```
|
||||
|
||||
If you are running the production guide, you also need to slightly pre-configure nginx, because nginx is packaged differently in the Red Hat family distributions:
|
||||
|
||||
1. Configure nginx
|
||||
|
||||
```sh
|
||||
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
|
||||
```
|
||||
|
||||
1. Firewall
|
||||
|
||||
By default, you cannot access your server via public IP. To do so, you must configure firewall:
|
||||
|
||||
* Ports used by peertube dev setup:
|
||||
```sh
|
||||
sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
|
||||
sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
|
||||
```
|
||||
* Optional
|
||||
|
||||
```sh
|
||||
sudo firewall-cmd --permanent --zone=public --add-service=http
|
||||
sudo firewall-cmd --permanent --zone=public --add-service=https
|
||||
```
|
||||
|
||||
* Reload firewall
|
||||
|
||||
```sh
|
||||
sudo firewall-cmd --reload
|
||||
```
|
||||
|
||||
1. Configure max ports
|
||||
|
||||
This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
|
||||
|
||||
```sh
|
||||
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
|
||||
```
|
||||
|
||||
[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
|
||||
|
||||
|
||||
## FreeBSD
|
||||
|
||||
On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
|
||||
|
||||
1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
|
||||
|
||||
```sh
|
||||
pkg
|
||||
pkg update
|
||||
pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
|
||||
```
|
||||
|
||||
1. **PeerTube <= v7.3 only** Install Yarn:
|
||||
```sh
|
||||
pkg install -y yarn
|
||||
```
|
||||
|
||||
1. **PeerTube >= v8.0 only** Install PNPM:
|
||||
```sh
|
||||
sudo npm install --global pnpm
|
||||
```
|
||||
|
||||
1. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
|
||||
|
||||
```sh
|
||||
visudo
|
||||
```
|
||||
|
||||
Uncomment the line 90
|
||||
|
||||
```
|
||||
%wheel ALL=(ALL) ALL
|
||||
```
|
||||
|
||||
1. Enable nginx, redis, postgresql services and initialize database.
|
||||
|
||||
```sh
|
||||
sysrc postgresql_enable="YES"
|
||||
sysrc redis_enable="YES"
|
||||
sysrc nginx_enable="YES"
|
||||
```
|
||||
|
||||
Initialize database and start services
|
||||
|
||||
```sh
|
||||
service postgresql initdb
|
||||
service postgresql start
|
||||
service redis start
|
||||
service nginx start
|
||||
```
|
||||
|
||||
## macOS
|
||||
|
||||
1. Add the packages:
|
||||
|
||||
```sh
|
||||
brew install ffmpeg nginx postgresql openssl gcc make redis git
|
||||
brew install yarn # PeerTube <= v7.3 only
|
||||
brew install pnpm # PeerTube >= v8.0 only
|
||||
```
|
||||
|
||||
1. Run the services:
|
||||
|
||||
```sh
|
||||
brew services run postgresql
|
||||
brew services run redis
|
||||
```
|
||||
|
||||
On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
|
||||
If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
|
||||
|
||||
## Gentoo
|
||||
|
||||
1. Add this to ``/etc/portage/sets/peertube``:
|
||||
|
||||
```
|
||||
net-libs/nodejs
|
||||
sys-apps/yarn
|
||||
sys-apps/pnpm
|
||||
media-video/ffmpeg[x264] # Optionally add vorbis,vpx
|
||||
dev-db/postgresql
|
||||
dev-db/redis
|
||||
dev-vcs/git
|
||||
app-arch/unzip
|
||||
dev-lang/python
|
||||
dev-lang/python-exec
|
||||
www-servers/nginx
|
||||
|
||||
# Optional, client for Let’s Encrypt:
|
||||
# app-crypt/certbot
|
||||
```
|
||||
|
||||
1. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
|
||||
|
||||
```sh
|
||||
mkdir -p /etc/portage/package.keywords
|
||||
cat << EOF >> /etc/portage/package.keywords/peertube
|
||||
# required by yarn (argument) for PeerTube
|
||||
sys-apps/yarn ~amd64
|
||||
sys-apps/pnpm ~amd64
|
||||
EOF
|
||||
```
|
||||
|
||||
1. Compile the peertube set:
|
||||
|
||||
```sh
|
||||
emerge -a @peertube
|
||||
```
|
||||
|
||||
1. Initialize the PostgreSQL database if you just merged it:
|
||||
|
||||
```sh
|
||||
emerge --config postgresql
|
||||
```
|
||||
|
||||
1. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
|
||||
|
||||
```sh
|
||||
rc-update add redis
|
||||
rc-update add postgresql-11
|
||||
rc-service redis start
|
||||
rc-service postgresql-11 start
|
||||
```
|
||||
|
||||
1. Create Python version symlink for youtube-dl:
|
||||
|
||||
```sh
|
||||
emerge -1 python-exec
|
||||
```
|
||||
|
||||
## OpenBSD
|
||||
|
||||
1. Install Packages:
|
||||
|
||||
```sh
|
||||
pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
|
||||
```
|
||||
|
||||
1. **PeerTube <= v7.3 only** Install yarn:
|
||||
|
||||
```sh
|
||||
npm install --global yarn
|
||||
```
|
||||
|
||||
1. **PeerTube >= v8.0 only** Install PNPM:
|
||||
```sh
|
||||
sudo npm install --global pnpm
|
||||
```
|
||||
|
||||
1. Allow users in the wheel group to use sudo
|
||||
|
||||
```sh
|
||||
visudo
|
||||
```
|
||||
Uncomment line #43:
|
||||
|
||||
```
|
||||
%wheel ALL=(ALL) ALL
|
||||
```
|
||||
|
||||
1. Enable services:
|
||||
|
||||
```sh
|
||||
rcctl enable postgresql redis nginx
|
||||
```
|
||||
|
||||
## Other distributions
|
||||
|
||||
Feel free to update this file in a pull request!
|
||||
40
support/doc/development/ci.md
Normal file
40
support/doc/development/ci.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Continuous integration
|
||||
|
||||
PeerTube uses Github Actions as a CI platform.
|
||||
CI tasks are described in `.github/workflows`.
|
||||
|
||||
## benchmark.yml
|
||||
|
||||
*Scheduled*
|
||||
|
||||
Run various benchmarks (build, API etc) and upload results on https://builds.joinpeertube.org/peertube-stats/ to be publicly consumed.
|
||||
|
||||
## codeql.yml
|
||||
|
||||
*Scheduled, on push on develop and on pull request*
|
||||
|
||||
Run CodeQL task to throw code security issues in Github. https://lgtm.com/projects/g/Chocobozzz/PeerTube can also be used.
|
||||
|
||||
## docker.yml
|
||||
|
||||
*Scheduled and on push on master*
|
||||
|
||||
Build `chocobozzz/peertube-webserver:latest`, `chocobozzz/peertube:production-...`, `chocobozzz/peertube:v-...` (only latest PeerTube tag) and `chocobozzz/peertube:develop-...` Docker images. Scheduled to automatically upgrade image software (Debian security issues etc).
|
||||
|
||||
## nightly.yml
|
||||
|
||||
*Scheduled*
|
||||
|
||||
Build PeerTube nightly build (`develop` branch) and upload the release on https://builds.joinpeertube.org/nightly.
|
||||
|
||||
## stats.yml
|
||||
|
||||
*On push on develop*
|
||||
|
||||
Create various PeerTube stats (line of codes, build size, lighthouse report) and upload results on https://builds.joinpeertube.org/peertube-stats/ to be publicly consumed.
|
||||
|
||||
## test.yml
|
||||
|
||||
*Scheduled, on push and pull request*
|
||||
|
||||
Run PeerTube lint and tests.
|
||||
25
support/doc/development/lib.md
Normal file
25
support/doc/development/lib.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Lib development documentation
|
||||
|
||||
## @peertube/embed-api
|
||||
|
||||
### Build & Publish
|
||||
|
||||
```
|
||||
cd client/src/standalone/embed-player-api/
|
||||
npm run build
|
||||
npm publish --access=public
|
||||
```
|
||||
|
||||
## @peertube/peertube-types
|
||||
|
||||
Typescript definition files generation is controlled by the various `tsconfig.types.json` files.
|
||||
|
||||
The complete types package is generated via:
|
||||
|
||||
```
|
||||
npm run generate-types-package 4.x.x
|
||||
cd packages/types-generator/dist
|
||||
npm publish --access=public
|
||||
```
|
||||
|
||||
> See [scripts/generate-types-package.ts](scripts/generate-types-package.ts) for details.
|
||||
35
support/doc/development/localization.md
Normal file
35
support/doc/development/localization.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Application localization documentation
|
||||
|
||||
Source files are in `client/src/locale` and translated files merged from [Weblate](https://weblate.framasoft.org/projects/peertube/).
|
||||
|
||||
|
||||
## Generation
|
||||
|
||||
Will generate XLIFF base files for Angular (`angular.xlf`) and JSON files for the player (`player.en-US.json`) and the server (`server.en-US.json`).
|
||||
Then, it will merge new translation keys into localized Angular files (`angular.fr-FR.xlf` etc).
|
||||
|
||||
```
|
||||
npm run i18n:update
|
||||
```
|
||||
|
||||
|
||||
## Upload on Weblate
|
||||
|
||||
Nothing to do here, Github will automatically send a webhook to Weblate that will pull changes.
|
||||
|
||||
|
||||
## Pull translation
|
||||
|
||||
* First, save translations on Weblate so it commits changes.
|
||||
* Then, fetch these commits: `git fetch weblate && git merge weblate/develop`
|
||||
|
||||
|
||||
## Support a new language
|
||||
|
||||
* Add it to [/packages/models/i18n/i18n.ts](/packages/core-utils/src/i18n/i18n.ts)
|
||||
* Add it to [/scripts/build/client.sh](/scripts/build/client.sh)
|
||||
* Add it to [/client/angular.json](/client/angular.json)
|
||||
* Add it to [/scripts/i18n/update.sh](/scripts/i18n/update.sh)
|
||||
* Lock [weblate project](https://weblate.framasoft.org/projects/peertube)
|
||||
* Run `npm run i18n:update`
|
||||
* Build the application and check the new language correctly works
|
||||
23
support/doc/development/monitoring.md
Normal file
23
support/doc/development/monitoring.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Monitoring
|
||||
|
||||
## Client modules
|
||||
|
||||
To open a report of client build:
|
||||
|
||||
```
|
||||
npm run build -- --analyze-bundle && npm run client-report
|
||||
```
|
||||
|
||||
## API benchmark
|
||||
|
||||
To benchmark the REST API and save result in `benchmark.json`:
|
||||
|
||||
```
|
||||
npm run benchmark-server -- -o benchmark.json
|
||||
```
|
||||
|
||||
You can also grep on a specific test:
|
||||
|
||||
```
|
||||
npm run benchmark-server -- --grep homepage
|
||||
```
|
||||
39
support/doc/development/release.md
Normal file
39
support/doc/development/release.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Release
|
||||
|
||||
## PeerTube
|
||||
|
||||
* Fix remaining important bugs
|
||||
* Ensure French translation is 100% (for the screens in the JoinPeerTube blog post)
|
||||
* Update [/CHANGELOG.md](/CHANGELOG.md)
|
||||
* Check migrations:
|
||||
```
|
||||
npm run clean:server:test
|
||||
git checkout master && rm -rf ./node_modules && npm run install-node-dependencies && npm run build:server
|
||||
NODE_APP_INSTANCE=6 NODE_ENV=test node dist/server --benchmark-startup
|
||||
git checkout develop && rm -rf ./node_modules && npm run install-node-dependencies && npm run build:server
|
||||
NODE_APP_INSTANCE=6 NODE_ENV=test node dist/server --benchmark-startup
|
||||
```
|
||||
* Run `rm -rf node_modules && rm -rf client/node_modules && npm run install-node-dependencies && npm run build` to see if all the supported languages compile correctly
|
||||
* Update https://peertube2.cpy.re and check it works correctly
|
||||
* Check CI tests are green
|
||||
* Run BrowserStack **and** local E2E tests
|
||||
* Release: `GITHUB_TOKEN=my_token npm run release -- 1.x.x`
|
||||
* Update `openapi.yaml` version
|
||||
* Upload `tar.xz` on https://builds.joinpeertube.org/release
|
||||
* Create a dedicated branch: `git checkout -b release/1.x.x && git push origin release/1.x.x`
|
||||
* Check the release is okay: https://github.com/Chocobozzz/PeerTube/releases
|
||||
* Update https://peertube3.cpy.re and check it works correctly
|
||||
* Update all other instances and check it works correctly
|
||||
* After a couple of days, update https://joinpeertube.org/api/v1/versions.json
|
||||
|
||||
|
||||
## @peertube/embed-api
|
||||
|
||||
At the root of PeerTube:
|
||||
|
||||
```
|
||||
cd client/src/standalone/embed-player-api
|
||||
npm version patch
|
||||
cd ../../../../
|
||||
npm run release-embed-api
|
||||
```
|
||||
82
support/doc/development/server.md
Normal file
82
support/doc/development/server.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Server code
|
||||
|
||||
## Database model typing
|
||||
|
||||
Sequelize models contain optional fields corresponding to table joins.
|
||||
For example, `VideoModel` has a `VideoChannel?: VideoChannelModel` field. It can be filled if the SQL query joined with the `videoChannel` table or empty if not.
|
||||
It can be difficult in TypeScript to understand if a function argument expects associations to be filled or not.
|
||||
To improve clarity and reduce bugs, PeerTube defines multiple versions of a database model depending on its associations in `server/core/types/models/`.
|
||||
These models start with `M` and by default do not include any association. `MVideo` for example corresponds to `VideoModel` without any association, where `VideoChannel` attribute doesn't exist. On the other hand, `MVideoWithChannel` is a `MVideo` that has a `VideoChannel` field. This way, a function that accepts `video: MVideoWithChannel` argument expects a video with channel populated. Main PeerTube code should never use `...Model` (`VideoModel`) database type, but always `M...` instead (`MVideo`, `MVideoChannel` etc).
|
||||
|
||||
## Add a new feature walkthrough
|
||||
|
||||
Here's a list of all the parts of the server to update if you want to add a new feature (new API REST endpoints for example) to the PeerTube server.
|
||||
Some of these may be optional (for example your new endpoint may not need to send notifications) but this guide tries to be exhaustive.
|
||||
|
||||
* Configuration:
|
||||
- Add you new configuration key in `config/default.yaml` and `config/production.yaml`
|
||||
- If you configuration needs to be different in dev or tests environments, also update `config/dev.yaml` and `config/test.yaml`
|
||||
- Load your configuration in `server/core/initializers/config.ts`
|
||||
- Check new configuration keys are set in `server/core/initializers/checker-before-init.ts`
|
||||
- You can also ensure configuration consistency in `server/core/initializers/checker-after-init.ts`
|
||||
- If you want your configuration to be available in the client:
|
||||
+ Add your field in `packages/models/src/server/core/server-config.model.ts`
|
||||
+ Update `server/core/lib/server-config-manager.ts` to include your new configuration
|
||||
- If you want your configuration to be updatable by the web admin in the client:
|
||||
+ Add your field in `packages/models/src/server/core/custom-config.model.ts`
|
||||
+ Add the configuration to the config object in the `server/core/controllers/api/config.ts` controller
|
||||
* Controllers:
|
||||
- Create the controller file and fill it with your REST API routes
|
||||
- Import and use your controller in the parent controller
|
||||
* Middlewares:
|
||||
- Create your validator middleware in `server/core/middlewares/validators` that will be used by your controllers
|
||||
- Add your new middleware file `server/core/middlewares/validators/index.ts` so it's easier to import
|
||||
- Create the entry in `server/core/types/express.d.ts` to attach the database model loaded by your middleware to the express response
|
||||
* Validators:
|
||||
- Create your validators that will be used by your middlewares in `server/core/helpers/custom-validators`
|
||||
* Typescript models:
|
||||
- Create the API models (request parameters or response) in `packages/models`
|
||||
- Add your models in `index.ts` of current directory to facilitate the imports
|
||||
* Sequelize model (BDD):
|
||||
- If you need to create a new table:
|
||||
+ Create the Sequelize model in `server/core/models/`:
|
||||
* Create the `@Column`
|
||||
* Add some indexes if you need
|
||||
* Create static methods to load a specific from the database `loadBy...`
|
||||
* Create static methods to load a list of models from the database `listBy...`
|
||||
* Create the instance method `toFormattedJSON` that creates the JSON to send to the REST API from the model
|
||||
+ Add your new Sequelize model to `server/core/initializers/database.ts`
|
||||
+ Create a new file in `server/core/types` to define multiple versions of your Sequelize model depending on database associations
|
||||
+ Add this new file to `server/core/types/*/index.ts` to facilitate the imports
|
||||
+ Create database migrations:
|
||||
* Create the migration file in `server/core/initializers/migrations` using raw SQL (copy the same SQL query as at PeerTube startup)
|
||||
* Update `LAST_MIGRATION_VERSION` in `server/core/initializers/constants.ts`
|
||||
- If updating database schema (adding/removing/renaming a column):
|
||||
+ Update the sequelize models in `server/core/models/`
|
||||
+ Add migrations:
|
||||
* Create the migration file in `initializers/migrations` using Sequelize Query Interface (`.addColumn`, `.dropTable`, `.changeColumn`)
|
||||
* Update `LAST_MIGRATION_VERSION` in `server/core/initializers/constants.ts`
|
||||
* Notifications:
|
||||
- Create the new notification model in `packages/models/src/users/user-notification.model.ts`
|
||||
- Create the notification logic in `server/core/lib/notifier/shared`:
|
||||
+ Email subject has a common prefix (defined by the admin in PeerTube configuration)
|
||||
- Add your notification to `server/core/lib/notifier/notifier.ts`
|
||||
- Create the email template in `server/core/assets/email-templates`:
|
||||
+ A text version is automatically generated from the HTML
|
||||
+ The template usually extends `../common/grettings` that already says "Hi" and "Cheers". You just have to write the title and the content blocks that will be inserted in the appropriate places in the HTML template
|
||||
- If you need to associate a new table with `userNotification`:
|
||||
+ Associate the new table in `UserNotificationModel` (don't forget the index)
|
||||
+ Add the object property in the API model definition (`packages/models/src/users/user-notification.model.ts`)
|
||||
+ Add the object in `UserNotificationModel.toFormattedJSON`
|
||||
+ Handle this new notification type in client (`UserNotificationsComponent`)
|
||||
+ Handle the new object property in client model (`UserNotification`)
|
||||
* Tests:
|
||||
- Create your command class in `packages/server-commands/` that will wrap HTTP requests to your new endpoint
|
||||
- Add your command file in `index.ts` of current directory
|
||||
- Instantiate your command class in `packages/server-commands/src/server/core.ts`
|
||||
- Create your test file in `server/core/tests/api/check-params` to test middleware validators/authentification/user rights (offensive tests)
|
||||
- Add it to `server/core/tests/api/check-params/index.ts`
|
||||
- Create your test file in `server/core/tests/api` to test your new endpoints
|
||||
- Add it to `index.ts` of current directory
|
||||
- Add your notification test in `server/core/tests/api/notifications`
|
||||
* Update REST API documentation in `support/doc/api/openapi.yaml`
|
||||
132
support/doc/development/tests.md
Normal file
132
support/doc/development/tests.md
Normal file
@@ -0,0 +1,132 @@
|
||||
# Tests
|
||||
|
||||
## Preparation
|
||||
|
||||
Prepare PostgreSQL user so PeerTube can delete/create the test databases:
|
||||
|
||||
```bash
|
||||
sudo -u postgres createuser you_username --createdb --superuser
|
||||
```
|
||||
|
||||
Prepare the databases:
|
||||
|
||||
```bash
|
||||
npm run clean:server:test
|
||||
```
|
||||
|
||||
Build PeerTube:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Server tests
|
||||
|
||||
### Dependencies
|
||||
|
||||
Run docker containers needed by some 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
|
||||
```
|
||||
|
||||
Ensure you also have these commands:
|
||||
|
||||
```bash
|
||||
exiftool --help
|
||||
parallel --help
|
||||
|
||||
# For transcription tests
|
||||
whisper --help
|
||||
whisper-ctranslate2 --help
|
||||
jiwer --help
|
||||
```
|
||||
|
||||
Otherwise, install the packages. On Debian-based systems (like Debian, Ubuntu or Mint):
|
||||
```bash
|
||||
sudo apt-get install parallel libimage-exiftool-perl
|
||||
sudo pip install -r packages/tests/requirements.txt -r packages/transcription-devtools/requirements.txt
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
To run all test suites (can be long!):
|
||||
|
||||
```bash
|
||||
npm run test # See scripts/test.sh to run a particular suite
|
||||
```
|
||||
|
||||
To run a specific test:
|
||||
|
||||
```bash
|
||||
npm run mocha -- --exit --bail packages/tests/src/your-test.ts
|
||||
|
||||
# For example
|
||||
npm run mocha -- --exit --bail packages/tests/src/api/videos/single-server.ts
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
Some env variables can be defined to disable/enable some tests:
|
||||
Some env variables can be defined to disable/enable some tests:
|
||||
|
||||
* `DISABLE_HTTP_IMPORT_TESTS=true`: disable import tests (because of youtube that could rate limit your IP)
|
||||
* `DISABLE_HTTP_YOUTUBE_IMPORT_TESTS=true`: disable youtube import tests (because youtube blocks CI server IP)
|
||||
* `ENABLE_OBJECT_STORAGE_TESTS=true`: enable object storage tests (needs `chocobozzz/s3-ninja` container first)
|
||||
* `AKISMET_KEY`: specify an Akismet key to test akismet external PeerTube plugin
|
||||
* `ENABLE_FFMPEG_THUMBNAIL_PIXEL_COMPARISON_TESTS=true`: enable pixel comparison on images generated by ffmpeg. Disabled by default because a custom ffmpeg version may fails the tests
|
||||
* `OBJECT_STORAGE_SCALEWAY_KEY_ID` and `OBJECT_STORAGE_SCALEWAY_ACCESS_KEY`: specify Scaleway API keys to test object storage ACL (not supported by our `chocobozzz/s3-ninja` container)
|
||||
* `YOUTUBE_DL_DOWNLOAD_BEARER_TOKEN`: bearer token to download youtube-dl binary
|
||||
* `YOUTUBE_DL_PROXY`: custom proxy URL for youtube-dl HTTP video import
|
||||
|
||||
|
||||
### Debug server logs
|
||||
|
||||
While testing, you might want to display a server's logs to understand why they failed:
|
||||
|
||||
```bash
|
||||
NODE_APP_INSTANCE=1 NODE_ENV=test npm run parse-log -- --level debug | less +GF
|
||||
```
|
||||
|
||||
You can also:
|
||||
- checkout only the latest logs (PeerTube >= 5.0):
|
||||
|
||||
```bash
|
||||
tail -n 100 test1/logs/peertube.log | npm run parse-log -- --level debug --files -
|
||||
```
|
||||
|
||||
- continuously print the latests logs (PeerTube >= 5.0):
|
||||
|
||||
```bash
|
||||
tail -f test1/logs/peertube.log | npm run parse-log -- --level debug --files -
|
||||
```
|
||||
|
||||
|
||||
## Client E2E tests
|
||||
|
||||
### Local tests
|
||||
|
||||
To run tests on local web browsers (comment web browsers you don't have in `client/e2e/wdio.local.conf.ts`):
|
||||
|
||||
```bash
|
||||
PEERTUBE2_E2E_PASSWORD=password npm run e2e:local
|
||||
```
|
||||
|
||||
### Browserstack tests
|
||||
|
||||
To run tests on browser stack:
|
||||
|
||||
```bash
|
||||
BROWSERSTACK_USER=your_user BROWSERSTACK_KEY=your_key npm run e2e:browserstack
|
||||
```
|
||||
|
||||
### Add E2E tests
|
||||
|
||||
To add E2E tests and quickly run tests using a local Chrome:
|
||||
|
||||
```bash
|
||||
cd client/e2e
|
||||
../node_modules/.bin/wdio wdio.local-test.conf.ts # you can also add --mochaOpts.grep to only run tests you want
|
||||
```
|
||||
297
support/doc/docker.md
Normal file
297
support/doc/docker.md
Normal file
@@ -0,0 +1,297 @@
|
||||
# Docker guide
|
||||
|
||||
This guide requires [docker](https://www.docker.com/community-edition) and
|
||||
[docker-compose V2](https://docs.docker.com/compose/install/).
|
||||
|
||||
```shell
|
||||
docker compose version # Must be > 2.x.x
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
**PeerTube does not support webserver host change**. Keep in mind your domain
|
||||
name is definitive after your first PeerTube start.
|
||||
|
||||
#### Go to your workdir
|
||||
|
||||
:::info
|
||||
The guide that follows assumes an empty workdir, but you can also clone the repository, use the master branch and `cd support/docker/production`.
|
||||
:::
|
||||
|
||||
```shell
|
||||
cd /your/peertube/directory
|
||||
```
|
||||
|
||||
#### Get the latest Compose file
|
||||
|
||||
```shell
|
||||
curl https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml > docker-compose.yml
|
||||
```
|
||||
|
||||
View the source of the file you're about to download: [docker-compose.yml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/docker-compose.yml)
|
||||
|
||||
#### Get the latest env_file
|
||||
|
||||
```shell
|
||||
curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env > .env
|
||||
```
|
||||
|
||||
View the source of the file you're about to download: [.env](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/.env)
|
||||
|
||||
#### Tweak the `docker-compose.yml` file there according to your needs
|
||||
|
||||
```shell
|
||||
sudo nano docker-compose.yml
|
||||
```
|
||||
|
||||
#### Then tweak the `.env` file to change the environment variables settings
|
||||
|
||||
```shell
|
||||
sudo nano .env
|
||||
```
|
||||
|
||||
In the downloaded example [.env](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/.env), you must replace:
|
||||
- `<MY POSTGRES USERNAME>`
|
||||
- `<MY POSTGRES PASSWORD>`
|
||||
- `<MY DOMAIN>` without 'https://'
|
||||
- `<MY EMAIL ADDRESS>`
|
||||
- `<MY PEERTUBE SECRET>`
|
||||
|
||||
Other environment variables are used in
|
||||
[/support/docker/production/config/custom-environment-variables.yaml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/config/custom-environment-variables.yaml) and can be
|
||||
intuited from usage.
|
||||
|
||||
#### Webserver
|
||||
|
||||
::: info
|
||||
The docker compose file includes a configured web server. You can skip this part and comment the appropriate section in the docker compose if you use another webserver/proxy.
|
||||
:::
|
||||
|
||||
Install the template that the nginx container will use.
|
||||
The container will generate the configuration by replacing `${WEBSERVER_HOST}` and `${PEERTUBE_HOST}` using your docker compose env file.
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
You need to manually generate the first SSL/TLS certificate using Let's Encrypt:
|
||||
|
||||
```shell
|
||||
mkdir -p docker-volume/certbot
|
||||
docker run -it --rm --name certbot -p 80:80 -v "$(pwd)/docker-volume/certbot/conf:/etc/letsencrypt" certbot/certbot certonly --standalone
|
||||
```
|
||||
|
||||
A dedicated container in the docker-compose will automatically renew this certificate and reload nginx.
|
||||
|
||||
|
||||
#### Test your setup
|
||||
|
||||
_note_: Newer versions of compose are called with `docker compose` instead of `docker-compose`, so remove the dash in all steps that use this command if you are getting errors.
|
||||
|
||||
Run your containers:
|
||||
|
||||
```shell
|
||||
docker compose up
|
||||
```
|
||||
|
||||
#### Obtaining your automatically-generated admin credentials
|
||||
|
||||
You can change the automatically created password for user root by running this command from peertube's root directory:
|
||||
```shell
|
||||
docker compose exec -u peertube peertube npm run reset-password -- -u root
|
||||
```
|
||||
|
||||
You can also grep your peertube container's logs for the default `root` password. You're going to want to run `docker-compose logs peertube | grep -A1 root` to search the log output for your new PeerTube's instance admin credentials which will look something like this.
|
||||
|
||||
```bash
|
||||
docker compose logs peertube | grep -A1 root
|
||||
|
||||
peertube_1 | [example.com:443] 2019-11-16 04:26:06.082 info: Username: root
|
||||
peertube_1 | [example.com:443] 2019-11-16 04:26:06.083 info: User password: abcdefghijklmnop
|
||||
```
|
||||
|
||||
#### Obtaining Your Automatically Generated DKIM DNS TXT Record
|
||||
|
||||
[DKIM](https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail) signature sending and RSA keys generation are enabled by the default Postfix image `mwader/postfix-relay` with [OpenDKIM](http://www.opendkim.org/).
|
||||
|
||||
Run `cat ./docker-volume/opendkim/keys/*/*.txt` to display your DKIM DNS TXT Record containing the public key to configure to your domain :
|
||||
|
||||
```bash
|
||||
cat ./docker-volume/opendkim/keys/*/*.txt
|
||||
|
||||
peertube._domainkey.mydomain.tld. IN TXT ( "v=DKIM1; h=sha256; k=rsa; "
|
||||
"p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Dx7wLGPFVaxVQ4TGym/eF89aQ8oMxS9v5BCc26Hij91t2Ci8Fl12DHNVqZoIPGm+9tTIoDVDFEFrlPhMOZl8i4jU9pcFjjaIISaV2+qTa8uV1j3MyByogG8pu4o5Ill7zaySYFsYB++cHJ9pjbFSC42dddCYMfuVgrBsLNrvEi3dLDMjJF5l92Uu8YeswFe26PuHX3Avr261n"
|
||||
"j5joTnYwat4387VEUyGUnZ0aZxCERi+ndXv2/wMJ0tizq+a9+EgqIb+7lkUc2XciQPNuTujM25GhrQBEKznvHyPA6fHsFheymOuB763QpkmnQQLCxyLygAY9mE/5RY+5Q6J9oDOQIDAQAB" ) ; ----- DKIM key peertube for mydomain.tld
|
||||
```
|
||||
|
||||
#### Administrator password
|
||||
|
||||
See the production guide ["Administrator" section](https://docs.joinpeertube.org/install/any-os#administrator)
|
||||
|
||||
#### What now?
|
||||
|
||||
See the production guide ["What now" section](https://docs.joinpeertube.org/install/any-os#what-now).
|
||||
|
||||
## Upgrade
|
||||
|
||||
::: warning
|
||||
Check the changelog (in particular the *IMPORTANT NOTES* section): https://github.com/Chocobozzz/PeerTube/blob/develop/CHANGELOG.md
|
||||
:::
|
||||
|
||||
Pull the latest images:
|
||||
|
||||
```shell
|
||||
cd /your/peertube/directory
|
||||
docker compose pull
|
||||
```
|
||||
|
||||
Stop, delete the containers and internal volumes (to invalidate static client files shared by `peertube` and `webserver` containers):
|
||||
|
||||
```shell
|
||||
docker compose down -v
|
||||
```
|
||||
|
||||
Update the nginx configuration:
|
||||
|
||||
```shell
|
||||
mv docker-volume/nginx/peertube docker-volume/nginx/peertube.bak
|
||||
curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/nginx/peertube > docker-volume/nginx/peertube
|
||||
```
|
||||
|
||||
Rerun PeerTube:
|
||||
|
||||
```shell
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Upgrade PostgreSQL container
|
||||
|
||||
If you want to upgrade your PostgreSQL container version (for example because your current version is about to no longer be supported),
|
||||
you need to plan downtime (to export current cluster and re-import data in new one).
|
||||
|
||||
When you're ready, go inside your PeerTube docker compose directory:
|
||||
|
||||
```sh
|
||||
cd /docker-compose/directory
|
||||
```
|
||||
|
||||
Prepare the backups directory and stop all containers except the database:
|
||||
|
||||
```sh
|
||||
mkdir -p backups
|
||||
docker compose stop peertube webserver certbot
|
||||
```
|
||||
|
||||
Go inside the database container:
|
||||
|
||||
```sh
|
||||
docker compose exec -it postgres /bin/bash
|
||||
```
|
||||
|
||||
And export the database (you don't need to replace `$POSTGRES_*` variables, they are automatically set by your env file from docker compose):
|
||||
|
||||
```sh
|
||||
export PGUSER="$POSTGRES_USER"
|
||||
export PGDATABASE="$POSTGRES_DB"
|
||||
export PGPASSWORD="$POSTGRES_PASSWORD"
|
||||
pg_dumpall > "/tmp/pg.dump"
|
||||
```
|
||||
|
||||
Exit the container:
|
||||
|
||||
```sh
|
||||
exit
|
||||
```
|
||||
|
||||
Copy the dump from the container:
|
||||
|
||||
```sh
|
||||
docker compose cp postgres:/tmp/pg.dump backups/pg.dump
|
||||
```
|
||||
|
||||
|
||||
Stop the database container and prepare the data for the new cluster:
|
||||
|
||||
```sh
|
||||
docker compose stop postgres
|
||||
mv ./docker-volume/db ./docker-volume/db.bak
|
||||
mkdir ./docker-volume/db && chmod 700 ./docker-volume/db
|
||||
```
|
||||
|
||||
Upgrade your PostgreSQL container version (for example replace `postgres:13-alpine` by `postgres:17-alpine`):
|
||||
|
||||
```sh
|
||||
vim docker-compose.yml
|
||||
```
|
||||
|
||||
Pull new PostgreSQL Docker image:
|
||||
|
||||
```sh
|
||||
docker compose pull
|
||||
```
|
||||
|
||||
Restart PostgreSQL only container and wait until you see: `database system is ready to accept connections`
|
||||
|
||||
```sh
|
||||
docker compose up -d postgres
|
||||
docker compose logs -f postgres
|
||||
```
|
||||
|
||||
Copy the database dump inside the container:
|
||||
|
||||
```sh
|
||||
docker compose cp "backups/pg.dump" postgres:/tmp/pg.dump
|
||||
```
|
||||
|
||||
Go inside the container
|
||||
|
||||
```sh
|
||||
docker compose exec -it postgres /bin/bash
|
||||
```
|
||||
|
||||
Check the PostgreSQL version and re-import database data.
|
||||
Then, reset the PeerTube database user password to fix a potential authentication issue if the old password hash algorithm has been deprecated.
|
||||
|
||||
```sh
|
||||
export PGUSER="$POSTGRES_USER"
|
||||
export PGDATABASE="$POSTGRES_DB"
|
||||
export PGPASSWORD="$POSTGRES_PASSWORD"
|
||||
psql -U "$POSTGRES_USER" -c "SELECT version();"
|
||||
psql -U "$POSTGRES_USER" -f /tmp/pg.dump
|
||||
psql -U "$POSTGRES_USER" -c "ALTER USER $POSTGRES_USER WITH PASSWORD '$POSTGRES_PASSWORD'"
|
||||
```
|
||||
|
||||
Exit the container:
|
||||
|
||||
```sh
|
||||
exit
|
||||
```
|
||||
|
||||
Restart other services and check everything is fine:
|
||||
|
||||
```sh
|
||||
docker compose up -d peertube webserver certbot
|
||||
docker compose logs -f peertube
|
||||
```
|
||||
|
||||
|
||||
If you're happy with the results, you can remove backups directory and old data directories:
|
||||
|
||||
```sh
|
||||
rm -rf ./docker-volume/db.bak backups
|
||||
```
|
||||
|
||||
## Build
|
||||
|
||||
### Production
|
||||
|
||||
```shell
|
||||
git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
|
||||
cd /tmp/peertube
|
||||
docker build . -f ./support/docker/production/Dockerfile
|
||||
```
|
||||
|
||||
### Development
|
||||
|
||||
We don't have a Docker image for development. See [the CONTRIBUTING guide](https://docs.joinpeertube.org/contribute/getting-started#develop) for more information on how you can hack PeerTube!
|
||||
1266
support/doc/plugins/guide.md
Normal file
1266
support/doc/plugins/guide.md
Normal file
File diff suppressed because it is too large
Load Diff
428
support/doc/production.md
Normal file
428
support/doc/production.md
Normal file
@@ -0,0 +1,428 @@
|
||||
# Production guide
|
||||
|
||||
* [Installation](#installation)
|
||||
* [Upgrade](#upgrade)
|
||||
|
||||
## Installation
|
||||
|
||||
Please don't install PeerTube for production on a device behind a low bandwidth connection (example: your ADSL link).
|
||||
If you want information about the appropriate hardware to run PeerTube, please see the [FAQ](https://joinpeertube.org/en_US/faq#should-i-have-a-big-server-to-run-peertube).
|
||||
|
||||
### :hammer: Dependencies
|
||||
|
||||
Follow the steps of the [dependencies guide](/support/doc/dependencies.md).
|
||||
|
||||
### :construction_worker: PeerTube user
|
||||
|
||||
Create a `peertube` user with `/var/www/peertube` home:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [GNU/Linux]
|
||||
sudo useradd -m -d /var/www/peertube -s /usr/sbin/nologin peertube
|
||||
```
|
||||
|
||||
```bash [FreeBSD]
|
||||
sudo pw useradd -n peertube -d /var/www/peertube -s /usr/sbin/nologin -m
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
Ensure the peertube root directory is traversable by nginx:
|
||||
|
||||
```bash
|
||||
sudo chmod 755 /var/www/peertube
|
||||
```
|
||||
|
||||
### :card_file_box: Database
|
||||
|
||||
Create the production database and a peertube user inside PostgreSQL:
|
||||
|
||||
```bash
|
||||
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.
|
||||
|
||||
```bash
|
||||
sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_prod
|
||||
```
|
||||
|
||||
Then enable extensions PeerTube needs:
|
||||
|
||||
```bash
|
||||
sudo -u postgres psql -c "CREATE EXTENSION pg_trgm;" peertube_prod
|
||||
sudo -u postgres psql -c "CREATE EXTENSION unaccent;" peertube_prod
|
||||
```
|
||||
|
||||
### :page_facing_up: Prepare PeerTube directory
|
||||
|
||||
Fetch the latest tagged version of Peertube:
|
||||
|
||||
```bash
|
||||
VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest Peertube version is $VERSION"
|
||||
```
|
||||
|
||||
|
||||
Open the peertube directory, create a few required directories:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube
|
||||
sudo -u peertube mkdir config storage versions
|
||||
sudo -u peertube chmod 750 config/
|
||||
```
|
||||
|
||||
|
||||
Download the latest version of the Peertube client, unzip it and remove the zip:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube/versions
|
||||
# Releases are also available on https://builds.joinpeertube.org/release
|
||||
sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip"
|
||||
sudo -u peertube unzip -q peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip
|
||||
```
|
||||
|
||||
|
||||
Install Peertube:
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
### :wrench: PeerTube configuration
|
||||
|
||||
Copy the default configuration file that contains the default configuration provided by PeerTube.
|
||||
You **must not** update this file.
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube
|
||||
sudo -u peertube cp peertube-latest/config/default.yaml config/default.yaml
|
||||
```
|
||||
|
||||
Now copy the production example configuration:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube
|
||||
sudo -u peertube cp peertube-latest/config/production.yaml.example config/production.yaml
|
||||
```
|
||||
|
||||
Then edit the `config/production.yaml` file according to your webserver and database configuration. In particular:
|
||||
* `webserver`: Reverse proxy public information
|
||||
* `secrets`: Secret strings you must generate manually (PeerTube version >= 5.0)
|
||||
* `database`: PostgreSQL settings
|
||||
* `redis`: Redis settings
|
||||
* `smtp`: If you want to use emails
|
||||
* `admin.email`: To correctly fill `root` user email
|
||||
|
||||
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](https://docs.joinpeertube.org/maintain/tools#update-host-js) there's no official support for that since it is a risky operation that might result in unforeseen errors.
|
||||
|
||||
### :truck: Webserver
|
||||
|
||||
We only provide official configuration files for Nginx.
|
||||
|
||||
Copy the nginx configuration template:
|
||||
|
||||
```bash
|
||||
sudo cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube
|
||||
```
|
||||
|
||||
Set the domain for the webserver configuration file by replacing `[peertube-domain]` with the domain for the peertube server:
|
||||
|
||||
```bash
|
||||
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`, `root` and `rewrite` directives paths, the paths must correspond to your PeerTube filesystem location
|
||||
* the `proxy_limit_rate` and `limit_rate` directives if you plan to stream high bitrate videos (like 4K at 60FPS)
|
||||
|
||||
```bash
|
||||
sudo vim /etc/nginx/sites-available/peertube
|
||||
```
|
||||
|
||||
Activate the configuration file:
|
||||
|
||||
```bash
|
||||
sudo ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube
|
||||
```
|
||||
|
||||
To generate the certificate for your domain as required to make https work you can use [Let's Encrypt](https://letsencrypt.org/):
|
||||
|
||||
```bash
|
||||
sudo systemctl stop nginx
|
||||
sudo certbot certonly --standalone --post-hook "systemctl restart nginx"
|
||||
sudo systemctl restart 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:
|
||||
|
||||
```bash
|
||||
# Replace authenticator = standalone by authenticator = webroot
|
||||
# Add webroot_path = /var/www/certbot
|
||||
sudo vim /etc/letsencrypt/renewal/your-domain.com.conf
|
||||
```
|
||||
|
||||
If you plan to have many concurrent viewers on your PeerTube instance, consider increasing `worker_connections` value: https://nginx.org/en/docs/ngx_core_module.html#worker_connections.
|
||||
|
||||
<details>
|
||||
<summary><strong>If using FreeBSD</strong></summary>
|
||||
|
||||
On FreeBSD you can use [Dehydrated](https://dehydrated.io/) `security/dehydrated` for [Let's Encrypt](https://letsencrypt.org/)
|
||||
|
||||
```bash
|
||||
sudo pkg install dehydrated
|
||||
```
|
||||
</details>
|
||||
|
||||
### :alembic: Linux TCP/IP Tuning
|
||||
|
||||
```bash
|
||||
sudo cp /var/www/peertube/peertube-latest/support/sysctl.d/30-peertube-tcp.conf /etc/sysctl.d/
|
||||
sudo sysctl -p /etc/sysctl.d/30-peertube-tcp.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.
|
||||
|
||||
### :bricks: systemd
|
||||
|
||||
If your OS uses systemd, copy the configuration template:
|
||||
|
||||
```bash
|
||||
sudo cp /var/www/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/
|
||||
```
|
||||
|
||||
Check the service file (PeerTube paths and security directives):
|
||||
|
||||
```bash
|
||||
sudo vim /etc/systemd/system/peertube.service
|
||||
```
|
||||
|
||||
|
||||
Tell systemd to reload its config:
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
If you want to start PeerTube on boot:
|
||||
|
||||
```bash
|
||||
sudo systemctl enable peertube
|
||||
```
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
sudo systemctl start peertube
|
||||
sudo journalctl -feu peertube
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><strong>If using FreeBSD</strong></summary>
|
||||
|
||||
On FreeBSD, copy the startup script and update rc.conf:
|
||||
|
||||
```bash
|
||||
sudo install -m 0555 /var/www/peertube/peertube-latest/support/freebsd/peertube /usr/local/etc/rc.d/
|
||||
sudo sysrc peertube_enable="YES"
|
||||
```
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
sudo service peertube start
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>If using OpenRC</strong></summary>
|
||||
|
||||
If your OS uses OpenRC, copy the service script:
|
||||
|
||||
```bash
|
||||
sudo cp /var/www/peertube/peertube-latest/support/init.d/peertube /etc/init.d/
|
||||
sudo cp /var/www/peertube/peertube-latest/support/conf.d/peertube /etc/conf.d/
|
||||
```
|
||||
|
||||
If you want to start PeerTube on boot:
|
||||
|
||||
```bash
|
||||
sudo rc-update add peertube default
|
||||
```
|
||||
|
||||
Run and print last logs:
|
||||
|
||||
```bash
|
||||
sudo /etc/init.d/peertube start
|
||||
tail -f /var/log/peertube/peertube.log
|
||||
```
|
||||
</details>
|
||||
|
||||
### :technologist: 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:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube/peertube-latest && sudo -u peertube 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.
|
||||
|
||||
### :tada: What now?
|
||||
|
||||
Now your instance is up you can:
|
||||
|
||||
* Add your instance to the public PeerTube instances index if you want to: https://instances.joinpeertube.org/
|
||||
* Check [available CLI tools](/support/doc/tools.md)
|
||||
|
||||
## Upgrade
|
||||
|
||||
### PeerTube instance
|
||||
|
||||
**Check the changelog (in particular the *IMPORTANT NOTES* section):** https://github.com/Chocobozzz/PeerTube/blob/develop/CHANGELOG.md
|
||||
|
||||
Run the upgrade script (the password it asks is PeerTube's database user password):
|
||||
|
||||
```bash
|
||||
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
|
||||
```
|
||||
|
||||
You may want to run `sudo -u peertube pnpm store prune` after several upgrades to free up disk space.
|
||||
|
||||
<details>
|
||||
<summary><strong>Prefer manual upgrade?</strong></summary>
|
||||
|
||||
Make a SQL backup
|
||||
|
||||
```bash
|
||||
SQL_BACKUP_PATH="backup/sql-peertube_prod-$(date -Im).bak" && \
|
||||
cd /var/www/peertube && sudo -u peertube mkdir -p backup && \
|
||||
sudo -u postgres pg_dump -F c peertube_prod | sudo -u peertube tee "$SQL_BACKUP_PATH" >/dev/null
|
||||
```
|
||||
|
||||
Fetch the latest tagged version of Peertube:
|
||||
|
||||
```bash
|
||||
VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest Peertube version is $VERSION"
|
||||
```
|
||||
|
||||
Download the new version and unzip it:
|
||||
|
||||
```bash
|
||||
cd /var/www/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
|
||||
```
|
||||
|
||||
Install node dependencies:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube/versions/peertube-${VERSION} && \
|
||||
sudo -H -u peertube npm run install-node-dependencies -- --production
|
||||
```
|
||||
|
||||
Copy new configuration defaults values and update your configuration file:
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
Change the link to point to the latest version:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube && \
|
||||
sudo unlink ./peertube-latest && \
|
||||
sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest
|
||||
```
|
||||
</details>
|
||||
|
||||
### Update PeerTube configuration
|
||||
|
||||
If your system has `git` installed, the auto upgrade script should have created a `config/production.yaml.new` file that merges your current configuration file with the new configuration keys introduced by the new PeerTube version.
|
||||
|
||||
Review the file, check and fix any potential conflicts:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube && sudo -u peertube diff config/production.yaml config/production.yaml.new
|
||||
```
|
||||
|
||||
Then replace your current configuration file by the new one:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube && sudo -u peertube cp config/production.yaml.new config/production.yaml
|
||||
```
|
||||
|
||||
### Update nginx configuration
|
||||
|
||||
Check changes in nginx configuration:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube/versions
|
||||
diff -u "$(ls -t | head -2 | tail -1)/support/nginx/peertube" "$(ls -t | head -1)/support/nginx/peertube"
|
||||
```
|
||||
|
||||
### Update systemd service
|
||||
|
||||
Check changes in systemd configuration:
|
||||
|
||||
```bash
|
||||
cd /var/www/peertube/versions
|
||||
diff -u "$(ls -t | head -2 | tail -1)/support/systemd/peertube.service" "$(ls -t | head -1)/support/systemd/peertube.service"
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><strong>If using OpenRC</strong></summary>
|
||||
|
||||
```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"
|
||||
```
|
||||
</details>
|
||||
|
||||
### Restart PeerTube
|
||||
|
||||
If you changed your nginx configuration:
|
||||
|
||||
```bash
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
If you changed your systemd configuration:
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
Restart PeerTube and check the logs:
|
||||
|
||||
```bash
|
||||
sudo systemctl restart peertube && sudo journalctl -fu peertube
|
||||
```
|
||||
|
||||
### Things went wrong?
|
||||
|
||||
Change `peertube-latest` destination to the previous version and restore your SQL backup:
|
||||
|
||||
```bash
|
||||
OLD_VERSION="v0.42.42" && SQL_BACKUP_PATH="backup/sql-peertube_prod-20180119-1018.bak" && \
|
||||
cd /var/www/peertube && sudo -u peertube unlink ./peertube-latest && \
|
||||
sudo -u peertube ln -s "versions/peertube-$OLD_VERSION" peertube-latest && \
|
||||
sudo -u postgres pg_restore -c -C -d peertube_prod "$SQL_BACKUP_PATH" && \
|
||||
sudo systemctl restart peertube
|
||||
```
|
||||
788
support/doc/tools.md
Normal file
788
support/doc/tools.md
Normal file
@@ -0,0 +1,788 @@
|
||||
# CLI tools guide
|
||||
|
||||
[[toc]]
|
||||
|
||||
## Remote PeerTube CLI
|
||||
|
||||
`peertube-cli` is a tool that communicates with a PeerTube instance using its [REST API](https://docs.joinpeertube.org/api-rest-reference.html).
|
||||
It can be launched from a remote server/computer to easily upload videos, manage plugins, redundancies etc.
|
||||
|
||||
### Installation
|
||||
|
||||
Ensure you have `node` installed on your system:
|
||||
|
||||
```bash
|
||||
node --version # Should be >= 20.x
|
||||
```
|
||||
|
||||
Then install the CLI:
|
||||
|
||||
```bash
|
||||
sudo npm install -g @peertube/peertube-cli
|
||||
```
|
||||
|
||||
### CLI wrapper
|
||||
|
||||
The wrapper provides a convenient interface to the following sub-commands.
|
||||
|
||||
```
|
||||
Usage: peertube-cli [command] [options]
|
||||
|
||||
Options:
|
||||
-v, --version output the version number
|
||||
-h, --help display help for command
|
||||
|
||||
Commands:
|
||||
auth Register your accounts on remote instances to use them with other commands
|
||||
upload|up [options] Upload a video on a PeerTube instance
|
||||
redundancy|r Manage instance redundancies
|
||||
plugins|p Manage instance plugins/themes
|
||||
get-access-token|token [options] Get a peertube access token
|
||||
help [command] display help for command
|
||||
```
|
||||
|
||||
The wrapper can keep track of instances you have an account on. We limit to one account per instance for now.
|
||||
|
||||
```bash
|
||||
peertube-cli auth add -u 'PEERTUBE_URL' -U 'PEERTUBE_USER' --password 'PEERTUBE_PASSWORD'
|
||||
```
|
||||
|
||||
Now list the account(s) you've created
|
||||
|
||||
```bash
|
||||
peertube-cli auth list
|
||||
```
|
||||
|
||||
```
|
||||
┌──────────────────────────────┬──────────────────────────────┐
|
||||
│ instance │ login │
|
||||
├──────────────────────────────┼──────────────────────────────┤
|
||||
│ 'PEERTUBE_URL' │ 'PEERTUBE_USER' │
|
||||
└──────────────────────────────┴──────────────────────────────┘
|
||||
```
|
||||
|
||||
You can now use that account to execute sub-commands without feeding the `--url`, `--username` and `--password` parameters:
|
||||
|
||||
```bash
|
||||
peertube-cli upload <videoFile>
|
||||
```
|
||||
|
||||
```bash
|
||||
peertube-cli plugins list
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
#### peertube-cli upload
|
||||
|
||||
You can use this script to upload videos directly from the CLI.
|
||||
|
||||
Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).
|
||||
|
||||
```bash
|
||||
cd ${CLONE}
|
||||
peertube-cli upload --help
|
||||
```
|
||||
|
||||
#### peertube-cli plugins
|
||||
|
||||
Install/update/uninstall or list local or NPM PeerTube plugins:
|
||||
|
||||
```bash
|
||||
cd ${CLONE}
|
||||
peertube-cli plugins --help
|
||||
peertube-cli plugins list --help
|
||||
peertube-cli plugins install --help
|
||||
peertube-cli plugins update --help
|
||||
peertube-cli plugins uninstall --help
|
||||
|
||||
peertube-cli plugins install --path /my/plugin/path
|
||||
peertube-cli plugins install --npm-name peertube-theme-example
|
||||
```
|
||||
|
||||
#### peertube-cli redundancy
|
||||
|
||||
Manage (list/add/remove) video redundancies:
|
||||
|
||||
To list your videos that are duplicated by remote instances:
|
||||
|
||||
```bash
|
||||
peertube-cli redundancy list-remote-redundancies
|
||||
```
|
||||
|
||||
To list remote videos that your instance duplicated:
|
||||
|
||||
```bash
|
||||
peertube-cli redundancy list-my-redundancies
|
||||
```
|
||||
|
||||
To duplicate a specific video in your redundancy system:
|
||||
|
||||
```bash
|
||||
peertube-cli redundancy add --video 823
|
||||
```
|
||||
|
||||
To remove a video redundancy:
|
||||
|
||||
```bash
|
||||
peertube-cli redundancy remove --video 823
|
||||
```
|
||||
|
||||
|
||||
## PeerTube runner
|
||||
|
||||
PeerTube supports VOD/Live transcoding and VOD transcription (PeerTube >= 6.2) by a remote PeerTube runner.
|
||||
|
||||
The runner communicates with the PeerTube instance using HTTP and WebSocket and doesn't need to have a public IP.
|
||||
So you can run a runner on a classic server, a non-public server or even on your own computer!
|
||||
|
||||
You can read the admin documentation on how to use PeerTube runners on https://docs.joinpeertube.org/admin/remote-runners
|
||||
|
||||
### Runner installation
|
||||
|
||||
Ensure you have `node`, `ffmpeg` and `ffprobe` installed on your system:
|
||||
|
||||
```bash
|
||||
node --version # Should be >= 20.x
|
||||
ffprobe -version # Should be >= 4.3
|
||||
ffmpeg -version # Should be >= 4.3
|
||||
```
|
||||
|
||||
If you want to use video transcription:
|
||||
|
||||
```bash
|
||||
pip install whisper-ctranslate2 # or pipx install whisper-ctranslate2 depending on your distribution
|
||||
```
|
||||
|
||||
Then install the CLI:
|
||||
|
||||
```bash
|
||||
sudo npm install -g @peertube/peertube-runner
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
The runner uses env paths like `~/.config`, `~/.cache` and `~/.local/share` directories to store runner configuration or temporary files.
|
||||
|
||||
Multiple PeerTube runners can run on the same OS by using the `--id` CLI option (each runner uses its own config/tmp directories):
|
||||
|
||||
```bash
|
||||
peertube-runner [commands] --id instance-1
|
||||
peertube-runner [commands] --id instance-2
|
||||
peertube-runner [commands] --id instance-3
|
||||
```
|
||||
|
||||
You can change the runner configuration (jobs concurrency, ffmpeg threads/nice, whisper engines/models, etc.) by editing `~/.config/peertube-runner-nodejs/[id]/config.toml`.
|
||||
|
||||
The runner TOML config template consists of:
|
||||
|
||||
```toml
|
||||
[jobs]
|
||||
# How much concurrent jobs the runner can execute in parallel
|
||||
concurrency = 2
|
||||
|
||||
[ffmpeg]
|
||||
# How much threads a ffmpeg process can use
|
||||
# 0 -> let ffmpeg automatically choose
|
||||
threads = 0
|
||||
nice = 20
|
||||
|
||||
[transcription]
|
||||
# Choose between "openai-whisper" or "whisper-ctranslate2"
|
||||
# Engine binary has to be installed manually (unlike the PeerTube instance that can install whisper automatically)
|
||||
engine = "whisper-ctranslate2"
|
||||
# Optional whisper binary path if not available in global path
|
||||
enginePath = "/var/prunner/.local/pipx/venvs/whisper-ctranslate2/bin/whisper-ctranslate2"
|
||||
# Whisper model: "tiny", "base", "small", "medium", "large-v2" or "large-v3"
|
||||
model = "large-v2"
|
||||
|
||||
# Registered instances are saved in the config file
|
||||
[[registeredInstances]]
|
||||
url = "..." # URL of the instance
|
||||
runnerToken = "..." # Shared runner token secret
|
||||
runnerName = "..." # Runner name declared to the PeerTube instance
|
||||
|
||||
[[registeredInstances]]
|
||||
url = "..."
|
||||
runnerToken = "..."
|
||||
runnerName = "..."
|
||||
```
|
||||
|
||||
### Run the server
|
||||
|
||||
#### In a shell
|
||||
|
||||
You need to run the runner in server mode first so it can run transcoding jobs of registered PeerTube instances:
|
||||
|
||||
```bash
|
||||
peertube-runner server
|
||||
```
|
||||
|
||||
You can also decide which kind of job the runner can execute with `--enable-job <type>` option.
|
||||
This way you can have one dedicated runner for transcription tasks (on a GPU machine for example) and another one for transcoding tasks.
|
||||
|
||||
Only transcription tasks
|
||||
|
||||
```bash
|
||||
peertube-runner server --enable-job video-transcription
|
||||
```
|
||||
|
||||
Only VOD transcoding tasks
|
||||
|
||||
```bash
|
||||
peertube-runner server --enable-job vod-web-video-transcoding --enable-job vod-hls-transcoding --enable-job vod-audio-merge-transcoding
|
||||
```
|
||||
|
||||
Only "studio" transcoding
|
||||
|
||||
```bash
|
||||
peertube-runner server --enable-job video-studio-transcoding
|
||||
```
|
||||
|
||||
Only "live" transcoding
|
||||
|
||||
```bash
|
||||
peertube-runner server --enable-job live-rtmp-hls-transcoding
|
||||
```
|
||||
|
||||
#### As a Systemd service
|
||||
|
||||
If your OS uses systemd, you can also configure a service so that the runner starts automatically.
|
||||
|
||||
To do so, first create a dedicated user. Here, we are calling it `prunner`, but you can choose whatever name you want.
|
||||
We are using `/srv/prunner` as his home dir, but you can choose any other path.
|
||||
|
||||
```bash
|
||||
useradd -m -d /srv/prunner -s /usr/sbin/nologin prunner
|
||||
```
|
||||
|
||||
::: info Note
|
||||
If you want to use `/home/prunner`, you have to set `ProtectHome=false` in the systemd configuration (see below).
|
||||
:::
|
||||
|
||||
Now, you can create the `/etc/systemd/system/prunner.service` file (don't forget to adapt path and user/group names if you changed it):
|
||||
|
||||
```Systemd
|
||||
[Unit]
|
||||
Description=PeerTube runner daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=NODE_ENV=production
|
||||
User=prunner
|
||||
Group=prunner
|
||||
ExecStart=peertube-runner server
|
||||
WorkingDirectory=/srv/prunner
|
||||
SyslogIdentifier=prunner
|
||||
Restart=always
|
||||
|
||||
; Some security directives.
|
||||
; Mount /usr, /boot, and /etc as read-only for processes invoked by this service.
|
||||
ProtectSystem=full
|
||||
; Sets up a new /dev mount for the process and only adds API pseudo devices
|
||||
; like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled
|
||||
; by default because it may not work on devices like the Raspberry Pi.
|
||||
PrivateDevices=false
|
||||
; Ensures that the service process and all its children can never gain new
|
||||
; privileges through execve().
|
||||
NoNewPrivileges=true
|
||||
; This makes /home, /root, and /run/user inaccessible and empty for processes invoked
|
||||
; by this unit. Make sure that you do not depend on data inside these folders.
|
||||
ProtectHome=true
|
||||
; Drops the sys admin capability from the daemon.
|
||||
CapabilityBoundingSet=~CAP_SYS_ADMIN
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
:::info Note
|
||||
You can add the parameter `--id instance-1` on the `ExecStart` line, if you want to have multiple instances.
|
||||
You can then create multiple separate services. They can use the same user and path.
|
||||
:::
|
||||
|
||||
Finally, to enable the service for the first time:
|
||||
|
||||
```bash
|
||||
systemctl daemon-reload
|
||||
systemctl enable prunner.service
|
||||
systemctl restart prunner.service
|
||||
```
|
||||
|
||||
Next time, if you need to start/stop/restart the service:
|
||||
|
||||
```bash
|
||||
systemctl stop prunner.service
|
||||
systemctl start prunner.service
|
||||
systemctl restart prunner.service
|
||||
```
|
||||
|
||||
You can also check the status (and last logs):
|
||||
|
||||
```bash
|
||||
systemctl status prunner.service
|
||||
```
|
||||
|
||||
To edit the runner configuration: juste edit the `/srv/prunner/.config/peertube-runner-nodejs/default/config.toml` file,
|
||||
and restart the service (this file will be created when the runner starts for the first time).
|
||||
|
||||
If you are using the `--id` parameter, you can change specific configuration by editing the file `/srv/prunner/.config/peertube-runner-nodejs/[id]/config.toml`.
|
||||
|
||||
::: info
|
||||
For every peertube-runner commands described below, you have to run them as the `prunner` user.
|
||||
So for example, to call the `list-registered` command: `sudo -u prunner peertube-runner list-registered`.
|
||||
Otherwise the script will read the wrong configuration and cache files, and won't work as expected.
|
||||
:::
|
||||
|
||||
### Register
|
||||
|
||||
Then, you can register the runner to process transcoding job of a remote PeerTube instance:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Shell]
|
||||
peertube-runner register --url http://peertube.example.com --registration-token ptrrt-... --runner-name my-runner-name
|
||||
```
|
||||
|
||||
```bash [Systemd]
|
||||
sudo -u prunner peertube-runner register --url http://peertube.example.com --registration-token ptrrt-... --runner-name my-runner-name
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
The runner will then use a websocket connection with the PeerTube instance to be notified about new available transcoding jobs.
|
||||
|
||||
### Unregister
|
||||
|
||||
To unregister a PeerTube instance:
|
||||
|
||||
::: code-group
|
||||
|
||||
|
||||
```bash [Shell]
|
||||
peertube-runner unregister --url http://peertube.example.com --runner-name my-runner-name
|
||||
```
|
||||
|
||||
```bash [Systemd]
|
||||
sudo -u prunner peertube-runner unregister --url http://peertube.example.com --runner-name my-runner-name
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### List registered instances
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Shell]
|
||||
peertube-runner list-registered
|
||||
```
|
||||
|
||||
```bash [Systemd]
|
||||
sudo -u prunner peertube-runner list-registered
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### List jobs
|
||||
|
||||
**Runner >= 0.1.0**
|
||||
|
||||
To list jobs that are processed by the runner:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Shell]
|
||||
peertube-runner list-jobs
|
||||
peertube-runner list-jobs --include-payload
|
||||
```
|
||||
|
||||
```bash [Systemd]
|
||||
sudo -u prunner peertube-runner list-jobs
|
||||
sudo -u prunner peertube-runner list-jobs --include-payload
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Graceful shutdown
|
||||
|
||||
Ask the runner to shutdown when it has finished all of its current tasks:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Shell]
|
||||
peertube-runner graceful-shutdown
|
||||
```
|
||||
|
||||
```bash [Systemd]
|
||||
sudo -u prunner peertube-runner graceful-shutdown
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Update the runner package
|
||||
|
||||
You can check if there is a new runner version using:
|
||||
|
||||
```bash
|
||||
sudo npm outdated -g @peertube/peertube-runner
|
||||
```
|
||||
|
||||
```
|
||||
Package Current Wanted Latest Location Depended by
|
||||
@peertube/peertube-runner 0.0.6 0.0.7 0.0.7 node_modules/@peertube/peertube-runner lib
|
||||
```
|
||||
|
||||
To update the runner:
|
||||
|
||||
Update the package
|
||||
```bash
|
||||
sudo npm update -g @peertube/peertube-runner
|
||||
```
|
||||
|
||||
Check that the version changed (optional)
|
||||
```bash
|
||||
sudo npm list -g @peertube/peertube-runner
|
||||
```
|
||||
|
||||
Restart the service (if you are using systemd)
|
||||
```bash
|
||||
sudo systemctl restart prunner.service
|
||||
```
|
||||
|
||||
## Server tools
|
||||
|
||||
Server tools are scripts that interact directly with the code of your PeerTube instance.
|
||||
They must be run on the server, in `peertube-latest` directory.
|
||||
|
||||
### Parse logs
|
||||
|
||||
To parse PeerTube last log file:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run parse-log -- --level info
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run parse-log -- --level info
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
`--level` is optional and could be `info`/`warn`/`error`
|
||||
|
||||
You can also remove SQL or HTTP logs using `--not-tags`:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run parse-log -- --level debug --not-tags http sql
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run parse-log -- --level debug --not-tags http sql
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Regenerate video thumbnails
|
||||
|
||||
Regenerating local video thumbnails could be useful because new PeerTube releases may increase thumbnail sizes:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run regenerate-thumbnails
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run regenerate-thumbnails
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Add or replace specific video file
|
||||
|
||||
You can use this script to import a video file to replace an already uploaded file or to add a new web compatible resolution to a video. PeerTube needs to be running.
|
||||
You can then create a transcoding job using the web interface if you need to optimize your file or create an HLS version of it.
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Move video files from filesystem to object storage
|
||||
|
||||
Use this script to move video related files (video files, original video file, captions, etc.) to object storage.
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-move-video-storage-job -- --to-object-storage -v [videoUUID]
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run create-move-video-storage-job -- --to-object-storage -v [videoUUID]
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
The script can also move all video related files that are not already in object storage:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-move-video-storage-job -- --to-object-storage --all-videos
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run create-move-video-storage-job -- --to-object-storage --all-videos
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Move video files from object storage to filesystem
|
||||
|
||||
**PeerTube >= 6.0**
|
||||
|
||||
Use this script to move video related files (video files, original video file, captions, etc.) from object storage to the PeerTube instance filesystem.
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-move-video-storage-job -- --to-file-system -v [videoUUID]
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run create-move-video-storage-job -- --to-file-system -v [videoUUID]
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
The script can also move all video related files that are not already on the filesystem:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-move-video-storage-job -- --to-file-system --all-videos
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run create-move-video-storage-job -- --to-file-system --all-videos
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Update object storage URLs
|
||||
|
||||
**PeerTube >= 6.2**
|
||||
|
||||
Use this script after you migrated to another object storage provider so PeerTube updates its internal object URLs (a confirmation will be demanded first). Restart PeerTube after running the script.
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-object-storage-url -- --from 'https://region.old-s3-provider.example.com' --to 'https://region.new-s3-provider.example.com'
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run update-object-storage-url -- --from 'https://region.old-s3-provider.example.com' --to 'https://region.new-s3-provider.example.com'
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Cleanup remote files
|
||||
|
||||
**PeerTube >= 6.2**
|
||||
|
||||
Use this script to recover disk space by removing remote files (thumbnails, avatars...) that can be re-fetched later by your PeerTube instance on-demand:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run house-keeping -- --delete-remote-files
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run house-keeping -- --delete-remote-files
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Generate storyboard
|
||||
|
||||
**PeerTube >= 6.0**
|
||||
|
||||
Use this script to generate storyboard of a specific video:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-generate-storyboard-job -- -v [videoUUID]
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run create-generate-storyboard-job -- -v [videoUUID]
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
The script can also generate all missing storyboards of local videos:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-generate-storyboard-job -- --all-videos
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run create-generate-storyboard-job -- --all-videos
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Prune filesystem/object storage
|
||||
|
||||
Some transcoded videos or shutdown at a bad time can leave some unused files on your storage.
|
||||
To delete these files (a confirmation will be demanded first):
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run prune-storage
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run prune-storage
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Update PeerTube instance domain name
|
||||
|
||||
**Changing the hostname is unsupported and may be a risky operation, especially if you have already federated.**
|
||||
If you started PeerTube with a domain, and then changed it you will have
|
||||
invalid torrent files and invalid URLs in your database. To fix this, you have
|
||||
to run the command below (keep in mind your follower instances will NOT update their URLs).
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-host
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run update-host
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Reset user password
|
||||
|
||||
To reset a user password from CLI, run:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u target_username
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run reset-password -- -u target_username
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
|
||||
### Install or uninstall plugins
|
||||
|
||||
The difference with `peertube plugins` CLI is that these scripts can be used even if PeerTube is not running.
|
||||
If PeerTube is running, you need to restart it for the changes to take effect (whereas with `peertube plugins` CLI, plugins/themes are dynamically loaded on the server).
|
||||
|
||||
To install/update a plugin or a theme from the disk:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
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
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run plugin:install -- --plugin-path /local/plugin/path
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
From NPM:
|
||||
|
||||
::: code-group
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run plugin:install -- --npm-name peertube-plugin-myplugin
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
To uninstall a plugin or a theme:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Classic installation]
|
||||
cd /var/www/peertube/peertube-latest; \
|
||||
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run plugin:uninstall -- --npm-name peertube-plugin-myplugin
|
||||
```
|
||||
|
||||
```bash [Docker]
|
||||
cd /var/www/peertube-docker; \
|
||||
docker compose exec -u peertube peertube npm run plugin:uninstall -- --npm-name peertube-plugin-myplugin
|
||||
```
|
||||
|
||||
:::
|
||||
64
support/doc/translation.md
Normal file
64
support/doc/translation.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# Translation
|
||||
|
||||
We use [Weblate](https://weblate.org) as translation platform.
|
||||
Please do not edit translation files directly from Git, you have to use Weblate!
|
||||
|
||||
If you don't see your locale in the platform you can add it directly in the Weblate interface.
|
||||
Then, if you think there are enough translated strings, please [create an issue](https://github.com/Chocobozzz/PeerTube/issues) so we add the new locale in PeerTube!
|
||||
|
||||
Translations are manually pulled and merged in PeerTube software and are publicly available in the next official release.
|
||||
You can get a chance to see translations before the official release by going to https://peertube2.cpy.re which is updated every night with the latest PeerTube changes.
|
||||
|
||||
|
||||
## How to
|
||||
|
||||
* Create an account: https://weblate.framasoft.org/accounts/register/
|
||||
* Validate your email and follow the link sent
|
||||
* Create your password (keep the `Current password` field empty) and set up your account
|
||||
* To translate the PeerTube web, visit the PeerTube project page: https://weblate.framasoft.org/projects/peertube/
|
||||
* To translate the PeerTube mobile application, visit the PeerTube App project page: https://weblate.framasoft.org/projects/peertube-app/
|
||||
* Choose the file and the locale you want to translate
|
||||
|
||||
|
||||
## Files
|
||||
|
||||
There are 4 files:
|
||||
* **angular**: contains client strings
|
||||
* **player**: contains player strings.
|
||||
Most of the strings come from VideoJS, so you can help yourself by using [video.js JSON files](https://github.com/videojs/video.js/tree/master/lang)
|
||||
* **server**: contains server strings clients can fetch in JSON format so they don't have to translate common PeerTube strings themselves (iso639 languages, privacies, licences...)
|
||||
* **server-internal**: contains internal server strings used in the REST API responses or emails
|
||||
|
||||
|
||||
## Tips
|
||||
|
||||
### Special tags
|
||||
|
||||
You must not translate special tags like `<x id="INTERPOLATION" ... />`.
|
||||
|
||||
For example:
|
||||
```
|
||||
<x id="INTERPOLATION" equiv-text="{{ video.publishedAt | myFromNow }}"/> - <x id="INTERPOLATION_1" equiv-text="{{ video.views | myNumberFormatter }}"/> views
|
||||
```
|
||||
|
||||
should be in French
|
||||
```
|
||||
<x id="INTERPOLATION" equiv-text="{{ video.publishedAt | myFromNow }}"/> - <x id="INTERPOLATION_1" equiv-text="{{ video.views | myNumberFormatter }}"/> vues
|
||||
```
|
||||
|
||||
|
||||
### Singular/plural
|
||||
|
||||
For singular/plural translations, you must translate values inside `{` and `}`. **Please don't translate the word *other***
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
{VAR_PLURAL, plural, =0 {No videos} =1 {1 video} other {<x id="INTERPOLATION" equiv-text="{{ playlist.videosLength }}"/> videos} }
|
||||
```
|
||||
|
||||
should be in French
|
||||
|
||||
```
|
||||
{VAR_PLURAL, plural, =0 {Aucune vidéo} =1 {1 vidéo} other {<x id="INTERPOLATION" equiv-text="{{ playlist.videosLength }}"/> vidéos} }
|
||||
```
|
||||
11
support/docker/gitpod/Dockerfile
Normal file
11
support/docker/gitpod/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM gitpod/workspace-postgres
|
||||
|
||||
# Gitpod will not rebuild PeerTube's dev image unless *some* change is made to this Dockerfile.
|
||||
# To trigger a rebuild, simply increase this counter:
|
||||
ENV TRIGGER_REBUILD 3
|
||||
|
||||
# Install PeerTube's dependencies.
|
||||
RUN sudo apt-get update -q && sudo apt-get install -qy \
|
||||
ffmpeg \
|
||||
openssl \
|
||||
redis-server
|
||||
6
support/docker/gitpod/setup_postgres.sql
Normal file
6
support/docker/gitpod/setup_postgres.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
create database peertube_dev;
|
||||
create user peertube password 'peertube';
|
||||
grant all privileges on database peertube_dev to peertube;
|
||||
\c peertube_dev
|
||||
CREATE EXTENSION pg_trgm;
|
||||
CREATE EXTENSION unaccent;
|
||||
87
support/docker/production/.env
Normal file
87
support/docker/production/.env
Normal file
@@ -0,0 +1,87 @@
|
||||
# Database / Postgres service configuration
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
# Postgres database name "peertube"
|
||||
POSTGRES_DB=peertube
|
||||
# The database name used by PeerTube will be PEERTUBE_DB_NAME (only if set) *OR* 'peertube'+PEERTUBE_DB_SUFFIX
|
||||
PEERTUBE_DB_NAME=peertube
|
||||
#PEERTUBE_DB_SUFFIX=_prod
|
||||
# Database username and password used by PeerTube must match Postgres', so they are copied:
|
||||
PEERTUBE_DB_USERNAME=$POSTGRES_USER
|
||||
PEERTUBE_DB_PASSWORD=$POSTGRES_PASSWORD
|
||||
PEERTUBE_DB_SSL=false
|
||||
# Default to Postgres service name "postgres" in docker-compose.yml
|
||||
PEERTUBE_DB_HOSTNAME=postgres
|
||||
PEERTUBE_REDIS_HOSTNAME=redis
|
||||
|
||||
# PeerTube server configuration
|
||||
# If you test PeerTube in local: use "peertube.localhost" and add this domain to your host file resolving on 127.0.0.1
|
||||
# Use a local hostname for testing
|
||||
PEERTUBE_WEBSERVER_HOSTNAME=localhost
|
||||
# local dev settings
|
||||
PEERTUBE_WEBSERVER_HTTPS=false
|
||||
PEERTUBE_WEBSERVER_PORT=9000
|
||||
# If you just want to test PeerTube on local
|
||||
#PEERTUBE_WEBSERVER_PORT=9000
|
||||
#PEERTUBE_WEBSERVER_HTTPS=false
|
||||
# If you need more than one IP as trust_proxy
|
||||
# pass them as a comma separated array:
|
||||
PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback", "172.18.0.0/16"]
|
||||
|
||||
# Generate one using `openssl rand -hex 32`
|
||||
PEERTUBE_SECRET=615d0c43a256c3e4fb81dd473e251ab67393bdb1719e9a2abb0f4ec4da26bc56
|
||||
|
||||
# E-mail configuration
|
||||
# If you use a Custom SMTP server
|
||||
#PEERTUBE_SMTP_USERNAME=
|
||||
#PEERTUBE_SMTP_PASSWORD=
|
||||
# Default to Postfix service name "postfix" in docker-compose.yml
|
||||
# May be the hostname of your Custom SMTP server
|
||||
PEERTUBE_SMTP_HOSTNAME=postfix
|
||||
PEERTUBE_SMTP_PORT=25
|
||||
PEERTUBE_SMTP_FROM=noreply@peertube.localhost
|
||||
PEERTUBE_SMTP_TLS=false
|
||||
PEERTUBE_SMTP_DISABLE_STARTTLS=false
|
||||
PEERTUBE_ADMIN_EMAIL=admin@peertube.localhost
|
||||
|
||||
# Postfix service configuration
|
||||
POSTFIX_myhostname=localhost
|
||||
# If you need to generate a list of sub/DOMAIN keys
|
||||
# pass them as a whitespace separated string <DOMAIN>=<selector>
|
||||
OPENDKIM_DOMAINS=peertube.localhost=peertube
|
||||
# see https://github.com/wader/postfix-relay/pull/18
|
||||
OPENDKIM_RequireSafeKeys=no
|
||||
|
||||
# If you want to enable object storage for PeerTube, set the following variables.
|
||||
#PEERTUBE_OBJECT_STORAGE_ENABLED=
|
||||
#PEERTUBE_OBJECT_STORAGE_ENDPOINT=
|
||||
#PEERTUBE_OBJECT_STORAGE_REGION=
|
||||
#PEERTUBE_OBJECT_STORAGE_FORCE_PATH_STYLE=
|
||||
#PEERTUBE_OBJECT_STORAGE_CREDENTIALS_ACCESS_KEY_ID=
|
||||
#PEERTUBE_OBJECT_STORAGE_CREDENTIALS_SECRET_ACCESS_KEY=
|
||||
#PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BUCKET_NAME=
|
||||
#PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_PREFIX=
|
||||
#PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BASE_URL=
|
||||
#PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BUCKET_NAME=
|
||||
#PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_PREFIX=
|
||||
#PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BASE_URL=
|
||||
#PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_BUCKET_NAME=
|
||||
#PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_PREFIX=
|
||||
#PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_BASE_URL=
|
||||
#PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_BUCKET_NAME=
|
||||
#PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_PREFIX=
|
||||
#PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_BASE_URL=
|
||||
#PEERTUBE_OBJECT_STORAGE_CAPTIONS_BUCKET_NAME=
|
||||
#PEERTUBE_OBJECT_STORAGE_CAPTIONS_PREFIX=
|
||||
#PEERTUBE_OBJECT_STORAGE_CAPTIONS_BASE_URL=
|
||||
|
||||
# Comment these variables if your S3 provider does not support object ACL
|
||||
PEERTUBE_OBJECT_STORAGE_UPLOAD_ACL_PUBLIC="public-read"
|
||||
PEERTUBE_OBJECT_STORAGE_UPLOAD_ACL_PRIVATE="private"
|
||||
|
||||
#PEERTUBE_LOG_LEVEL=info
|
||||
|
||||
# /!\ Prefer to use the PeerTube admin interface to set the following configurations /!\
|
||||
#PEERTUBE_SIGNUP_ENABLED=true
|
||||
#PEERTUBE_TRANSCODING_ENABLED=true
|
||||
#PEERTUBE_CONTACT_FORM_ENABLED=true
|
||||
3
support/docker/production/.gitignore
vendored
Normal file
3
support/docker/production/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
data/
|
||||
db/
|
||||
redis/
|
||||
65
support/docker/production/Dockerfile
Normal file
65
support/docker/production/Dockerfile
Normal file
@@ -0,0 +1,65 @@
|
||||
FROM node:20-trixie-slim
|
||||
|
||||
ARG ALREADY_BUILT=0
|
||||
|
||||
# Install dependencies
|
||||
RUN apt update \
|
||||
&& apt install -y --no-install-recommends openssl ffmpeg python3 python3-pip ca-certificates gnupg gosu build-essential curl git va-driver-all \
|
||||
&& gosu nobody true \
|
||||
&& rm /var/lib/apt/lists/* -fR
|
||||
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# Node images hardcode the node uid to 1000 so that number is not available.
|
||||
# The "peertube" user is created as a system account which selects a UID from
|
||||
# the range of SYS_UID_MIN to SYS_UID_MAX (-1 to 1000] and consistently
|
||||
# selects 999 given the current image build steps. The same is true for the
|
||||
# system group range SYS_GID_MIN and SYS_GID_MAX. It is fine to manually assign
|
||||
# them an ID outside of that range.
|
||||
ENV DEFAULT_PEERTUBE_UID=999
|
||||
ENV DEFAULT_PEERTUBE_GID=999
|
||||
|
||||
# Add peertube user
|
||||
RUN groupadd -r -g ${PEERTUBE_GID:-${DEFAULT_PEERTUBE_GID}} peertube \
|
||||
&& useradd -r -u ${PEERTUBE_UID:-${DEFAULT_PEERTUBE_UID}} -g peertube -m peertube
|
||||
|
||||
# Install PeerTube
|
||||
COPY --chown=peertube:peertube . /app
|
||||
WORKDIR /app
|
||||
|
||||
# Do not ship local development overrides in production image.
|
||||
RUN rm -f /app/config/local.yaml
|
||||
|
||||
USER peertube
|
||||
|
||||
# Install manually client dependencies to apply our network timeout option
|
||||
RUN if [ "${ALREADY_BUILT}" = 0 ]; then \
|
||||
npm run install-node-dependencies \
|
||||
&& npm run build; \
|
||||
else \
|
||||
echo "Do not build application inside Docker because of ALREADY_BUILT build argument"; \
|
||||
fi; \
|
||||
rm -rf ./node_modules ./client/node_modules ./client/.angular \
|
||||
&& npm run install-node-dependencies -- --production \
|
||||
&& pnpm store prune
|
||||
|
||||
USER root
|
||||
|
||||
RUN mkdir /data /config
|
||||
RUN chown -R peertube:peertube /data /config
|
||||
|
||||
ENV NODE_ENV production
|
||||
ENV NODE_CONFIG_DIR /app/config:/app/support/docker/production/config:/config
|
||||
ENV PEERTUBE_LOCAL_CONFIG /config
|
||||
|
||||
VOLUME /data
|
||||
VOLUME /config
|
||||
|
||||
COPY ./support/docker/production/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
||||
|
||||
# Expose API, RTMP and RTMPS ports
|
||||
EXPOSE 9000 1935 1936
|
||||
|
||||
# Run the application
|
||||
CMD [ "node", "dist/server" ]
|
||||
6
support/docker/production/Dockerfile.nginx
Normal file
6
support/docker/production/Dockerfile.nginx
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY ./support/docker/production/entrypoint.nginx.sh /docker-entrypoint.d/99-entrypoint.nginx.sh
|
||||
RUN chmod +x /docker-entrypoint.d/99-entrypoint.nginx.sh
|
||||
|
||||
EXPOSE 80 443
|
||||
@@ -0,0 +1,327 @@
|
||||
#
|
||||
# This file will be read by node-config
|
||||
# See https://github.com/node-config/node-config/wiki/Environment-Variables#custom-environment-variables
|
||||
#
|
||||
|
||||
webserver:
|
||||
hostname: "PEERTUBE_WEBSERVER_HOSTNAME"
|
||||
port:
|
||||
__name: "PEERTUBE_WEBSERVER_PORT"
|
||||
__format: "json"
|
||||
https:
|
||||
__name: "PEERTUBE_WEBSERVER_HTTPS"
|
||||
__format: "json"
|
||||
|
||||
federation:
|
||||
sign_federated_fetches:
|
||||
__name: "PEERTUBE_SIGN_FEDERATED_FETCHES"
|
||||
__format: "json"
|
||||
|
||||
secrets:
|
||||
peertube: "PEERTUBE_SECRET"
|
||||
|
||||
trust_proxy:
|
||||
__name: "PEERTUBE_TRUST_PROXY"
|
||||
__format: "json"
|
||||
|
||||
database:
|
||||
hostname: "PEERTUBE_DB_HOSTNAME"
|
||||
port:
|
||||
__name: "PEERTUBE_DB_PORT"
|
||||
__format: "json"
|
||||
name: "PEERTUBE_DB_NAME"
|
||||
suffix: "PEERTUBE_DB_SUFFIX"
|
||||
username: "PEERTUBE_DB_USERNAME"
|
||||
password: "PEERTUBE_DB_PASSWORD"
|
||||
ssl:
|
||||
__name: "PEERTUBE_DB_SSL"
|
||||
__format: "json"
|
||||
|
||||
redis:
|
||||
hostname: "PEERTUBE_REDIS_HOSTNAME"
|
||||
port:
|
||||
__name: "PEERTUBE_REDIS_PORT"
|
||||
__format: "json"
|
||||
auth: "PEERTUBE_REDIS_AUTH"
|
||||
|
||||
smtp:
|
||||
hostname: "PEERTUBE_SMTP_HOSTNAME"
|
||||
port:
|
||||
__name: "PEERTUBE_SMTP_PORT"
|
||||
__format: "json"
|
||||
username: "PEERTUBE_SMTP_USERNAME"
|
||||
password: "PEERTUBE_SMTP_PASSWORD"
|
||||
tls:
|
||||
__name: "PEERTUBE_SMTP_TLS"
|
||||
__format: "json"
|
||||
disable_starttls:
|
||||
__name: "PEERTUBE_SMTP_DISABLE_STARTTLS"
|
||||
__format: "json"
|
||||
from_address: "PEERTUBE_SMTP_FROM"
|
||||
|
||||
object_storage:
|
||||
enabled:
|
||||
__name: "PEERTUBE_OBJECT_STORAGE_ENABLED"
|
||||
__format: "json"
|
||||
|
||||
endpoint: "PEERTUBE_OBJECT_STORAGE_ENDPOINT"
|
||||
|
||||
region: "PEERTUBE_OBJECT_STORAGE_REGION"
|
||||
|
||||
force_path_style:
|
||||
__name: "PEERTUBE_OBJECT_STORAGE_FORCE_PATH_STYLE"
|
||||
__format: "json"
|
||||
|
||||
upload_acl:
|
||||
public: "PEERTUBE_OBJECT_STORAGE_UPLOAD_ACL_PUBLIC"
|
||||
private: "PEERTUBE_OBJECT_STORAGE_UPLOAD_ACL_PRIVATE"
|
||||
|
||||
proxy:
|
||||
proxify_private_files:
|
||||
__name: "PEERTUBE_OBJECT_STORAGE_PROXY_PROXIFY_PRIVATE_FILES"
|
||||
__format: "json"
|
||||
|
||||
credentials:
|
||||
access_key_id: "PEERTUBE_OBJECT_STORAGE_CREDENTIALS_ACCESS_KEY_ID"
|
||||
secret_access_key: 'PEERTUBE_OBJECT_STORAGE_CREDENTIALS_SECRET_ACCESS_KEY'
|
||||
|
||||
max_upload_part:
|
||||
__name: "PEERTUBE_OBJECT_STORAGE_MAX_UPLOAD_PART"
|
||||
__format: "json"
|
||||
|
||||
max_request_attempts:
|
||||
__name: "PEERTUBE_OBJECT_STORAGE_MAX_REQUEST_ATTEMPTS"
|
||||
__format: "json"
|
||||
|
||||
streaming_playlists:
|
||||
bucket_name: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BUCKET_NAME"
|
||||
prefix: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_PREFIX"
|
||||
base_url: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_BASE_URL"
|
||||
store_live_streams:
|
||||
__name: "PEERTUBE_OBJECT_STORAGE_STREAMING_PLAYLISTS_STORE_LIVE_STREAMS"
|
||||
__format: "json"
|
||||
|
||||
web_videos:
|
||||
bucket_name: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BUCKET_NAME"
|
||||
prefix: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_PREFIX"
|
||||
base_url: "PEERTUBE_OBJECT_STORAGE_WEB_VIDEOS_BASE_URL"
|
||||
|
||||
user_exports:
|
||||
bucket_name: "PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_BUCKET_NAME"
|
||||
prefix: "PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_PREFIX"
|
||||
base_url: "PEERTUBE_OBJECT_STORAGE_USER_EXPORTS_BASE_URL"
|
||||
|
||||
original_video_files:
|
||||
bucket_name: "PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_BUCKET_NAME"
|
||||
prefix: "PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_PREFIX"
|
||||
base_url: "PEERTUBE_OBJECT_STORAGE_ORIGINAL_VIDEO_FILES_BASE_URL"
|
||||
|
||||
captions:
|
||||
bucket_name: "PEERTUBE_OBJECT_STORAGE_CAPTIONS_BUCKET_NAME"
|
||||
prefix: "PEERTUBE_OBJECT_STORAGE_CAPTIONS_PREFIX"
|
||||
base_url: "PEERTUBE_OBJECT_STORAGE_CAPTIONS_BASE_URL"
|
||||
|
||||
webadmin:
|
||||
configuration:
|
||||
edition:
|
||||
allowed:
|
||||
__name: "PEERTUBE_WEBADMIN_CONFIGURATION_EDITION_ALLOWED"
|
||||
__format: "json"
|
||||
|
||||
log:
|
||||
level: "PEERTUBE_LOG_LEVEL"
|
||||
log_ping_requests:
|
||||
__name: "PEERTUBE_LOG_PING_REQUESTS"
|
||||
__format: "json"
|
||||
|
||||
user:
|
||||
video_quota:
|
||||
__name: "PEERTUBE_USER_VIDEO_QUOTA"
|
||||
__format: "json"
|
||||
|
||||
admin:
|
||||
email: "PEERTUBE_ADMIN_EMAIL"
|
||||
|
||||
contact_form:
|
||||
enabled:
|
||||
__name: "PEERTUBE_CONTACT_FORM_ENABLED"
|
||||
__format: "json"
|
||||
|
||||
signup:
|
||||
enabled:
|
||||
__name: "PEERTUBE_SIGNUP_ENABLED"
|
||||
__format: "json"
|
||||
limit:
|
||||
__name: "PEERTUBE_SIGNUP_LIMIT"
|
||||
__format: "json"
|
||||
|
||||
search:
|
||||
remote_uri:
|
||||
users:
|
||||
__name: "PEERTUBE_SEARCH_REMOTEURI_USERS"
|
||||
__format: "json"
|
||||
anonymous:
|
||||
__name: "PEERTUBE_SEARCH_REMOTEURI_ANONYMOUS"
|
||||
__format: "json"
|
||||
|
||||
import:
|
||||
videos:
|
||||
http:
|
||||
enabled:
|
||||
__name: "PEERTUBE_IMPORT_VIDEOS_HTTP"
|
||||
__format: "json"
|
||||
torrent:
|
||||
enabled:
|
||||
__name: "PEERTUBE_IMPORT_VIDEOS_TORRENT"
|
||||
__format: "json"
|
||||
|
||||
transcoding:
|
||||
enabled:
|
||||
__name: "PEERTUBE_TRANSCODING_ENABLED"
|
||||
__format: "json"
|
||||
threads:
|
||||
__name: "PEERTUBE_TRANSCODING_THREADS"
|
||||
__format: "json"
|
||||
resolutions:
|
||||
144p:
|
||||
__name: "PEERTUBE_TRANSCODING_144P"
|
||||
__format: "json"
|
||||
240p:
|
||||
__name: "PEERTUBE_TRANSCODING_240P"
|
||||
__format: "json"
|
||||
360p:
|
||||
__name: "PEERTUBE_TRANSCODING_360P"
|
||||
__format: "json"
|
||||
480p:
|
||||
__name: "PEERTUBE_TRANSCODING_480P"
|
||||
__format: "json"
|
||||
720p:
|
||||
__name: "PEERTUBE_TRANSCODING_720P"
|
||||
__format: "json"
|
||||
1080p:
|
||||
__name: "PEERTUBE_TRANSCODING_1080P"
|
||||
__format: "json"
|
||||
1440p:
|
||||
__name: "PEERTUBE_TRANSCODING_1440P"
|
||||
__format: "json"
|
||||
2160p:
|
||||
__name: "PEERTUBE_TRANSCODING_2160P"
|
||||
__format: "json"
|
||||
web_videos:
|
||||
enabled:
|
||||
__name: "PEERTUBE_TRANSCODING_WEB_VIDEOS_ENABLED"
|
||||
__format: "json"
|
||||
hls:
|
||||
enabled:
|
||||
__name: "PEERTUBE_TRANSCODING_HLS_ENABLED"
|
||||
__format: "json"
|
||||
|
||||
instance:
|
||||
name: "PEERTUBE_INSTANCE_NAME"
|
||||
description: "PEERTUBE_INSTANCE_DESCRIPTION"
|
||||
terms: "PEERTUBE_INSTANCE_TERMS"
|
||||
|
||||
live:
|
||||
enabled:
|
||||
__name: "PEERTUBE_LIVE_ENABLED"
|
||||
__format: "json"
|
||||
|
||||
max_duration:
|
||||
__name: "PEERTUBE_LIVE_MAX_DURATION"
|
||||
__format: "json"
|
||||
|
||||
max_instance_lives:
|
||||
__name: "PEERTUBE_LIVE_MAX_INSTANCE_LIVES"
|
||||
__format: "json"
|
||||
|
||||
max_user_lives:
|
||||
__name: "PEERTUBE_LIVE_MAX_USER_LIVES"
|
||||
__format: "json"
|
||||
|
||||
allow_replay:
|
||||
__name: "PEERTUBE_LIVE_ALLOW_REPLAY"
|
||||
__format: "json"
|
||||
|
||||
latency_setting:
|
||||
enabled:
|
||||
__name: "PEERTUBE_LIVE_LATENCY_SETTING_ENABLED"
|
||||
__format: "json"
|
||||
|
||||
rtsp:
|
||||
endpoint: "PEERTUBE_LIVE_RTSP_ENDPOINT"
|
||||
url_pattern: "PEERTUBE_LIVE_RTSP_URL_PATTERN"
|
||||
|
||||
rtmp:
|
||||
enabled:
|
||||
__name: "PEERTUBE_LIVE_RTMP_ENABLED"
|
||||
__format: "json"
|
||||
port:
|
||||
__name: "PEERTUBE_LIVE_RTMP_PORT"
|
||||
__format: "json"
|
||||
hostname: "PEERTUBE_LIVE_RTMP_HOSTNAME"
|
||||
public_hostname: "PEERTUBE_LIVE_RTMP_PUBLIC_HOSTNAME"
|
||||
rtmps:
|
||||
enabled:
|
||||
__name: "PEERTUBE_LIVE_RTMPS_ENABLED"
|
||||
__format: "json"
|
||||
port:
|
||||
__name: "PEERTUBE_LIVE_RTMPS_PORT"
|
||||
__format: "json"
|
||||
hostname: "PEERTUBE_LIVE_RTMPS_HOSTNAME"
|
||||
public_hostname: "PEERTUBE_LIVE_RTMPS_PUBLIC_HOSTNAME"
|
||||
key_file: "PEERTUBE_LIVE_RTMPS_KEY_FILE"
|
||||
cert_file: "PEERTUBE_LIVE_RTMPS_CERT_FILE"
|
||||
|
||||
transcoding:
|
||||
enabled:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_ENABLED"
|
||||
__format: "json"
|
||||
|
||||
remote_runners:
|
||||
enabled:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_REMOTE_RUNNERS_ENABLED"
|
||||
__format: "json"
|
||||
|
||||
threads:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_THREADS"
|
||||
__format: "json"
|
||||
|
||||
profile: "PEERTUBE_LIVE_TRANSCODING_PROFILE"
|
||||
|
||||
resolutions:
|
||||
0p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_0P"
|
||||
__format: "json"
|
||||
144p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_144P"
|
||||
__format: "json"
|
||||
240p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_240P"
|
||||
__format: "json"
|
||||
360p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_360P"
|
||||
__format: "json"
|
||||
480p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_480P"
|
||||
__format: "json"
|
||||
720p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_720P"
|
||||
__format: "json"
|
||||
1080p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_1080P"
|
||||
__format: "json"
|
||||
1440p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_1440P"
|
||||
__format: "json"
|
||||
2160p:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_2160P"
|
||||
__format: "json"
|
||||
|
||||
always_transcode_original_resolution:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION"
|
||||
__format: "json"
|
||||
|
||||
fps:
|
||||
max:
|
||||
__name: "PEERTUBE_LIVE_TRANSCODING_FPS_MAX"
|
||||
__format: "json"
|
||||
74
support/docker/production/config/production.yaml
Normal file
74
support/docker/production/config/production.yaml
Normal file
@@ -0,0 +1,74 @@
|
||||
# Check config/production.yaml.example in PeerTube repository for more details/available configuration
|
||||
|
||||
listen:
|
||||
hostname: '0.0.0.0'
|
||||
port: 9000
|
||||
|
||||
webserver:
|
||||
https: true
|
||||
hostname: undefined
|
||||
port: 443
|
||||
|
||||
rates_limit:
|
||||
login:
|
||||
window: 5 minutes
|
||||
max: 15
|
||||
ask_send_email:
|
||||
window: 5 minutes
|
||||
max: 3
|
||||
|
||||
trust_proxy:
|
||||
- 'loopback'
|
||||
- 'linklocal'
|
||||
- 'uniquelocal'
|
||||
|
||||
database:
|
||||
hostname: 'postgres'
|
||||
port: 5432
|
||||
ssl: false
|
||||
suffix: ''
|
||||
username: 'postgres'
|
||||
password: 'postgres'
|
||||
|
||||
redis:
|
||||
hostname: 'redis'
|
||||
port: 6379
|
||||
auth: null
|
||||
|
||||
# From the project root directory
|
||||
storage:
|
||||
tmp: '../data/tmp/'
|
||||
tmp_persistent: '../data/tmp-persistent/'
|
||||
bin: '../data/bin/'
|
||||
avatars: '../data/avatars/'
|
||||
web_videos: '../data/web-videos/'
|
||||
streaming_playlists: '../data/streaming-playlists'
|
||||
original_video_files: '../data/original-video-files'
|
||||
redundancy: '../data/redundancy/'
|
||||
logs: '../data/logs/'
|
||||
previews: '../data/previews/'
|
||||
thumbnails: '../data/thumbnails/'
|
||||
storyboards: '../data/storyboards/'
|
||||
torrents: '../data/torrents/'
|
||||
captions: '../data/captions/'
|
||||
cache: '../data/cache/'
|
||||
plugins: '../data/plugins/'
|
||||
uploads: '../data/uploads/'
|
||||
well_known: '../data/well-known/'
|
||||
client_overrides: '../data/client-overrides/'
|
||||
|
||||
|
||||
object_storage:
|
||||
upload_acl:
|
||||
public: null # Set to null here because we can't using env variables
|
||||
private: null
|
||||
|
||||
log:
|
||||
level: 'info'
|
||||
|
||||
tracker:
|
||||
enabled: true
|
||||
reject_too_many_announces: false # false because we have issues with docker ws ip/port forwarding
|
||||
|
||||
admin:
|
||||
email: null
|
||||
119
support/docker/production/docker-compose.yml
Normal file
119
support/docker/production/docker-compose.yml
Normal file
@@ -0,0 +1,119 @@
|
||||
services:
|
||||
|
||||
# You can comment this webserver section if you want to use another webserver/proxy or test PeerTube in local
|
||||
# webserver:
|
||||
# image: chocobozzz/peertube-webserver:latest
|
||||
# # If you don't want to use the official image and build one from sources:
|
||||
# # build:
|
||||
# # context: .
|
||||
# # dockerfile: ./support/docker/production/Dockerfile.nginx
|
||||
# env_file:
|
||||
# - .env
|
||||
# ports:
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
# volumes:
|
||||
# - type: bind
|
||||
# # Switch sources if you downloaded the whole repository
|
||||
# #source: ../../nginx/peertube
|
||||
# source: ./docker-volume/nginx/peertube
|
||||
# target: /etc/nginx/conf.d/peertube.template
|
||||
# - assets:/var/www/peertube/peertube-latest/client/dist:ro
|
||||
# - ./docker-volume/data:/var/www/peertube/storage
|
||||
# - certbot-www:/var/www/certbot
|
||||
# - ./docker-volume/certbot/conf:/etc/letsencrypt
|
||||
# - ./docker-volume/nginx-logs:/var/log/nginx
|
||||
# depends_on:
|
||||
# - peertube
|
||||
# restart: "always"
|
||||
|
||||
# # You can comment this certbot section if you want to use another webserver/proxy or test PeerTube in local
|
||||
# certbot:
|
||||
# container_name: certbot
|
||||
# image: certbot/certbot
|
||||
# volumes:
|
||||
# - ./docker-volume/certbot/conf:/etc/letsencrypt
|
||||
# - certbot-www:/var/www/certbot
|
||||
# restart: unless-stopped
|
||||
# entrypoint: /bin/sh -c "trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;"
|
||||
# depends_on:
|
||||
# - webserver
|
||||
|
||||
# You can comment this webserver-reloader section if you want to use another webserver/proxy or test PeerTube in local
|
||||
# webserver-reloader:
|
||||
# image: alpine:latest
|
||||
# command: >
|
||||
# sh -c "trap exit TERM;
|
||||
# while :; do
|
||||
# sleep 21600 & wait $$!;
|
||||
# echo 'Sending reload signal to webserver...';
|
||||
# kill -HUP 1;
|
||||
# done"
|
||||
# pid: "service:webserver"
|
||||
# depends_on:
|
||||
# - webserver
|
||||
# restart: "always"
|
||||
|
||||
peertube:
|
||||
# If you don't want to use the official image and build one from sources:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: support/docker/production/Dockerfile
|
||||
# image: chocobozzz/peertube:production
|
||||
# Use a static IP for this container because nginx does not handle proxy host change without reload
|
||||
# This container could be restarted on crash or until the postgresql database is ready for connection
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 172.28.0.42
|
||||
ipv6_address: fdab:e4b3:21a2:ef1c::42
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
ports:
|
||||
- "1935:1935" # Comment if you don't want to use the live feature
|
||||
- "9000:9000" # Uncomment if you use another webserver/proxy or test PeerTube in local, otherwise not suitable for production
|
||||
volumes:
|
||||
# Remove the following line if you want to use another webserver/proxy or test PeerTube in local
|
||||
- assets:/app/client/dist
|
||||
- ./docker-volume/data:/data
|
||||
- ./docker-volume/config:/config
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
# - postfix
|
||||
restart: "always"
|
||||
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./docker-volume/db:/var/lib/postgresql/data
|
||||
restart: "always"
|
||||
|
||||
redis:
|
||||
image: redis:8-alpine
|
||||
volumes:
|
||||
- ./docker-volume/redis:/data
|
||||
restart: "always"
|
||||
|
||||
# postfix:
|
||||
# image: mwader/postfix-relay
|
||||
# env_file:
|
||||
# - .env
|
||||
# volumes:
|
||||
# - ./docker-volume/opendkim/keys:/etc/opendkim/keys
|
||||
# restart: "always"
|
||||
|
||||
networks:
|
||||
default:
|
||||
enable_ipv6: false
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: 172.28.0.0/16
|
||||
- subnet: fdab:e4b3:21a2:ef1c::/64
|
||||
|
||||
volumes:
|
||||
assets:
|
||||
certbot-www:
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDXhXF+Ma/5MfbX
|
||||
irFNboIsA44yiH827F75EOFHFV0fN6k+J2guj/JGHLj+QGg4GpJTLkQAFNeZOylY
|
||||
VgGn3yAyQMsdEX1C8fIMWU/tWqeHHf+68l4AV2k0h8qeMgeRZOWbN9OhLDEeHt9W
|
||||
/BLLqE+toqpGB2vbXL/j6Vt9fRILnx0jlczRb2GjNUquSMWtvoQbqMDsMmPponoN
|
||||
HgmmitXYZDikStKf5mK4xrcQrSDxrXdUWujScR+Nttp/W6BiE4b8ONehqCEW1WxR
|
||||
xpF6cV7R+Yd3K1hgaJFY984RSoE9HS1PZ+3S7uZBzM+nOzgwvqtIagywv+8wtnze
|
||||
EpehFgqNAgMBAAECggEABl7RGtZfblrKlHtGJKc1Rl6iP6eQEewasERFLYpsHjpj
|
||||
h2iAf0Ro07m1niCUquYnT14dlHDAIPY4/zSUvs4auPPTn2l6pKftkMkFUqRxDPMX
|
||||
Mbm1+QXA/AteV4xuc7ErOEEGLzn5dSAtoK7eLRJSP3Vb/oXpojyPBlNJxHGDrL+j
|
||||
qMb3Iw/OzIj4ADNkZXy3V0Nu6KFEL5OQVb4rH+Sy7RQ1O2CBeF//bD5AK+HYs4EH
|
||||
VKh+KvTuBP1JL4t4pJIRa8fMnLsOaCaj5Qlf9mU0glE6qu7Ngqpwsatiwkgt28tO
|
||||
Q6kHJ4hXvfnTp+ZXgwOzk5D7VSKTTficm1Q72kpQAQKBgQDs15+yh4pJKWxAxkSA
|
||||
ieDWTJ3pnEdCKOJtppcRKbAIeZ0GpKzpayu94wfqIHZhN+WHWZyIopasFNH9ztxb
|
||||
Z1HjhdwUnBwRfbO/rPhjQcyIhtmxqRI+dEff1yZfvGhA0qaDgK6ITpBOG30HIh+1
|
||||
Orb/9BBlu08a43Nuyz+kD+fJDQKBgQDo9FFWbwmM87L+H0yceMAK7Ecxi7RGV6op
|
||||
EzQ9xAOpVzCc1VMdC3RKG63BLZGEka4Jz0UGeIsuWQrcgQ/IX0munvrXQ/eiblOV
|
||||
p26FPw87swgRhFnV6iu6U/gdO7noSr5vCqBoArL3XwsmYo8hEFaLGvWpxnGtagtv
|
||||
uU0+rJvngQKBgQDL5t9ALlypnBXstkUnfIyrMo8JHlhi5xv5VuDcD83Tng/INmH/
|
||||
GxsvgZPAx23jSOI84rNXFtMtF0eqgTtJHexsO0Q8IiIwFM55iIrXuUBDkgU9ZNem
|
||||
GSn/1hTdezEuDaz5rgGUrD6kYBoF2CUAO6ptNUwgqV/zQDqS+jyyHFdqyQKBgCQE
|
||||
qpLXpj1h7Ln38ut6jA7kS3mwpRX/NfMV4gzuwrYrIfwNy8UA4WEX+HyW5BoAQE2J
|
||||
+50thC+NWu2PEvajLQxPzm78NkyqDEhmU+NMRbmwS74RnaZCh7JOi11Rv8PX0qvu
|
||||
k7ChQjSXQG0V7hVppkfpyjQO18K9U7lZiET5gT2BAoGBANeJsl3W1dKn58cIyf8O
|
||||
eD3QGJtQFBc/A23n0PcQk1+5PhzameKwHwtbBqa93Qf2aTfKT10gekQ+nCFPOkfe
|
||||
xKJCfsrne/Dv6IGacXOgxKhMIUa6tZ35quPyz3qqKRK3cK939S3NaQTwyMbrPK6e
|
||||
CfjVoTEj/dlqXCuC4EZXKY+d
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,3 @@
|
||||
peertube._domainkey.peertube.localhost. IN TXT ( "v=DKIM1; h=sha256; k=rsa; "
|
||||
"p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA14VxfjGv+TH214qxTW6CLAOOMoh/Nuxe+RDhRxVdHzepPidoLo/yRhy4/kBoOBqSUy5EABTXmTspWFYBp98gMkDLHRF9QvHyDFlP7Vqnhx3/uvJeAFdpNIfKnjIHkWTlmzfToSwxHh7fVvwSy6hPraKqRgdr21y/4+lbfX0SC58dI5XM0W9hozVKrkjFrb6EG6jA7DJj6aJ6DR"
|
||||
"4JporV2GQ4pErSn+ZiuMa3EK0g8a13VFro0nEfjbbaf1ugYhOG/DjXoaghFtVsUcaRenFe0fmHdytYYGiRWPfOEUqBPR0tT2ft0u7mQczPpzs4ML6rSGoMsL/vMLZ83hKXoRYKjQIDAQAB" ) ; ----- DKIM key peertube for peertube.localhost
|
||||
10
support/docker/production/entrypoint.nginx.sh
Normal file
10
support/docker/production/entrypoint.nginx.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Process the nginx template
|
||||
SOURCE_FILE="/etc/nginx/conf.d/peertube.template"
|
||||
TARGET_FILE="/etc/nginx/conf.d/default.conf"
|
||||
export WEBSERVER_HOST="$PEERTUBE_WEBSERVER_HOSTNAME"
|
||||
export PEERTUBE_HOST="peertube:9000"
|
||||
|
||||
envsubst '${WEBSERVER_HOST} ${PEERTUBE_HOST}' < $SOURCE_FILE > $TARGET_FILE
|
||||
19
support/docker/production/entrypoint.sh
Normal file
19
support/docker/production/entrypoint.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
|
||||
find /config ! -user peertube -exec chown peertube:peertube {} \; || true
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
# or first arg is `something.conf`
|
||||
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
|
||||
set -- node "$@"
|
||||
fi
|
||||
|
||||
# allow the container to be started with `--user`
|
||||
if [ "$1" = 'node' -a "$(id -u)" = '0' ]; then
|
||||
find /data ! -user peertube -exec chown peertube:peertube {} \;
|
||||
exec gosu peertube "$0" "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
30
support/freebsd/peertube
Normal file
30
support/freebsd/peertube
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
# PROVIDE: peertube
|
||||
# REQUIRE: LOGIN postgresql nginx redis
|
||||
# KEYWORD: shutdown
|
||||
|
||||
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
desc="Peertube daemon"
|
||||
name=peertube
|
||||
rcvar=peertube_enable
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${peertube_enable:=NO}
|
||||
|
||||
sig_stop=-KILL
|
||||
peertube_chdir="/var/www/peertube/peertube-latest"
|
||||
peertube_env="HOME=/var/www/peertube \
|
||||
NODE_ENV=production \
|
||||
NODE_CONFIG_DIR=/var/www/peertube/config \
|
||||
USER=peertube"
|
||||
peertube_user=peertube
|
||||
|
||||
command="/usr/local/bin/node"
|
||||
command_args="dist/server >> /var/log/peertube/${name}.log 2>&1 &"
|
||||
|
||||
run_rc_command "$1"
|
||||
22
support/init.d/peertube
Normal file
22
support/init.d/peertube
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/sbin/openrc-run
|
||||
supervisor=supervise-daemon
|
||||
|
||||
name="PeerTube"
|
||||
description="PeerTube self-hosted streaming service"
|
||||
pidfile=/run/peertube/peertube.pid
|
||||
output_log=/var/log/peertube/peertube.log
|
||||
error_log="$output_log"
|
||||
command_background=true
|
||||
command_user="peertube:peertube"
|
||||
command=/usr/bin/node
|
||||
command_args="${directory}/dist/server"
|
||||
required_dirs="$directory $NODE_CONFIG_DIR"
|
||||
|
||||
depend() {
|
||||
after redis postgresql
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath --directory --owner "$command_user" --mode 0750 "${pidfile%/*}"
|
||||
checkpath --directory --owner "$command_user" --mode 0750 "${output_log%/*}"
|
||||
}
|
||||
260
support/nginx/peertube
Normal file
260
support/nginx/peertube
Normal file
@@ -0,0 +1,260 @@
|
||||
# Minimum Nginx version required: 1.13.0 (released Apr 25, 2017)
|
||||
# Please check your Nginx installation features the following modules via 'nginx -V':
|
||||
# STANDARD HTTP MODULES: Core, Proxy, Rewrite, Access, Gzip, Headers, HTTP/2, Log, Real IP, SSL, Thread Pool, Upstream, AIO Multithreading.
|
||||
# THIRD PARTY MODULES: None.
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name ${WEBSERVER_HOST};
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
default_type "text/plain";
|
||||
root /var/www/certbot;
|
||||
}
|
||||
location / { return 301 https://$host$request_uri; }
|
||||
}
|
||||
|
||||
upstream backend {
|
||||
server ${PEERTUBE_HOST};
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name ${WEBSERVER_HOST};
|
||||
|
||||
access_log /var/log/nginx/peertube.access.log; # reduce I/0 with buffer=10m flush=5m
|
||||
error_log /var/log/nginx/peertube.error.log;
|
||||
|
||||
##
|
||||
# Certificates
|
||||
# you need a certificate to run in production. see https://letsencrypt.org/
|
||||
##
|
||||
ssl_certificate /etc/letsencrypt/live/${WEBSERVER_HOST}/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/${WEBSERVER_HOST}/privkey.pem;
|
||||
|
||||
location ^~ '/.well-known/acme-challenge' {
|
||||
default_type "text/plain";
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
##
|
||||
# Security hardening (as of Nov 15, 2020)
|
||||
# based on Mozilla Guideline v5.6
|
||||
##
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256; # add ECDHE-RSA-AES256-SHA if you want compatibility with Android 4
|
||||
ssl_session_timeout 1d; # defaults to 5m
|
||||
ssl_session_cache shared:SSL:10m; # estimated to 40k sessions
|
||||
ssl_session_tickets off;
|
||||
# HSTS (https://hstspreload.org), requires to be copied in 'location' sections that have add_header directives
|
||||
#add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
|
||||
|
||||
##
|
||||
# Application
|
||||
##
|
||||
|
||||
location @api {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host; # Use $http_host if you use a non standard HTTP port
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
client_max_body_size 100k; # default is 1M
|
||||
|
||||
proxy_connect_timeout 10m;
|
||||
proxy_send_timeout 10m;
|
||||
proxy_read_timeout 10m;
|
||||
send_timeout 10m;
|
||||
|
||||
proxy_pass http://backend;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/videos/(upload-resumable|([^/]+/source/replace-resumable))$ {
|
||||
client_max_body_size 0;
|
||||
proxy_request_buffering off;
|
||||
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/users/[^/]+/imports/import-resumable$ {
|
||||
client_max_body_size 0;
|
||||
proxy_request_buffering off;
|
||||
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ {
|
||||
limit_except POST HEAD { deny all; }
|
||||
|
||||
# This is the maximum upload size, which roughly matches the maximum size of a video file.
|
||||
# Note that temporary space is needed equal to the total size of all concurrent uploads.
|
||||
# This data gets stored in /var/lib/nginx by default, so you may want to put this directory
|
||||
# on a dedicated filesystem.
|
||||
client_max_body_size 12G; # default is 1M
|
||||
add_header X-File-Maximum-Size 8G always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
|
||||
proxy_request_buffering off;
|
||||
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/runners/jobs/[^/]+/(update|success)$ {
|
||||
client_max_body_size 0;
|
||||
proxy_request_buffering off;
|
||||
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
location ~ ^/api/v1/(videos|video-playlists|video-channels|users/me) {
|
||||
client_max_body_size 12M; # default is 1M
|
||||
add_header X-File-Maximum-Size 8M always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
|
||||
|
||||
try_files /dev/null @api;
|
||||
}
|
||||
|
||||
##
|
||||
# Websocket
|
||||
##
|
||||
|
||||
location @api_websocket {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host; # Use $http_host if you use a non standard HTTP port
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_pass http://backend;
|
||||
}
|
||||
|
||||
location /socket.io {
|
||||
try_files /dev/null @api_websocket;
|
||||
}
|
||||
|
||||
location /tracker/socket {
|
||||
# Peers send a message to the tracker every 15 minutes
|
||||
# Don't close the websocket before then
|
||||
proxy_read_timeout 15m; # default is 60s
|
||||
|
||||
try_files /dev/null @api_websocket;
|
||||
}
|
||||
|
||||
# Plugin websocket routes
|
||||
location ~ ^/plugins/[^/]+(/[^/]+)?/ws/ {
|
||||
try_files /dev/null @api_websocket;
|
||||
}
|
||||
|
||||
##
|
||||
# Performance optimizations
|
||||
# For extra performance please refer to https://github.com/denji/nginx-tuning
|
||||
##
|
||||
|
||||
root /var/www/peertube/storage;
|
||||
|
||||
# Enable compression for JS/CSS/HTML, for improved client load times.
|
||||
# It might be nice to compress JSON/XML as returned by the API, but
|
||||
# leaving that out to protect against potential BREACH attack.
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_types # text/html is always compressed by HttpGzipModule
|
||||
text/css
|
||||
application/javascript
|
||||
font/truetype
|
||||
font/opentype
|
||||
application/vnd.ms-fontobject
|
||||
image/svg+xml
|
||||
application/xml;
|
||||
gzip_min_length 1000; # default is 20 bytes
|
||||
gzip_buffers 16 8k;
|
||||
gzip_comp_level 2; # default is 1
|
||||
|
||||
client_body_timeout 30s; # default is 60
|
||||
client_header_timeout 10s; # default is 60
|
||||
send_timeout 10s; # default is 60
|
||||
keepalive_timeout 10s; # default is 75
|
||||
resolver_timeout 10s; # default is 30
|
||||
reset_timedout_connection on;
|
||||
proxy_ignore_client_abort on;
|
||||
|
||||
tcp_nopush on; # send headers in one piece
|
||||
tcp_nodelay on; # don't buffer data sent, good for small data bursts in real time
|
||||
|
||||
# If you have a small /var/lib partition, it could be interesting to store temp nginx uploads in a different place
|
||||
# See https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_temp_path
|
||||
#client_body_temp_path /var/www/peertube/storage/nginx/;
|
||||
|
||||
# Bypass PeerTube for performance reasons. Optional.
|
||||
# Should be consistent with client-overrides assets list in client.ts server controller
|
||||
location ~ ^/client/(assets/images/(default-playlist\.jpg|default-avatar-account\.png|default-avatar-account-48x48\.png|default-avatar-video-channel\.png|default-avatar-video-channel-48x48\.png))$ {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable"; # Cache 1 year
|
||||
|
||||
root /var/www/peertube;
|
||||
|
||||
try_files /storage/client-overrides/$1 /peertube-latest/client/dist/$1 @api;
|
||||
}
|
||||
|
||||
# Bypass PeerTube for performance reasons. Optional.
|
||||
location ~ ^/client/(.*\.(js|css|png|svg|woff2|otf|ttf|woff|eot))$ {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable"; # Cache 1 year
|
||||
|
||||
alias /var/www/peertube/peertube-latest/client/dist/$1;
|
||||
}
|
||||
|
||||
location ~ ^(/static/(webseed|web-videos|streaming-playlists/hls)/private/)|^/download {
|
||||
# We can't rate limit a try_files directive, so we need to duplicate @api
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host; # Use $http_host if you use a non standard HTTP port
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
proxy_limit_rate 5M;
|
||||
|
||||
proxy_pass http://backend;
|
||||
}
|
||||
|
||||
# Bypass PeerTube for performance reasons. Optional.
|
||||
location ~ ^/static/(webseed|web-videos|redundancy|streaming-playlists)/ {
|
||||
limit_rate_after 5M;
|
||||
|
||||
set $peertube_limit_rate 5M;
|
||||
|
||||
# Use this line with nginx >= 1.17.0
|
||||
limit_rate $peertube_limit_rate;
|
||||
# Or this line with nginx < 1.17.0
|
||||
# set $limit_rate $peertube_limit_rate;
|
||||
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header Access-Control-Allow-Origin '*';
|
||||
add_header Access-Control-Allow-Methods 'GET, OPTIONS';
|
||||
add_header Access-Control-Allow-Headers 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
add_header Access-Control-Max-Age 1728000; # Preflight request can be cached 20 days
|
||||
add_header Content-Type 'text/plain; charset=UTF-8';
|
||||
add_header Content-Length 0;
|
||||
return 204;
|
||||
}
|
||||
|
||||
if ($request_method = 'GET') {
|
||||
add_header Access-Control-Allow-Origin '*';
|
||||
add_header Access-Control-Allow-Methods 'GET, OPTIONS';
|
||||
add_header Access-Control-Allow-Headers 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
}
|
||||
|
||||
# Enabling the sendfile directive eliminates the step of copying the data into the buffer
|
||||
# and enables direct copying data from one file descriptor to another.
|
||||
sendfile on;
|
||||
sendfile_max_chunk 1M; # prevent one fast connection from entirely occupying the worker process. should be > 800k.
|
||||
aio threads;
|
||||
|
||||
# web-videos is the name of the directory mapped to the `storage.web_videos` key in your PeerTube configuration
|
||||
rewrite ^/static/webseed/(.*)$ /web-videos/$1 break;
|
||||
rewrite ^/static/(.*)$ /$1 break;
|
||||
|
||||
try_files $uri @api;
|
||||
}
|
||||
}
|
||||
121
support/openapi/go/README.mustache
Normal file
121
support/openapi/go/README.mustache
Normal file
@@ -0,0 +1,121 @@
|
||||
# Go API client for {{appName}}
|
||||
|
||||
This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html),
|
||||
using the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: {{appVersion}}
|
||||
- Package version: {{packageVersion}}
|
||||
{{^hideGenerationTimestamp}}
|
||||
- Build date: {{generatedDate}}
|
||||
{{/hideGenerationTimestamp}}
|
||||
- Build package: {{generatorClass}}
|
||||
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
## Installation
|
||||
|
||||
Install the following dependencies:
|
||||
|
||||
```shell
|
||||
go get github.com/stretchr/testify/assert
|
||||
go get golang.org/x/oauth2
|
||||
go get golang.org/x/net/context
|
||||
go get github.com/antihax/optional
|
||||
```
|
||||
|
||||
Put the package under your project folder and add the following in import:
|
||||
|
||||
```golang
|
||||
import "./{{packageName}}"
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
{{^authMethods}} Endpoints do not require authorization.
|
||||
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
||||
{{#authMethods}}
|
||||
|
||||
## {{{name}}}
|
||||
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
|
||||
Example
|
||||
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
|
||||
Key: "APIKEY",
|
||||
Prefix: "Bearer", // Omit if not necessary.
|
||||
})
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
|
||||
Example
|
||||
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
||||
UserName: "username",
|
||||
Password: "password",
|
||||
})
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: {{{flow}}}
|
||||
- **Authorization URL**: {{{authorizationUrl}}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - **{{{scope}}}**: {{{description}}}
|
||||
{{/scopes}}
|
||||
|
||||
Example
|
||||
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
|
||||
|
||||
```golang
|
||||
import "golang.org/x/oauth2"
|
||||
|
||||
/* Perform OAuth2 round trip request and obtain a token */
|
||||
|
||||
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
|
||||
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
|
||||
## License
|
||||
|
||||
Copyright (C) 2015-2020 PeerTube Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses.
|
||||
4
support/openapi/go/def.yaml
Normal file
4
support/openapi/go/def.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
# https://openapi-generator.tech/docs/generators/go
|
||||
|
||||
packageName: peertube
|
||||
enumClassPrefix: "true"
|
||||
97
support/openapi/kotlin/README.mustache
Normal file
97
support/openapi/kotlin/README.mustache
Normal file
@@ -0,0 +1,97 @@
|
||||
# Kotlin API client for {{appName}}
|
||||
|
||||
## Requires
|
||||
|
||||
{{#jvm}}
|
||||
* Kotlin 1.3.41
|
||||
* Gradle 4.9
|
||||
{{/jvm}}
|
||||
{{#multiplatform}}
|
||||
* Kotlin 1.3.50
|
||||
{{/multiplatform}}
|
||||
|
||||
## Build
|
||||
|
||||
{{#jvm}}
|
||||
First, create the gradle wrapper script:
|
||||
|
||||
```
|
||||
gradle wrapper
|
||||
```
|
||||
|
||||
Then, run:
|
||||
|
||||
{{/jvm}}
|
||||
```
|
||||
./gradlew check assemble
|
||||
```
|
||||
|
||||
This runs all tests and packages the library.
|
||||
|
||||
## Features/Implementation Notes
|
||||
|
||||
{{#generateApiDocs}}
|
||||
<a name="documentation-for-api-endpoints"></a>
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *{{{basePath}}}*. Change it when instantiating `ApiClient(basePath)`.
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
{{/generateApiDocs}}
|
||||
|
||||
{{#generateModelDocs}}
|
||||
<a name="documentation-for-models"></a>
|
||||
## Documentation for Models
|
||||
|
||||
{{#modelPackage}}
|
||||
{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
|
||||
{{/model}}{{/models}}
|
||||
{{/modelPackage}}
|
||||
{{^modelPackage}}
|
||||
No model defined in this package
|
||||
{{/modelPackage}}
|
||||
{{/generateModelDocs}}
|
||||
|
||||
<a name="documentation-for-authorization"></a>{{! TODO: optional documentation for authorization? }}
|
||||
## Documentation for Authorization
|
||||
|
||||
{{^authMethods}}
|
||||
All endpoints do not require authorization.
|
||||
{{/authMethods}}
|
||||
{{#authMethods}}
|
||||
{{#last}}
|
||||
Authentication schemes defined for the API:
|
||||
{{/last}}
|
||||
{{/authMethods}}
|
||||
{{#authMethods}}
|
||||
<a name="{{name}}"></a>
|
||||
### {{name}}
|
||||
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
- **API key parameter name**: {{keyParamName}}
|
||||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}- **Type**: OAuth
|
||||
- **Flow**: {{flow}}
|
||||
- **Authorization URL**: {{authorizationUrl}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - {{scope}}: {{description}}
|
||||
{{/scopes}}
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/authMethods}}
|
||||
|
||||
## License
|
||||
|
||||
Copyright (C) 2015-2020 PeerTube Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses.
|
||||
6
support/openapi/kotlin/def.yaml
Normal file
6
support/openapi/kotlin/def.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
# https://openapi-generator.tech/docs/generators/kotlin
|
||||
|
||||
artifactId: peertube-api
|
||||
groupId: org.peertube
|
||||
packageName: org.peertube.client
|
||||
|
||||
47
support/openapi/python/README.mustache
Normal file
47
support/openapi/python/README.mustache
Normal file
@@ -0,0 +1,47 @@
|
||||
# Python API client for {{appName}}
|
||||
|
||||
This Python package is automatically generated from [PeerTube's REST API](https://docs.joinpeertube.org/api-rest-reference.html),
|
||||
using the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: {{appVersion}}
|
||||
- Package version: {{packageVersion}}
|
||||
{{^hideGenerationTimestamp}}
|
||||
- Build date: {{generatedDate}}
|
||||
{{/hideGenerationTimestamp}}
|
||||
- Build package: {{generatorClass}}
|
||||
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
## Requirements.
|
||||
|
||||
Python 2.7 and 3.4+
|
||||
|
||||
## Installation & Usage
|
||||
|
||||
```sh
|
||||
pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git
|
||||
```
|
||||
(you may need to run `pip` with root permission: `sudo pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git`)
|
||||
|
||||
Then import the package:
|
||||
```python
|
||||
import {{{packageName}}}
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
|
||||
{{> common_README }}
|
||||
|
||||
## License
|
||||
|
||||
Copyright (C) 2015-2020 PeerTube Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses.
|
||||
5
support/openapi/python/def.yaml
Normal file
5
support/openapi/python/def.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
# https://openapi-generator.tech/docs/generators/python
|
||||
|
||||
packageName: peertube
|
||||
projectName: peertube
|
||||
|
||||
9
support/sysctl.d/30-peertube-tcp.conf
Normal file
9
support/sysctl.d/30-peertube-tcp.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
# In a video server, we are often sending files to a client
|
||||
# which can't accept it as fast as our local network connection
|
||||
# could produce packets. To prevent packet loss and buffer bloat,
|
||||
# it's especially important to use a modern CoDel scheduler which
|
||||
# knows how to delay outgoing packets to match slower client links.
|
||||
|
||||
net.core.default_qdisc = fq_codel
|
||||
net.ipv4.tcp_congestion_control = bbr
|
||||
|
||||
33
support/systemd/peertube.service
Normal file
33
support/systemd/peertube.service
Normal file
@@ -0,0 +1,33 @@
|
||||
[Unit]
|
||||
Description=PeerTube daemon
|
||||
After=network.target postgresql.service redis-server.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=NODE_ENV=production
|
||||
Environment=NODE_CONFIG_DIR=/var/www/peertube/config
|
||||
User=peertube
|
||||
Group=peertube
|
||||
ExecStart=/usr/bin/node dist/server
|
||||
WorkingDirectory=/var/www/peertube/peertube-latest
|
||||
SyslogIdentifier=peertube
|
||||
Restart=always
|
||||
|
||||
; Some security directives.
|
||||
; Mount /usr, /boot, and /etc as read-only for processes invoked by this service.
|
||||
ProtectSystem=full
|
||||
; Sets up a new /dev mount for the process and only adds API pseudo devices
|
||||
; like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled
|
||||
; by default because it may not work on devices like the Raspberry Pi.
|
||||
PrivateDevices=false
|
||||
; Ensures that the service process and all its children can never gain new
|
||||
; privileges through execve().
|
||||
NoNewPrivileges=true
|
||||
; This makes /home, /root, and /run/user inaccessible and empty for processes invoked
|
||||
; by this unit. Make sure that you do not depend on data inside these folders.
|
||||
ProtectHome=true
|
||||
; Drops the sys admin capability from the daemon.
|
||||
CapabilityBoundingSet=~CAP_SYS_ADMIN
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user