Addec CF docs

This commit is contained in:
florian 2023-07-07 22:46:50 +02:00
parent 6d71fdc362
commit 442bf63a00
6 changed files with 40 additions and 5 deletions

View File

@ -17,12 +17,26 @@ any S3 compatible hosting service can be used.
1. First set up a Cloudflare Bucket, e.g. `streams`
2. Make the bucket publicly accessible, by connecting a domain name
![](docs/public.png)
3. When you have connected a domain name (and the proxy setting is selected in CloudFlare) the access is automatically cached by the CDN.
4. Set the CORS settings of the bucket to allow any client, i.e. host `*`
![](docs/cors.png)
5. Configure cache rules, to allow / prevent caching
![](docs/cache1.png)
![](docs/cache2.png)
![](docs/cache3.png)
6. Create an API key for with read/write access to your buckets.
## Environment
Create a `.env` file based on `.env.sample` with the S3 credentials
The S3 credentials need to be given as environment settings
* Endpoint for S3-compatible storage. Cloudflare uses an endpoint that contains the account ID.
```
@ -43,12 +57,31 @@ Build the docker image
docker build -t srs-s3 .
```
With the current setup the environment files `conf/mysrs.conf` and `.env` are copied into
the docker container. Thats why it is needed to build the docker from source.
The current srs setup in the environment file `conf/mysrs.conf` is copied into
the docker container and currently not changeable at runtime.
Run the docker image with the rtmp port accessible
Environment settings that are visible in the `.env.sample` are configurable at runtime
through the docker environment or through a file called `.env`.
Run the docker image with the rtmp port accessible, for single testing in the foreground:
```
docker run -p 1935:1935 -it --rm srs-s3
docker run -p 1935:1935 -it --rm \
-e "S3_ENDPOINT=https://xxxxxxxxxxxxxxxxxxxx.r2.cloudflarestorage.com" \
-e "S3_ACCESS_KEY_ID=xxxxxxxxxx" \
-e "S3_ACCESS_KEY_SECRET=xxxxxxxxxx" \
-e "S3_BUCKET_NAME=stream" \
srs-s3
```
or as a background process:
```
docker run --name srs-s3-upload -d -p 1935:1935 \
-e "S3_ENDPOINT=https://xxxxxxxxxxxxxxxxxxxx.r2.cloudflarestorage.com" \
-e "S3_ACCESS_KEY_ID=xxxxxxxxxx" \
-e "S3_ACCESS_KEY_SECRET=xxxxxxxxxx" \
-e "S3_BUCKET_NAME=stream" \
srs-s3
```
In a streaming application use the following settings, assuming the docker image is run on the local machine:
@ -58,6 +91,8 @@ In a streaming application use the following settings, assuming the docker image
When you start the stream, you will see the HLS data being uploaded to the S3 storage bucket. The stream will be accessible from the URL: `https://your.domain/123456/stream.m3u8`
The directory in the S3 bucket will be created based on the stream key. It is recommended to change the stream key for each stream.
# Known Limitations
* Currently only streams with 1 camera and 1 format are supported.

BIN
docs/cache1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
docs/cache2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

BIN
docs/cache3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

BIN
docs/cors.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
docs/public.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB