はじまりの大地

このコミットが含まれているのは:
2024-07-15 09:14:04 +09:00
コミット 6632905f32
3501個のファイルの変更1439465行の追加0行の削除
+330
ファイルの表示
@@ -0,0 +1,330 @@
# 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 Yarn with:
```
yarn add @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.
### 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 an the player is ready.
## Embed methods
### `play() : Promise<void>`
Starts playback, or resumes playback if it is paused.
### `pause() : Promise<void>`
Pauses playback.
### `seek(positionInSeconds : number)`
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.
ファイル差分が大きすぎるため省略します 差分を読込み
+72
ファイルの表示
@@ -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.
+607
ファイルの表示
@@ -0,0 +1,607 @@
# Dependencies
:warning: **Warning**: dependencies guide is maintained by the community. Some parts may be outdated! :warning:
Main dependencies supported by PeerTube:
* `node` >=18.x
* `yarn` 1.x (**must not be >=2.x**)
* `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.x
* `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.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Debian / Ubuntu and derivatives](#debian-ubuntu-and-derivatives)
- [Arch Linux](#arch-linux)
- [CentOS 7](#centos-7)
- [Centos 8](#centos-8)
- [Rocky Linux 8.4](#rocky-linux-84)
- [Fedora](#fedora)
- [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
- [FreeBSD](#freebsd)
- [macOS](#macos)
- [Gentoo](#gentoo)
- [OpenBSD](#openbsd)
- [Other distributions](#other-distributions)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Debian / Ubuntu and derivatives
1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
```
# apt-get install curl sudo unzip vim
```
2. 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).
3. Install NodeJS 18.x:
[https://nodejs.org/en/download/package-manager/all#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/all#debian-and-ubuntu-based-linux-distributions)
4. 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)
5. Install Python:
On Ubuntu >= focal (20.04 LTS) or Debian >= Bullseye:
```
sudo apt update
sudo apt install python3-dev python3-pip python-is-python3
python --version # Should be >= 3.x
```
6. Install common dependencies:
```
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:
```
sudo systemctl start redis postgresql
```
## Arch Linux
1. Run:
```
sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python python-pip base-devel npm nginx
```
Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
```
sudo systemctl start redis postgresql
```
## CentOS 7
1. Install NodeJS 18.x:
[https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux](https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux)
2. Install yarn:
[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
3. 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)
4. Install Packages:
```
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
```
5. You need to use a more up to date version of G++ in order to run the yarn install command, hence the installation of devtoolset-7.
```
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:
```
sudo -H -u peertube CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ yarn install --production --pure-lockfile
```
6. Initialize the PostgreSQL database:
```
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:
```
sudo systemctl enable --now redis
sudo systemctl enable --now postgresql
```
## Centos 8
1. Install NodeJS 18.x:
[https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux](https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux)
2. Install yarn:
[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
3. Install or compile ffmpeg:
```
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
```
4. Install packages:
```
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
```
5. You'll need a symlink for python3 to python for youtube-dl to work
```
sudo ln -s /usr/bin/python3 /usr/bin/python
```
6. Initialize the PostgreSQL database:
```
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:
```
sudo systemctl enable --now redis
sudo systemctl enable --now postgresql
```
## Rocky Linux 8.4
1. Pull the latest updates:
```
sudo dnf update -y
```
2. Install NodeJS 18.x:
```
sudo dnf module install -y nodejs:18
```
3. Install yarn:
```
sudo npm install --global yarn
```
4. Install or compile ffmpeg (if you want to compile... enjoy):
```
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
```
5. Install PostgreSQL and Python3 and other stuff:
```
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
```
6. Configure the peertube user:
```
sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
```
7. 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:
```
dnf upgrade
```
2. Add a user with sudoers group access:
```
useradd my-peertube-user
passwd my-peertube-user
usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
su my-peertube-user
```
3. (Optional) Install certbot (choose instructions for your distribution):
[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
4. Install NodeJS 18.x:
[https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux](https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux)
5. Install yarn:
[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
```
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.
7. Run:
```
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
```
8. Configure nginx
```
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
```
9. 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.
```
# 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
```
10. Firewall
By default, you cannot access your server via public IP. To do so, you must configure firewall:
- Ports used by peertube dev setup:
```
sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
```
- Optional
```
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
```
- Reload firewall
```
sudo firewall-cmd --reload
```
11. Configure max ports
This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
```
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).
```
# subscription-manager register --username <username> --password <password> --auto-attach
# dnf upgrade
# reboot
```
2. Install Node.JS
```
sudo dnf module install nodejs:18
```
3. Install Yarn
```
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo dnf install yarn
```
4. Install FFmpeg
```
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
```
5. Run:
```
sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
```
6. You'll need a symlink for python3 to python for youtube-dl to work
```
sudo alternatives --set python3 /usr/bin/python
```
7. Initialize the PostgreSQL database:
```
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:
```
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:
8. Configure nginx
```
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
```
9. Prepare directory
To add the 'peertube' user, you first have to create the 'www' folder and once the 'peertube' user is added, you have to set the access permissions.
```
sudo mkdir /var/www
sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
sudo passwd peertube
sudo chmod 755 /var/www/peertube/
```
10. Firewall
By default, you cannot access your server via public IP. To do so, you must configure firewall:
- Ports used by peertube dev setup:
```
sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
```
- Optional
```
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
```
- Reload firewall
```
sudo firewall-cmd --reload
```
11. Configure max ports
This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
```
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):
```
pkg
pkg update
pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
```
2. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
```
# visudo
```
Uncomment the line 90
```
%wheel ALL=(ALL) ALL
```
3. Enable nginx, redis, postgresql services and initialize database.
```
sysrc postgresql_enable="YES"
sysrc redis_enable="YES"
sysrc nginx_enable="YES"
```
Initialize database and start services
```
service postgresql initdb
service postgresql start
service redis start
service nginx start
```
## macOS
1. Add the packages:
```sh
brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
```
You may need to update your default version of bash.
**How to change your default shell**
```sh
which -a bash # Check where bash is installed
bash --version # You need a version at least as recent as 4.0
sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
```
In a new shell, type `bash --version` to assert your changes took effect and
correctly modified your default bash version.
2. 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
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 Lets Encrypt:
# app-crypt/certbot
```
2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
```
mkdir -p /etc/portage/package.keywords
cat << EOF >> /etc/portage/package.keywords/peertube
# required by yarn (argument) for PeerTube
sys-apps/yarn ~amd64
EOF
```
3. Compile the peertube set:
```
emerge -a @peertube
```
4. Initialize the PostgreSQL database if you just merged it:
```
emerge --config postgresql
```
5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
```
rc-update add redis
rc-update add postgresql-11
rc-service redis start
rc-service postgresql-11 start
```
6. Create Python version symlink for youtube-dl:
```
emerge -1 python-exec
```
## OpenBSD
1. Install Packages:
```
pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
```
2. Install yarn:
```
npm install --global yarn
```
3. Allow users in the wheel group to use sudo
```
visudo
```
Uncomment line #43:
```
%wheel ALL=(ALL) ALL
```
4. Enable services:
```
rcctl enable postgresql redis nginx
```
## Other distributions
Feel free to update this file in a pull request!
+40
ファイルの表示
@@ -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
ファイルの表示
@@ -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
ファイルの表示
@@ -0,0 +1,35 @@
# Application localization documentation
Source files are in `client/src/locale` and translated files merged from [Weblate](https://weblate.framasoft.org/translate/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
ファイルの表示
@@ -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
ファイルの表示
@@ -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 -r ./node_modules && yarn install --pure-lockfile && npm run build:server
NODE_APP_INSTANCE=6 NODE_ENV=test node dist/server --benchmark-startup
git checkout develop && rm -r ./node_modules && yarn install --pure-lockfile && 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 && yarn install --pure-lockfile && 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
ファイルの表示
@@ -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`
+127
ファイルの表示
@@ -0,0 +1,127 @@
# 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
```
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:
* `DISABLE_HTTP_IMPORT_TESTS=true`: disable import tests (because of youtube that could rate limit your 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
* `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)
* `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
### 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
```
+180
ファイルの表示
@@ -0,0 +1,180 @@
# 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
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
```
## Build
### Production
```shell
git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
cd /tmp/peertube
docker build . -f ./support/docker/production/Dockerfile.bookworm
```
### Development
We don't have a Docker image for development. See [the CONTRIBUTING guide](https://github.com/Chocobozzz/PeerTube/blob/develop/.github/CONTRIBUTING.md#develop) for more information on how you can hack PeerTube!
ファイル差分が大きすぎるため省略します 差分を読込み
+415
ファイルの表示
@@ -0,0 +1,415 @@
# 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:
```bash
sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
```
Set its password:
```bash
sudo passwd peertube
```
Ensure the peertube root directory is traversable by nginx:
```bash
ls -ld /var/www/peertube # Should be drwxr-xr-x
```
**On FreeBSD**
```bash
sudo pw useradd -n peertube -d /var/www/peertube -s /usr/local/bin/bash -m
sudo passwd peertube
```
or use `adduser` to create it interactively.
### :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 yarn install --production --pure-lockfile
```
### :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 reload nginx
```
Certbot should have installed a cron to automatically renew your certificate.
Since our nginx template supports webroot renewal, we suggest you to update the renewal config file to use the `webroot` authenticator:
```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/
```
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 && 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 yarn cache clean` 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 yarn install --production --pure-lockfile
```
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
Check for configuration changes, and report them in your `config/production.yaml` file:
```bash
cd /var/www/peertube/versions
diff -u "$(ls -t | head -2 | tail -1)/config/production.yaml.example" "$(ls -t | head -1)/config/production.yaml.example"
```
### 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"
```
### 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-2018-01-19T10:18+01:00.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 postgres "$SQL_BACKUP_PATH" && \
sudo systemctl restart peertube
```
+659
ファイルの表示
@@ -0,0 +1,659 @@
# 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 >= 16.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'
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>
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.
### Runner installation
Ensure you have `node`, `ffmpeg` and `ffprobe` installed on your system:
```bash
node --version # Should be >= 16.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`.
### 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
```
#### 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 /bin/bash -p prunner 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
```
:::
### 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:
```bash
# Update the package
sudo npm update -g @peertube/peertube-runner
# Check that the version changed (optional)
sudo npm list -g @peertube/peertube-runner
# Restart the service (if you are using systemd)
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` (PeerTube >= 3.2):
::: 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 all video files or a specific video file 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 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 all video files or a specific video file 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 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).
PeerTube must be stopped.
::: 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:
```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):
```bash
cd /var/www/peertube/peertube-latest
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production 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
```
:::
+63
ファイルの表示
@@ -0,0 +1,63 @@
# 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 setup your account
* Go to the PeerTube page https://weblate.framasoft.org/projects/peertube/
* 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 (privacies, licences...) and iso639 (languages) strings used by PeerTube to describe the audio language of a particular video.
It's the reason why these strings should be translated too. There are many strings so do not hesitate to translate only main audio languages.
## 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
ファイルの表示
@@ -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
ファイルの表示
@@ -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;
+58
ファイルの表示
@@ -0,0 +1,58 @@
# Database / Postgres service configuration
POSTGRES_USER=<MY POSTGRES USERNAME>
POSTGRES_PASSWORD=<MY POSTGRES PASSWORD>
# 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=<MY POSTGRES DB NAME>
#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 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
PEERTUBE_WEBSERVER_HOSTNAME=<MY DOMAIN>
# 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=<MY PEERTUBE SECRET>
# 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@<MY DOMAIN>
PEERTUBE_SMTP_TLS=false
PEERTUBE_SMTP_DISABLE_STARTTLS=false
PEERTUBE_ADMIN_EMAIL=<MY EMAIL ADDRESS>
# Postfix service configuration
POSTFIX_myhostname=<MY DOMAIN>
# If you need to generate a list of sub/DOMAIN keys
# pass them as a whitespace separated string <DOMAIN>=<selector>
OPENDKIM_DOMAINS=<MY DOMAIN>=peertube
# see https://github.com/wader/postfix-relay/pull/18
OPENDKIM_RequireSafeKeys=no
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
ファイルの表示
@@ -0,0 +1,3 @@
data/
db/
redis/
+52
ファイルの表示
@@ -0,0 +1,52 @@
FROM node:18-bookworm-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 \
&& gosu nobody true \
&& rm /var/lib/apt/lists/* -fR
# Add peertube user
RUN groupadd -r peertube \
&& useradd -r -g peertube -m peertube
# Install PeerTube
COPY --chown=peertube:peertube . /app
WORKDIR /app
USER peertube
# Install manually client dependencies to apply our network timeout option
RUN if [ "${ALREADY_BUILT}" = 0 ]; then \
cd client && yarn install --pure-lockfile --network-timeout 1200000 && cd ../ \
&& yarn install --pure-lockfile --network-timeout 1200000 \
&& 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 \
&& NOCLIENT=1 yarn install --pure-lockfile --production --network-timeout 1200000 --network-concurrency 20 \
&& yarn cache clean
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 and RTMP
EXPOSE 9000 1935
# Run the application
CMD [ "node", "dist/server" ]
+8
ファイルの表示
@@ -0,0 +1,8 @@
FROM nginx:alpine
COPY ./support/docker/production/entrypoint.nginx.sh .
RUN chmod +x entrypoint.nginx.sh
EXPOSE 80 443
ENTRYPOINT []
CMD ["/bin/sh", "entrypoint.nginx.sh"]
+209
ファイルの表示
@@ -0,0 +1,209 @@
#
# 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"
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"
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"
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"
+88
ファイルの表示
@@ -0,0 +1,88 @@
listen:
hostname: '0.0.0.0'
port: 9000
# Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL)
webserver:
https: true
hostname: undefined
port: 443
rates_limit:
login:
# 15 attempts in 5 min
window: 5 minutes
max: 15
ask_send_email:
# 3 attempts in 5 min
window: 5 minutes
max: 3
# Proxies to trust to get real client IP
# If you run PeerTube just behind a local proxy (nginx), keep 'loopback'
# If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet)
trust_proxy:
- 'loopback'
- 'linklocal'
- 'uniquelocal'
# Your database name will be database.name OR 'peertube'+database.suffix
database:
hostname: 'postgres'
port: 5432
ssl: false
suffix: ''
username: 'postgres'
password: 'postgres'
# Redis server for short time storage
redis:
hostname: 'redis'
port: 6379
auth: null
# From the project root directory
storage:
tmp: '../data/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...
tmp_persistent: '../data/tmp-persistent/' # As tmp but the directory is not cleaned up between PeerTube restarts
bin: '../data/bin/'
avatars: '../data/avatars/'
web_videos: '../data/web-videos/'
streaming_playlists: '../data/streaming-playlists'
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/'
well_known: '../data/well-known/'
# Overridable client files in client/dist/assets/images :
# - logo.svg
# - favicon.png
# - default-playlist.jpg
# - default-avatar-account.png
# - default-avatar-video-channel.png
# - and icons/*.png (PWA)
# Could contain for example assets/images/favicon.png
# If the file exists, peertube will serve it
# If not, peertube will fallback to the default fil
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' # 'debug' | 'info' | 'warn' | 'error'
tracker:
enabled: true
reject_too_many_announces: false # false because we have issues with docker ws ip/port forwarding
admin:
email: null
+100
ファイルの表示
@@ -0,0 +1,100 @@
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: 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
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
peertube:
# If you don't want to use the official image and build one from sources:
# build:
# context: .
# dockerfile: ./support/docker/production/Dockerfile.bookworm
image: chocobozzz/peertube:production-bookworm
# 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.18.0.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:13-alpine
env_file:
- .env
volumes:
- ./docker-volume/db:/var/lib/postgresql/data
restart: "always"
redis:
image: redis:6-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:
ipam:
driver: default
config:
- subnet: 172.18.0.0/16
volumes:
assets:
certbot-www:
+17
ファイルの表示
@@ -0,0 +1,17 @@
#!/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
while :; do
sleep 12h & wait $!;
nginx -s reload;
done &
nginx -g 'daemon off;'
+19
ファイルの表示
@@ -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
ファイルの表示
@@ -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"
+173
ファイルの表示
@@ -0,0 +1,173 @@
#!/bin/sh
APP_NAME="peertube"
USER="peertube"
GROUP="peertube"
NODE_ENV="production"
APP_DIR="/var/www/peertube/peertube-latest"
NODE_APP="dist/server"
KWARGS=""
CONFIG_DIR="/var/www/peertube/config"
PID_DIR="$APP_DIR/pid"
PID_FILE="$PID_DIR/$APP_NAME.pid"
LOG_DIR="/var/log/peertube"
LOG_FILE="$LOG_DIR/$APP_NAME.log"
NODE_EXEC=$(which node)
###############
# REDHAT chkconfig header
# chkconfig: - 58 74
# description: peertube service script.
### BEGIN INIT INFO
# Provides: peertube
# Required-Start: $network $remote_fs $local_fs
# Required-Stop: $network $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop peertube
# Description: Node process for peertube
### END INIT INFO
###############
USAGE="Usage: $0 {start|stop|restart|status} [--force]"
FORCE_OP=false
pid_file_exists() {
[ -f "$PID_FILE" ]
}
get_pid() {
echo "$(cat "$PID_FILE")"
}
is_running() {
PID="$(get_pid)"
[ -d /proc/$PID ]
}
start_it() {
mkdir -p "$PID_DIR"
chown $USER:$GROUP "$PID_DIR"
mkdir -p "$LOG_DIR"
chown $USER:$GROUP "$LOG_DIR"
echo "Starting $APP_NAME ..."
echo "cd $APP_DIR && NODE_ENV=$NODE_ENV NODE_CONFIG_DIR=$CONFIG_DIR $NODE_EXEC $APP_DIR/$NODE_APP $KWARGS 1>$LOG_FILE 2>&1 & echo \$! > $PID_FILE" | sudo -i -u $USER
echo "$APP_NAME started with pid $(get_pid)"
}
stop_process() {
PID=$(get_pid)
echo "Killing process $PID"
pkill -P $PID
}
remove_pid_file() {
echo "Removing pid file"
rm -f "$PID_FILE"
}
start_app() {
if pid_file_exists
then
if is_running
then
PID=$(get_pid)
echo "$APP_NAME already running with pid $PID"
exit 1
else
echo "$APP_NAME stopped, but pid file exists"
if [ $FORCE_OP = true ]
then
echo "Forcing start anyways"
remove_pid_file
start_it
fi
fi
else
start_it
fi
}
stop_app() {
if pid_file_exists
then
if is_running
then
echo "Stopping $APP_NAME ..."
stop_process
remove_pid_file
echo "$APP_NAME stopped"
else
echo "$APP_NAME already stopped, but pid file exists"
if [ $FORCE_OP = true ]
then
echo "Forcing stop anyways ..."
remove_pid_file
echo "$APP_NAME stopped"
else
exit 1
fi
fi
else
echo "$APP_NAME already stopped, pid file does not exist"
exit 1
fi
}
status_app() {
if pid_file_exists
then
if is_running
then
PID=$(get_pid)
echo "$APP_NAME running with pid $PID"
else
echo "$APP_NAME stopped, but pid file exists"
fi
else
echo "$APP_NAME stopped"
fi
}
case "$2" in
--force)
FORCE_OP=true
;;
"")
;;
*)
echo $USAGE
exit 1
;;
esac
case "$1" in
start)
start_app
;;
stop)
stop_app
;;
restart)
stop_app
start_app
;;
status)
status_app
;;
*)
echo $USAGE
exit 1
;;
esac
+263
ファイルの表示
@@ -0,0 +1,263 @@
# 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;
ssl_stapling on;
ssl_stapling_verify on;
# 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;
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)
try_files /dev/null @api;
}
location ~ ^/api/v1/runners/jobs/[^/]+/(update|success)$ {
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)
try_files /dev/null @api;
}
location ~ ^/api/v1/(videos|video-playlists|video-channels|users/me) {
client_max_body_size 6M; # default is 1M
add_header X-File-Maximum-Size 4M 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;
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;
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/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|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;
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';
# Don't spam access log file with byte range requests
access_log off;
}
# 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
ファイルの表示
@@ -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
ファイルの表示
@@ -0,0 +1,4 @@
# https://openapi-generator.tech/docs/generators/go
packageName: peertube
enumClassPrefix: "true"
+97
ファイルの表示
@@ -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
ファイルの表示
@@ -0,0 +1,6 @@
# https://openapi-generator.tech/docs/generators/kotlin
artifactId: peertube-api
groupId: org.peertube
packageName: org.peertube.client
+47
ファイルの表示
@@ -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
ファイルの表示
@@ -0,0 +1,5 @@
# https://openapi-generator.tech/docs/generators/python
packageName: peertube
projectName: peertube
+9
ファイルの表示
@@ -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
ファイルの表示
@@ -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