Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Various Node container improvements #16

Merged
merged 3 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions core/src/services/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct Options {
#[structopt(long, env, parse(from_os_str))]
storage_directory: PathBuf,

/// Directory size limit
/// Directory size limit in GB
#[structopt(long, env)]
size_limit: f64,

Expand All @@ -47,7 +47,8 @@ pub struct Options {
pub async fn run(shared_options: SharedOptions, options: Options) -> Result<()> {
let storage_id = StorageHandler::storage_id(options.storage_directory.clone()).await?;
let provider_id = Uuid::new_v4().to_string();
let cleanup_target = options.size_limit * (options.cleanup_percentage / 100.0);
let size_limit = options.size_limit * 1_000_000_000.0;
let cleanup_target = size_limit * (options.cleanup_percentage / 100.0);

let (mut heart, _) = Heart::new();

Expand All @@ -56,11 +57,7 @@ pub async fn run(shared_options: SharedOptions, options: Options) -> Result<()>

let status_job = StatusServer::new(&scheduler, shared_options.status_server);
let server_job = ServerJob::new(options.port, options.storage_directory.clone());
let cleanup_job = CleanupJob::new(
options.storage_directory,
options.size_limit,
cleanup_target,
);
let cleanup_job = CleanupJob::new(options.storage_directory, size_limit, cleanup_target);

context.spawn_heart_beat(&provider_id, &scheduler).await;

Expand Down
4 changes: 4 additions & 0 deletions distribution/docker/images/node/base/install/packages.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
install_packages software-properties-common

apt-add-repository non-free

PACKAGES=$(grep -v '#' packages.txt | xargs | tr '\n' ' ')
install_packages $PACKAGES
11 changes: 11 additions & 0 deletions distribution/docker/images/node/base/install/packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ xwit
# Screen recording
ffmpeg

# Fonts
libfontconfig1
libfreetype6
xfonts-cyrillic
xfonts-scalable
fonts-liberation
fonts-ipafont-gothic
fonts-wqy-zenhei
fonts-tlwg-loma-otf
ttf-ubuntu-font-family

# Other stuff
wget
gettext-base
Expand Down
4 changes: 2 additions & 2 deletions distribution/docker/images/node/driver/web-driver.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
GECKO_VERSION=0.26.0
CHROME_VERSION=83.0.4103.39
GECKO_VERSION=0.29.0
CHROME_VERSION=89.0.4389.23
PREV_PWD=$(pwd)
TMP_DIR=$(mktemp -d)

Expand Down
4 changes: 2 additions & 2 deletions distribution/kubernetes/chart/templates/storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.recording.sizeLimit }}
storage: "{{ .Values.recording.sizeLimit }}G"
---
{{- end}}
apiVersion: apps/v1
Expand Down Expand Up @@ -58,7 +58,7 @@ spec:
- image: "{{ .Values.image.repository }}/core:{{ include "web-grid.imageTag" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: {{ .Chart.Name }}-storage
args: ["storage", "--status-server"]
args: ["storage", "--status-server", "--size-limit", "{{ .Values.recording.sizeLimit }}"]
volumeMounts:
- name: storage
mountPath: /storage
Expand Down
3 changes: 2 additions & 1 deletion distribution/kubernetes/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ maxSessionsPerOrchestrator: 5
recording:
# Whether or not to create PVCs and a storage service
enabled: false
sizeLimit: 50G
# Size in GB
sizeLimit: 50
# Consult the ffmpeg documentation on how these parameters work
# https://trac.ffmpeg.org/wiki/Encode/H.264
quality:
Expand Down
2 changes: 1 addition & 1 deletion docs/kubernetes/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ recording:
```

??? tip "Limiting the storage size"
By default the grid uses at most 50GB of storage for each volume and deletes old videos to keep the occupancy below that. You may change this value by adding the `recording.sizeLimit` value with a Kubernetes compatible string like `50G`. For more details, refer the [configuration defaults](./configuration.md#value-reference).
By default the grid uses at most 50GB of storage for each volume and deletes old videos to keep the occupancy below that. You may change this value by adding the `recording.sizeLimit` value with an integer like `50` (representing GB). For more details, refer the [configuration defaults](./configuration.md#value-reference).

## Persistent Volume

Expand Down