Verified Commit 28c9f122 authored by Jelle Besseling's avatar Jelle Besseling Committed by Chocobozzz
Browse files

Update admin-remote-storage.md

parent aac369b1
......@@ -7,7 +7,7 @@ for s3 storage, otherwise you can still follow the documentation for the
## Native object storage
If your object storage provider supports the AWS s3 API, you can configure your
If your object storage provider supports the AWS S3 API, you can configure your
instance to move files there after transcoding. The bucket you configure should
be public and have CORS rules to allow traffic from anywhere.
......@@ -15,27 +15,116 @@ Here are two examples on how you can configure your instance:
```yaml
# Store all videos in one bucket on Backblaze b2
s3:
object_storage:
enabled: true
# Example Backblaze b2 endpoint
endpoint: 's3.us-west-001.backblazeb2.com'
videos_bucket: 'peertube-videos'
videos_prefix: 'videos/'
videos:
bucket_name: 'peertube-videos'
prefix: 'videos/'
# Use the same bucket as for webtorrent videos but with a different prefix
streaming_playlists_bucket: 'peertube-videos'
streaming_playlists_prefix: 'streaming-playlists/'
streaming_playlists:
bucket_name: 'peertube-videos'
prefix: 'streaming-playlists/'
```
```yaml
# Use two differnt bucketss for webtorrent and HLS videos
s3:
# Use two different buckets for webtorrent and HLS videos on AWS S3
object_storage:
enabled: true
# Example AWS endpoint in the us-east-1 region
# The region specific endpoint is required for correct url generation
endpoint: 's3.us-east-1.amazonaws.com'
videos_bucket: 'webtorrent-videos'
videos_prefix: ''
streaming_playlists_bucket: 'hls-videos'
streaming_playlists_prefix: ''
# Needs to be set to the bucket region when using AWS S3
region: 'us-east-1'
videos:
bucket_name: 'webtorrent-videos'
prefix: ''
streaming_playlists:
bucket_name: 'hls-videos'
prefix: ''
```
You will also need to supply credentials to the S3 client. The official AWS
S3 library is used in PeerTube, which supports multiple [credential loading methods](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html).
If you set the credentials in the configuration file, this will override
credentials from the environment or a `~/.aws/credentials` file. When loading
from the environment, the usual `AWS_ACCESS_KEY_ID` and `AWS_ACCESS_KEY_ID`
variables are used.
If you have trouble with uploads to object storing failing, you can try lowering
the part size. `object_storage.max_upload_part` is set to `2GB` by default, you can
try experimenting with this value to optimize uploading. Multiple uploads can happen
in parallel, but for one video the parts are uploaded sequentially.
### CORS settings
Because the browser will load the objects from object storage from a different URL than
the local PeerTube instance, cross-origin resource sharing rules apply.
You can solve this either by loading the objects through some kind of caching CDN
that you give access and setting `object_storage.{streaming_playlists,videos}.base_url`
to that caching server, or by allowing access from all origins.
Allowing access from all origins on AWS S3 can be done in the permissions
tab of your bucket settings. You can set the policy to this for example:
```json
[
{
"AllowedHeaders": [
"range"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]
```
Backblaze B2 has a similar setting, you can set it via the b2 command
line tool:
```bash
b2 update-bucket --corsRules '[
{
"allowedHeaders": [
"range"
],
"allowedOperations": [
"b2_download_file_by_id",
"b2_download_file_by_name"
],
"allowedOrigins": [
"*"
],
"corsRuleName": "downloadFromAnyOrigin",
"exposeHeaders": null,
"maxAgeSeconds": 3600
},
{
"allowedHeaders": [
"range"
],
"allowedOperations": [
"s3_head",
"s3_get"
],
"allowedOrigins": [
"*"
],
"corsRuleName": "s3DownloadFromAnyOrigin",
"exposeHeaders": null,
"maxAgeSeconds": 3600
}
]' bucketname allPublic
```
## Old method
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment