Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HLS OpenAPI warning #202

Merged
merged 16 commits into from
Jun 4, 2024
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ orbs:
executors:
machine_executor_amd64:
machine:
image: ubuntu-2204:2022.04.2
image: default
sgfn marked this conversation as resolved.
Show resolved Hide resolved
environment:
architecture: "amd64"
platform: "linux/amd64"
Expand Down
14 changes: 8 additions & 6 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Config

config :membrane_core, :enable_metrics, false

config :fishjam, FishjamWeb.Endpoint,
url: [host: "localhost"],
render_errors: [
Expand Down Expand Up @@ -29,12 +31,12 @@ config :phoenix, :logger, false

config :logger,
compile_time_purge_matching: [
[application: :membrane_rtc_engine, level_lower_than: :warning],
[application: :membrane_rtc_engine_webrtc, level_lower_than: :warning],
[application: :membrane_rtc_engine_hls, level_lower_than: :warning],
[application: :membrane_rtc_engine_rtsp, level_lower_than: :warning],
[application: :membrane_rtc_engine_file, level_lower_than: :warning],
[application: :membrane_rtc_engine_sip, level_lower_than: :warning]
# [application: :membrane_rtc_engine, level_lower_than: :warning],
# [application: :membrane_rtc_engine_webrtc, level_lower_than: :warning],
# [application: :membrane_rtc_engine_hls, level_lower_than: :warning],
# [application: :membrane_rtc_engine_rtsp, level_lower_than: :warning],
# [application: :membrane_rtc_engine_file, level_lower_than: :warning],
# [application: :membrane_rtc_engine_sip, level_lower_than: :warning]
sgfn marked this conversation as resolved.
Show resolved Hide resolved
]

config :ex_aws,
Expand Down
2 changes: 2 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ config :logger, level: :warning
config :phoenix, :plug_init_mode, :runtime

config :ex_aws, :http_client, ExAws.Request.HttpMock

config :ex_aws, :awscli_auth_adapter, Fishjam.Adapter
2 changes: 2 additions & 0 deletions lib/fishjam/component/hls/manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ defmodule Fishjam.Component.HLS.Manager do
unless is_nil(hls_options.s3), do: upload_to_s3(hls_dir, room_id, hls_options.s3)
unless hls_options.persistent, do: remove_hls(hls_dir, room_id)

Logger.info("Enginer is down and HLS manager finished uploading stream")
Rados13 marked this conversation as resolved.
Show resolved Hide resolved

{:stop, :normal, state}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/fishjam/room_service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ defmodule Fishjam.RoomService do
def handle_info({:DOWN, _ref, :process, pid, :normal}, state) do
{room_id, state} = pop_in(state, [:rooms, pid])

Logger.debug("Room #{room_id} is down with reason: normal")
Logger.debug("Room #{inspect(room_id)} is down with reason: normal")

Phoenix.PubSub.broadcast(Fishjam.PubSub, room_id, :room_stopped)
Event.broadcast_server_notification({:room_deleted, room_id})
Expand Down
32 changes: 32 additions & 0 deletions lib/fishjam_web/api_spec/component/HLS/S3.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
defmodule FishjamWeb.ApiSpec.Component.HLS.S3 do
@moduledoc false

require OpenApiSpex
alias OpenApiSpex.Schema

OpenApiSpex.schema(%{
title: "S3Credentials",
description:
"An AWS S3 credential that will be used to send HLS stream. The stream will only be uploaded if credentials are provided",
type: :object,
properties: %{
accessKeyId: %Schema{
type: :string,
description: "An AWS access key identifier, linked to your AWS account."
},
secretAccessKey: %Schema{
type: :string,
description: "The secret key that is linked to the Access Key ID."
},
region: %Schema{
type: :string,
description: "The AWS region where your bucket is located."
},
bucket: %Schema{
type: :string,
description: "The name of the S3 bucket where your data will be stored."
}
},
required: [:accessKeyId, :secretAccessKey, :region, :bucket]
})
end
41 changes: 3 additions & 38 deletions lib/fishjam_web/api_spec/component/hls.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,12 @@ defmodule FishjamWeb.ApiSpec.Component.HLS do
})
end

defmodule S3 do
@moduledoc false

require OpenApiSpex

OpenApiSpex.schema(%{
title: "S3Credentials",
description:
"An AWS S3 credential that will be used to send HLS stream. The stream will only be uploaded if credentials are provided",
type: :object,
properties: %{
accessKeyId: %Schema{
type: :string,
description: "An AWS access key identifier, linked to your AWS account."
},
secretAccessKey: %Schema{
type: :string,
description: "The secret key that is linked to the Access Key ID."
},
region: %Schema{
type: :string,
description: "The AWS region where your bucket is located."
},
bucket: %Schema{
type: :string,
description: "The name of the S3 bucket where your data will be stored."
}
},
required: [:accessKeyId, :secretAccessKey, :region, :bucket]
})
end

defmodule Options do
@moduledoc false

require OpenApiSpex
alias FishjamWeb.ApiSpec.Component.HLS.S3
alias OpenApiSpex.Schema

OpenApiSpex.schema(%{
title: "ComponentOptionsHLS",
Expand All @@ -100,12 +70,7 @@ defmodule FishjamWeb.ApiSpec.Component.HLS do
description: "Whether the video is stored after end of stream",
default: false
},
s3: %Schema{
type: :object,
description: "Credentials to AWS S3 bucket.",
oneOf: [S3],
nullable: true
},
s3: S3.schema(),
sgfn marked this conversation as resolved.
Show resolved Hide resolved
subscribeMode: %Schema{
type: :string,
description:
Expand Down
7 changes: 1 addition & 6 deletions lib/fishjam_web/api_spec/component/recording.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ defmodule FishjamWeb.ApiSpec.Component.Recording do
default: nil,
nullable: true
},
credentials: %Schema{
type: :object,
description: "Credentials to AWS S3 bucket.",
oneOf: [S3],
nullable: true
},
credentials: S3.schema(),
subscribeMode: %Schema{
type: :string,
description:
Expand Down
2 changes: 1 addition & 1 deletion lib/fishjam_web/peer_socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ defmodule FishjamWeb.PeerSocket do

@impl true
def terminate(reason, _state) do
Logger.info("Peer socket terminates with reason #{reason}")
Logger.info("Peer socket terminates with reason #{inspect(reason)}")
:ok
end

Expand Down
40 changes: 33 additions & 7 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule Fishjam.MixProject do
aliases: aliases(),
deps: deps(),
dialyzer: dialyzer(),
consolidate_protocols: false,
sgfn marked this conversation as resolved.
Show resolved Hide resolved

# hex
description: "Fishjam media server",
Expand Down Expand Up @@ -52,7 +53,7 @@ defmodule Fishjam.MixProject do
{:plug_cowboy, "~> 2.5"},
{:elixir_uuid, "~> 1.2"},
{:cors_plug, "~> 3.0"},
{:open_api_spex, "~> 3.16"},
{:open_api_spex, "~> 3.19"},
{:ymlr, "~> 3.0"},
{:bunch, "~> 1.6"},
{:logger_json, "~> 5.1"},
Expand All @@ -66,18 +67,43 @@ defmodule Fishjam.MixProject do
{:protobuf, "~> 0.12.0"},

# Membrane deps
{:membrane_core, "1.1.0-rc0", override: true},
# {:membrane_core, "1.1.0-rc0", override: true},
{:membrane_core,
github: "membraneframework/membrane_core",
branch: "maybe-fix-fishjam-problems",
override: true},
# {:membrane_rtc_engine, "~> 0.22.0"},
{:membrane_rtc_engine,
github: "fishjam-dev/membrane_rtc_engine", sparse: "engine", override: true},
github: "fishjam-dev/membrane_rtc_engine",
sparse: "engine",
branch: "fix_s3_error",
override: "true"},
# {:membrane_rtc_engine_webrtc, "~> 0.8.0"},
{:membrane_rtc_engine_webrtc,
github: "fishjam-dev/membrane_rtc_engine", sparse: "webrtc", override: true},
github: "fishjam-dev/membrane_rtc_engine",
sparse: "webrtc",
branch: "fix_s3_error",
override: "true"},
{:membrane_rtc_engine_hls, "~> 0.7.0"},
{:membrane_rtc_engine_recording, "~> 0.1.0"},
# {:membrane_rtc_engine_recording, "~> 0.1.0"},
{:membrane_rtc_engine_recording,
github: "fishjam-dev/membrane_rtc_engine",
sparse: "recording",
branch: "fix_s3_error",
override: "true"},
# {:membrane_rtc_engine_rtsp, "~> 0.7.0"},
{:membrane_rtc_engine_rtsp,
github: "fishjam-dev/membrane_rtc_engine", sparse: "rtsp", override: true},
github: "fishjam-dev/membrane_rtc_engine",
sparse: "rtsp",
branch: "fix_s3_error",
override: "true"},
{:membrane_rtc_engine_file, "~> 0.5.0"},
# {:membrane_rtc_engine_sip, "~> 0.3.0"},
{:membrane_rtc_engine_sip,
github: "fishjam-dev/membrane_rtc_engine", sparse: "sip", override: true},
github: "fishjam-dev/membrane_rtc_engine",
sparse: "sip",
branch: "fix_s3_error",
override: "true"},
{:membrane_telemetry_metrics, "~> 0.1.0"},

# HLS endpoints deps
Expand Down
Loading