Improve tools doc using code blocks

See the result on https://docs.joinpeertube.org/maintain/tools
pull/6026/head
Chocobozzz 2023-11-08 15:25:17 +01:00
parent dbb54df6bd
commit ae16f5f115
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 149 additions and 86 deletions

View File

@ -192,141 +192,181 @@ They must be run on the server, in `peertube-latest` directory.
To parse PeerTube last log file: To parse PeerTube last log file:
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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 sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run parse-log -- --level info
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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` `--level` is optional and could be `info`/`warn`/`error`
You can also remove SQL or HTTP logs using `--not-tags` (PeerTube >= 3.2): You can also remove SQL or HTTP logs using `--not-tags` (PeerTube >= 3.2):
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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 sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run parse-log -- --level debug --not-tags http sql
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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 ### Regenerate video thumbnails
Regenerating local video thumbnails could be useful because new PeerTube releases may increase thumbnail sizes: Regenerating local video thumbnails could be useful because new PeerTube releases may increase thumbnail sizes:
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest cd /var/www/peertube/peertube-latest
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run regenerate-thumbnails sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run regenerate-thumbnails
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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 ### 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 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. 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.
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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] sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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 ### Move video files from filesystem to object storage
Use this script to move all video files or a specific video file to object storage. Use this script to move all video files or a specific video file to object storage.
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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] 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]
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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: The script can also move all video files that are not already in object storage:
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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 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
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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 ### Move video files from object storage to filesystem
**PeerTube >= 6.0** **PeerTube >= 6.0**
Use this script to move all video files or a specific video file from object storage to the PeerTube instance filesystem. Use this script to move all video files or a specific video file from object storage to the PeerTube instance filesystem.
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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] 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]
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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: The script can also move all video files that are not already on the filesystem:
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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 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
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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
```
:::
### Generate storyboard ### Generate storyboard
**PeerTube >= 6.0** **PeerTube >= 6.0**
Use this script to generate storyboard of a specific video: Use this script to generate storyboard of a specific video:
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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] sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-generate-storyboard-job -- -v [videoUUID]
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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: The script can also generate all missing storyboards of local videos:
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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 sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run create-generate-storyboard-job -- --all-videos
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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 storage ### Prune filesystem storage
Some transcoded videos or shutdown at a bad time can leave some unused files on your storage. Some transcoded videos or shutdown at a bad time can leave some unused files on your storage.
@ -344,30 +384,38 @@ 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 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). to run the command below (keep in mind your follower instances will NOT update their URLs).
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest cd /var/www/peertube/peertube-latest
sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-host sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run update-host
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube npm run update-host
``` ```
```bash [Docker]
cd /var/www/peertube-docker
docker compose exec -u peertube peertube npm run update-host
```
:::
### Reset user password ### Reset user password
To reset a user password from CLI, run: To reset a user password from CLI, run:
```bash ::: code-group
# Basic installation
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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 sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u target_username
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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 ### Install or uninstall plugins
@ -376,33 +424,48 @@ If PeerTube is running, you need to restart it for the changes to take effect (w
To install/update a plugin or a theme from the disk: To install/update a plugin or a theme from the disk:
```bash ::: code-group
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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 sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run plugin:install -- --plugin-path /local/plugin/path
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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: From NPM:
::: code-group
```bash ```bash
cd /var/www/peertube/peertube-latest 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 sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-myplugin
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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: To uninstall a plugin or a theme:
```bash ::: code-group
```bash [Classic installation]
cd /var/www/peertube/peertube-latest 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 sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run plugin:uninstall -- --npm-name peertube-plugin-myplugin
# Docker installation
cd /var/www/peertube-docker
docker-compose exec -u peertube peertube 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
```
:::