-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into simplify_ticket_system
- Loading branch information
Showing
29 changed files
with
762 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'aws-sdk-mediapackagev2' | ||
|
||
module MediaPackageV2Helper | ||
def media_package_v2_client | ||
creds = Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']) | ||
@client ||= if creds.set? | ||
Aws::MediaPackageV2::Client.new(region: AWS_LIVE_STREAM_REGION, credentials: creds) | ||
else | ||
Aws::MediaPackageV2::Client.new(region: AWS_LIVE_STREAM_REGION) | ||
end | ||
end | ||
|
||
def channel_group_name | ||
conference = streaming.conference | ||
|
||
if review_app? | ||
"review_app_#{review_app_number}_#{conference.abbr}" | ||
else | ||
"#{env_name}_#{conference.abbr}" | ||
end | ||
end | ||
|
||
def channel_name | ||
conference = streaming.conference | ||
track = streaming.track | ||
|
||
if review_app? | ||
"review_app_#{review_app_number}_#{conference.abbr}_track#{track.name}" | ||
else | ||
"#{env_name}_#{conference.abbr}_track#{track.name}" | ||
end | ||
end | ||
|
||
def origin_endpoint_name | ||
conference = streaming.conference | ||
track = streaming.track | ||
|
||
if review_app? | ||
"review_app_#{review_app_number}_#{conference.abbr}_track#{track.name}" | ||
else | ||
"#{env_name}_#{conference.abbr}_track#{track.name}" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,62 @@ | ||
class CreateStreamingAwsResourcesJob < ApplicationJob | ||
include EnvHelper | ||
include MediaPackageV2Helper | ||
include LogoutHelper | ||
|
||
# queue_as :default | ||
self.queue_adapter = :async | ||
|
||
attr_reader :conference | ||
attr_reader :track | ||
attr_reader :streaming | ||
|
||
def perform(*args) | ||
# Rails.logger.level = Logger::DEBUG | ||
logger.info('Perform CreateMediaPackageV2Job') | ||
@streaming = args[0] | ||
@conference = @streaming.conference | ||
@track = @streaming.track | ||
|
||
create_media_package_v2_resources | ||
create_media_package_resources | ||
|
||
@streaming.update!(status: 'created') | ||
rescue => e | ||
@streaming.update!(status: 'error') | ||
logger.error(e.message) | ||
logger.error(e.backtrace.join("\n")) | ||
end | ||
|
||
def create_media_package_v2_resources | ||
logger.info('Perform CreateMediaPackageV2Job') | ||
|
||
|
||
channel_group = MediaPackageV2ChannelGroup.find_or_create_by(streaming_id: @streaming.id, name: channel_group_name) | ||
logger.info("channel group: #{channel_group}") | ||
channel_group.create_aws_resource | ||
|
||
channel = MediaPackageV2Channel.find_or_create_by(streaming_id: @streaming.id, media_package_v2_channel_group_id: channel_group.id, name: channel_name) | ||
logger.info("channel: #{channel}") | ||
channel.create_aws_resource | ||
|
||
origin_endpoint = MediaPackageV2OriginEndpoint.find_or_create_by(streaming_id: @streaming.id, media_package_v2_channel_id: channel.id, name: origin_endpoint_name) | ||
logger.info("origin endpoint: #{origin_endpoint}") | ||
origin_endpoint.create_aws_resource | ||
end | ||
|
||
def create_media_package_resources | ||
logger.info('Perform CreateMediaPackageJob') | ||
|
||
channel = MediaPackageChannel.find_or_create_by(streaming_id: @streaming.id) | ||
logger.info("channel: #{channel}") | ||
channel.create_aws_resource | ||
|
||
parameter = MediaPackageParameter.find_or_create_by(streaming_id: @streaming.id, media_package_channel_id: channel.id) | ||
logger.info("parameter: #{parameter}") | ||
parameter.create_aws_resources | ||
|
||
endpoint = MediaPackageOriginEndpoint.find_or_create_by(streaming_id: @streaming.id, media_package_channel_id: channel.id) | ||
logger.info("endpoint: #{endpoint}") | ||
endpoint.create_aws_resource | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.