Skip to content
Draft
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
12 changes: 11 additions & 1 deletion docs/docs/administration/configuration-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ Starting with BigBlueButton 2.3 many of the configuration files have local overr
| /usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml | /etc/bigbluebutton/bbb-webrtc-sfu/production.yml | Arrays are merged by replacement |
| /usr/local/bigbluebutton/bbb-pads/config/settings.json | /etc/bigbluebutton/bbb-pads.json | Arrays are merged by replacement |
| /usr/share/bbb-shared-notes-server/config/default.yml | /etc/bigbluebutton/bbb-shared-notes-server.yml | |
| /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml | /etc/bigbluebutton/recording/recording.yml |
| /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml | /etc/bigbluebutton/recording/recording.yml | Honored by all recording formats; re-read on every processing step, so changes do not require a restart |
| /usr/local/bigbluebutton/core/scripts/presentation.yml | /etc/bigbluebutton/recording/presentation.yml |
| /usr/local/bigbluebutton/core/scripts/video.yml | /etc/bigbluebutton/recording/video.yml | Individual `presets` are merged by key; other settings are replaced |
| /etc/cron.daily/bigbluebutton | /etc/default/bigbluebutton-cron-config | Only variables allowed in the override

<br /><br />
Expand Down Expand Up @@ -66,6 +67,15 @@ services {
}
```

For the recording pipeline, `/etc/bigbluebutton/recording/recording.yml` overrides settings from `/usr/local/bigbluebutton/core/scripts/bigbluebutton.yml` for every recording format (presentation, video, screenshare, notes, podcast). For example, the following `recording.yml` makes published recording links use a different hostname and protocol:

```yml
playback_host: playback.example.com
playback_protocol: https
```

The override is re-read on every recording processing step, so a change takes effect for the next recording without restarting the recording workers. The playback link in a recording's `metadata.xml` is regenerated at publish time, so links of an already-published recording can be corrected by rebuilding it: `bbb-record --rebuild <internal meeting ID>`.

## HTML5 Client

### Configuration files
Expand Down
19 changes: 8 additions & 11 deletions record-and-playback/core/lib/recordandplayback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,16 @@ def self.rap_scripts_path
File.join(BigBlueButton.rap_core_path, 'scripts')
end

def self.read_props
return @props if @props

filepathRecOverride = "/etc/bigbluebutton/recording/recording.yml"
hasOverride = File.file?(filepathRecOverride)

# Do not cache the result: long-lived processes (e.g. the resque workers)
# must pick up changes to the override file without a restart.
def self.read_props(override_path: '/etc/bigbluebutton/recording/recording.yml')
filepath = File.join(BigBlueButton.rap_scripts_path, 'bigbluebutton.yml')
@props = YAML::load(File.open(filepath))
if (hasOverride)
recOverrideProps = YAML::load(File.open(filepathRecOverride))
@props = @props.merge(recOverrideProps)
props = YAML.safe_load(File.read(filepath), aliases: true) || {}
if File.file?(override_path)
override_props = YAML.safe_load(File.read(override_path), aliases: true) || {}
props = props.merge(override_props)
end
@props
props
end

def self.create_redis_publisher
Expand Down
51 changes: 51 additions & 0 deletions record-and-playback/core/test/recordandplayback/test_read_props.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# frozen_string_literal: true

require 'minitest/autorun'
require 'tmpdir'

require 'recordandplayback'

class TestReadProps < Minitest::Test
def test_returns_base_props_when_override_missing
props = BigBlueButton.read_props(override_path: '/nonexistent/recording.yml')

assert_kind_of(Hash, props)
refute_nil(props['playback_host'])
end

def test_override_merges_over_base_props
Dir.mktmpdir do |dir|
override = File.join(dir, 'recording.yml')
File.write(override, "playback_host: override.example.com\n")

props = BigBlueButton.read_props(override_path: override)

assert_equal('override.example.com', props['playback_host'])
refute_nil(props['recording_dir'])
end
end

def test_rereads_override_on_each_call
Dir.mktmpdir do |dir|
override = File.join(dir, 'recording.yml')

File.write(override, "playback_host: first.example.com\n")
assert_equal('first.example.com', BigBlueButton.read_props(override_path: override)['playback_host'])

File.write(override, "playback_host: second.example.com\n")
assert_equal('second.example.com', BigBlueButton.read_props(override_path: override)['playback_host'])
end
end

def test_empty_override_file_is_ignored
Dir.mktmpdir do |dir|
override = File.join(dir, 'recording.yml')
File.write(override, '')

props = BigBlueButton.read_props(override_path: override)

assert_kind_of(Hash, props)
refute_nil(props['playback_host'])
end
end
end
2 changes: 1 addition & 1 deletion record-and-playback/notes/scripts/process/notes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
meeting_id = opts[:meeting_id]

# This script lives in scripts/archive/steps while properties.yaml lives in scripts/
props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
props = BigBlueButton.read_props
notes_props = YAML::load(File.open('notes.yml'))
format = notes_props['format']

Expand Down
2 changes: 1 addition & 1 deletion record-and-playback/notes/scripts/publish/notes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


# This script lives in scripts/archive/steps while properties.yaml lives in scripts/
bbb_props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
bbb_props = BigBlueButton.read_props
notes_props = YAML::load(File.open('notes.yml'))

opts = Optimist::options do
Expand Down
2 changes: 1 addition & 1 deletion record-and-playback/podcast/scripts/process/podcast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
meeting_id = opts[:meeting_id]

# This script lives in scripts/archive/steps while properties.yaml lives in scripts/
props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
props = BigBlueButton.read_props
podcast_props = YAML::load(File.open('podcast.yml'))

recording_dir = props['recording_dir']
Expand Down
2 changes: 1 addition & 1 deletion record-and-playback/podcast/scripts/publish/podcast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


# This script lives in scripts/archive/steps while properties.yaml lives in scripts/
bbb_props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
bbb_props = BigBlueButton.read_props
podcast_props = YAML::load(File.open('podcast.yml'))

opts = Optimist::options do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
end

# Load parameters and set up paths
props = YAML::load(File.open(File.expand_path('../../bigbluebutton.yml', __FILE__)))
props = BigBlueButton.read_props
screenshare_props = YAML::load(File.open(File.expand_path('../../screenshare.yml', __FILE__)))

recording_dir = props['recording_dir']
Expand Down
14 changes: 11 additions & 3 deletions record-and-playback/screenshare/scripts/publish/screenshare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
end

# Load parameters and set up paths
props = YAML::load(File.open(File.expand_path('../../bigbluebutton.yml', __FILE__)))
props = BigBlueButton.read_props
screenshare_props = YAML::load(File.open(File.expand_path('../../screenshare.yml', __FILE__)))

process_dir = "#{props['recording_dir']}/process/screenshare/#{meeting_id}"
Expand Down Expand Up @@ -81,8 +81,16 @@
"#{publish_dir}/caption_#{caption['locale']}.vtt")
end

# Copy over metadata xml file
FileUtils.cp("#{process_dir}/metadata.xml", "#{publish_dir}/metadata.xml")
# Refresh the playback link from current props (honoring recording.yml
# overrides) and write the updated metadata to the publish directory, rather
# than copying the process-time metadata.xml with a possibly-stale link.
metadata_xml = Nokogiri::XML(File.open("#{process_dir}/metadata.xml"))
link = metadata_xml.at_xpath('/recording/playback/link')
if link
link.content = "#{props['playback_protocol']}://#{props['playback_host']}/recording/screenshare/#{meeting_id}/"
logger.info "Refreshed playback link to #{link.content}"
end
File.write("#{publish_dir}/metadata.xml", metadata_xml.to_xml)

# Copy over css and js support files
FileUtils.cp_r("#{process_dir}/css", publish_dir)
Expand Down
11 changes: 9 additions & 2 deletions record-and-playback/video/scripts/publish/video.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,15 @@
"#{publish_dir}/caption_#{caption['locale']}.vtt")
end

# Copy over metadata xml file
FileUtils.cp("#{process_dir}/metadata.xml", "#{publish_dir}/metadata.xml")
# Refresh the playback link from current props (honoring recording.yml
# overrides) and write the updated metadata to the publish directory, rather
# than copying the process-time metadata.xml with a possibly-stale link.
link = metadata_xml.at_xpath('/recording/playback/link')
if link
link.content = "#{props['playback_protocol']}://#{props['playback_host']}/playback/video/#{meeting_id}/"
logger.info("Refreshed playback link to #{link.content}")
end
File.write("#{publish_dir}/metadata.xml", metadata_xml.to_xml)

# Get raw size of presentation files
raw_dir = "#{recording_dir}/raw/#{meeting_id}"
Expand Down
Loading