Skip to content

Commit fdc9fe2

Browse files
committed
update: update list env vars can be set for upload video
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 49eb45d commit fdc9fe2

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -687,17 +687,17 @@ services:
687687
`SE_VIDEO_FILE_NAME=auto` will use the session id as the video file name. This ensures that the video file name is unique to upload.
688688
Video file name construction automatically works based on Node endpoint `/status` (and optional GraphQL endpoint) to get session ID, capabilities.
689689

690-
| | Hub/Nodes | Standalone roles | Dynamic Grid |
690+
`SE_VIDEO_UPLOAD_ENABLED=true` will enable the video upload feature. In the background, it will create a pipefile with file and destination for uploader to consume and proceed.
691+
692+
`SE_VIDEO_INTERNAL_UPLOAD=true` will use RCLONE installed in the container for upload. If you want to use another sidecar container for upload, set it to `false`.
693+
694+
| ENV variables per mode | Hub/Nodes | Standalone roles | Dynamic Grid |
691695
|------------------------------------------|-------------------|------------------|----------------|
692-
| `SE_VIDEO_RECORD_STANDALONE` (mandatory) | `false` (default) | `true` | user input |
696+
| `SE_VIDEO_RECORD_STANDALONE` (mandatory) | `false` (default) | `true` | `true` |
693697
| `DISPLAY_CONTAINER_NAME` (mandatory) | user input | user input | (not required) |
694698
| `SE_NODE_PORT` (optional) | `5555` | `4444` | (not required) |
695699
| `SE_NODE_GRID_URL` (optional) | user input | (not required) | (not required) |
696700

697-
`SE_VIDEO_UPLOAD_ENABLED=true` will enable the video upload feature. In the background, it will create a pipefile with file and destination for uploader to consume and proceed.
698-
699-
`SE_VIDEO_INTERNAL_UPLOAD=true` will use RCLONE installed in the container for upload. If you want to use another container for upload, set it to `false`.
700-
701701
For environment variables with prefix `RCLONE_` is used to pass remote configuration to RCLONE. You can find more information about RCLONE configuration [here](https://rclone.org/docs/).
702702
When using in Dynamic Grid, those variables should be combined with the prefix `SE_`, for example `SE_RCLONE_`. See below reference for more details.
703703

@@ -710,6 +710,16 @@ When using in Dynamic Grid, those variables should be combined with the prefix `
710710

711711
- Configure video recording and uploading for Dynamic Grid standalone (standalone-docker): [tests/docker-compose-v3-test-standalone-docker.yaml](tests/docker-compose-v3-test-standalone-docker.yaml)
712712

713+
### Environment variables and default values for upload feature
714+
715+
| Environment variable | Default value | Description |
716+
|-------------------------------|------------------------------------|-------------------------------------------------------------------------------------------|
717+
| `SE_UPLOAD_RETAIN_LOCAL_FILE` | `false` | Keep local file after uploading successfully |
718+
| `SE_UPLOAD_COMMAND` | `copy` | RCLONE command is used to transfer file. Enforce `move` when retain local file is `false` |
719+
| `SE_UPLOAD_OPTS` | `-P --cutoff-mode SOFT --metadata` | Other options belong to RCLONE command can be set. |
720+
| `SE_UPLOAD_CONFIG_FILE_NAME` | `upload.conf` | Config file for remote host instead of set via env variable prefix SE_RCLONE_* |
721+
| `SE_UPLOAD_CONFIG_DIRECTORY` | `/opt/bin` | Directory of config file (change it when conf file in another directory is mounted) |
722+
713723
___
714724

715725
## Dynamic Grid

Video/upload.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/usr/bin/env bash
22

33
VIDEO_FOLDER=${VIDEO_FOLDER}
4-
UPLOAD_CONFIG_DIRECTORY=${UPLOAD_CONFIG_DIRECTORY:-"/opt/bin"}
5-
UPLOAD_CONFIG_FILE_NAME=${UPLOAD_CONFIG_FILE_NAME:-"upload.conf"}
6-
UPLOAD_COMMAND=${UPLOAD_COMMAND:-"copy"}
4+
UPLOAD_CONFIG_DIRECTORY=${SE_UPLOAD_CONFIG_DIRECTORY:-"/opt/bin"}
5+
UPLOAD_CONFIG_FILE_NAME=${SE_UPLOAD_CONFIG_FILE_NAME:-"upload.conf"}
6+
UPLOAD_COMMAND=${SE_UPLOAD_COMMAND:-"copy"}
7+
UPLOAD_OPTS=${SE_UPLOAD_OPTS:-"-P --cutoff-mode SOFT --metadata"}
78
UPLOAD_RETAIN_LOCAL_FILE=${SE_UPLOAD_RETAIN_LOCAL_FILE:-"false"}
8-
UPLOAD_PIPE_FILE_NAME=${UPLOAD_PIPE_FILE_NAME:-"uploadpipe"}
9+
UPLOAD_PIPE_FILE_NAME=${SE_UPLOAD_PIPE_FILE_NAME:-"uploadpipe"}
910
SE_VIDEO_INTERNAL_UPLOAD=${SE_VIDEO_INTERNAL_UPLOAD:-"false"}
10-
VIDEO_UPLOAD_ENABLED=${VIDEO_UPLOAD_ENABLED:-SE_VIDEO_UPLOAD_ENABLED}
11-
SE_VIDEO_UPLOAD_BATCH_CHECK=${SE_VIDEO_UPLOAD_BATCH_CHECK:-"10"}
11+
VIDEO_UPLOAD_ENABLED=${SE_VIDEO_UPLOAD_ENABLED:-"false"}
12+
VIDEO_UPLOAD_BATCH_CHECK=${SE_VIDEO_UPLOAD_BATCH_CHECK:-"10"}
1213
process_name="video.uploader"
1314

1415
if [ "${SE_VIDEO_INTERNAL_UPLOAD}" = "true" ];
@@ -64,7 +65,7 @@ function consume_pipe_file() {
6465
list_rclone_pid=()
6566
function check_and_clear_background() {
6667
# Wait for a batch rclone processes to finish
67-
if [ ${#list_rclone_pid[@]} -eq ${SE_VIDEO_UPLOAD_BATCH_CHECK} ]; then
68+
if [ ${#list_rclone_pid[@]} -eq ${VIDEO_UPLOAD_BATCH_CHECK} ]; then
6869
for pid in "${list_rclone_pid[@]}";
6970
do
7071
wait ${pid}
@@ -78,7 +79,7 @@ function rclone_upload() {
7879
local source=$1
7980
local target=$2
8081
echo "$(date +%FT%T%Z) [${process_name}] - Uploading ${source} to ${target}"
81-
exec rclone --config ${UPLOAD_CONFIG_DIRECTORY}/${UPLOAD_CONFIG_FILE_NAME} ${UPLOAD_COMMAND} --cutoff-mode SOFT --metadata ${UPLOAD_OPTS} "${source}" "${target}" &
82+
exec rclone --config ${UPLOAD_CONFIG_DIRECTORY}/${UPLOAD_CONFIG_FILE_NAME} ${UPLOAD_COMMAND} ${UPLOAD_OPTS} "${source}" "${target}" &
8283
}
8384

8485
function graceful_exit() {

0 commit comments

Comments
 (0)