diff --git a/.github/workflows/deploy-image.yml b/.github/workflows/deploy-image.yml index c224a5e1..6015f067 100644 --- a/.github/workflows/deploy-image.yml +++ b/.github/workflows/deploy-image.yml @@ -51,4 +51,4 @@ jobs: tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha cache-to: type=gha,mode=max - build-args: JF_GIT_COMMIT=${{ env.sha_short }} + build-args: FJ_GIT_COMMIT=${{ env.sha_short }} diff --git a/.gitignore b/.gitignore index 031ab898..b74d702c 100644 --- a/.gitignore +++ b/.gitignore @@ -183,8 +183,8 @@ $RECYCLE.BIN/ # End of https://www.gitignore.io/api/c,vim,linux,macos,elixir,windows,visualstudiocode -# Default Jellyfish directory for storing multimedia files -jellyfish_resources +# Default Fishjam directory for storing multimedia files +fishjam_resources # asdf diff --git a/.gitmodules b/.gitmodules index 9fc0cb9d..d97d52f1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "protos"] path = protos - url = https://github.com/jellyfish-dev/protos.git + url = https://github.com/fishjam-dev/protos.git branch = master diff --git a/Dockerfile b/Dockerfile index 969d8363..c6e494ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,9 +26,9 @@ ENV MIX_ENV=prod # The order of the following commands is important. # It ensures that: # * any changes in the `lib` directory will only trigger -# jellyfish compilation +# fishjam compilation # * any changes in the `config` directory will -# trigger both jellyfish and deps compilation +# trigger both fishjam and deps compilation # but not deps fetching # * any changes in the `config/runtime.exs` won't trigger # anything @@ -51,10 +51,10 @@ RUN mix release FROM alpine:3.17 AS app -ARG JF_GIT_COMMIT -ENV JF_GIT_COMMIT=$JF_GIT_COMMIT +ARG FJ_GIT_COMMIT +ENV FJ_GIT_COMMIT=$FJ_GIT_COMMIT -RUN addgroup -S jellyfish && adduser -S jellyfish -G jellyfish +RUN addgroup -S fishjam && adduser -S fishjam -G fishjam # We run the whole image as root, fix permissions in # the docker-entrypoint.sh and then use gosu to step-down @@ -104,33 +104,33 @@ RUN \ WORKDIR /app -# base path where jellyfish media files are stored -ENV JF_RESOURCES_BASE_PATH=./jellyfish_resources +# base path where fishjam media files are stored +ENV FJ_RESOURCES_BASE_PATH=./fishjam_resources # override default (127, 0, 0, 1) IP by 0.0.0.0 # as docker doesn't allow for connections outside the # container when we listen to 127.0.0.1 -ENV JF_IP=0.0.0.0 -ENV JF_METRICS_IP=0.0.0.0 +ENV FJ_IP=0.0.0.0 +ENV FJ_METRICS_IP=0.0.0.0 -ENV JF_DIST_MIN_PORT=9000 -ENV JF_DIST_MAX_PORT=9000 +ENV FJ_DIST_MIN_PORT=9000 +ENV FJ_DIST_MAX_PORT=9000 -RUN mkdir ${JF_RESOURCES_BASE_PATH} && chown jellyfish:jellyfish ${JF_RESOURCES_BASE_PATH} +RUN mkdir ${FJ_RESOURCES_BASE_PATH} && chown fishjam:fishjam ${FJ_RESOURCES_BASE_PATH} # Create directory for File Component sources -RUN mkdir ${JF_RESOURCES_BASE_PATH}/file_component_sources \ - && chown jellyfish:jellyfish ${JF_RESOURCES_BASE_PATH}/file_component_sources +RUN mkdir ${FJ_RESOURCES_BASE_PATH}/file_component_sources \ + && chown fishjam:fishjam ${FJ_RESOURCES_BASE_PATH}/file_component_sources -COPY --from=build /app/_build/prod/rel/jellyfish ./ +COPY --from=build /app/_build/prod/rel/fishjam ./ COPY docker-entrypoint.sh ./docker-entrypoint.sh RUN chmod +x docker-entrypoint.sh ENV HOME=/app -HEALTHCHECK CMD curl --fail -H "authorization: Bearer ${JF_SERVER_API_TOKEN}" http://localhost:${JF_PORT:-8080}/health || exit 1 +HEALTHCHECK CMD curl --fail -H "authorization: Bearer ${FJ_SERVER_API_TOKEN}" http://localhost:${FJ_PORT:-8080}/health || exit 1 ENTRYPOINT ["./docker-entrypoint.sh"] -CMD ["bin/jellyfish", "start"] +CMD ["bin/fishjam", "start"] diff --git a/compile_proto.sh b/compile_proto.sh index cad73037..419ee8f6 100755 --- a/compile_proto.sh +++ b/compile_proto.sh @@ -9,7 +9,7 @@ git submodule sync --recursive >> /dev/null git submodule update --recursive --remote --init >> /dev/null printf "DONE\n\n" -files=$(find protos/jellyfish -name "*.proto") +files=$(find protos/fishjam -name "*.proto") printf "Compiling:\n" count=1 diff --git a/config/ci.exs b/config/ci.exs index b664fff0..8c2f45d4 100644 --- a/config/ci.exs +++ b/config/ci.exs @@ -1,10 +1,10 @@ import Config -config :jellyfish, ip: {127, 0, 0, 1}, port: 4002, server_api_token: "development" +config :fishjam, ip: {127, 0, 0, 1}, port: 4002, server_api_token: "development" # We don't run a server during test. If one is required, # you can enable the server option below. -config :jellyfish, JellyfishWeb.Endpoint, server: false +config :fishjam, FishjamWeb.Endpoint, server: false # Initialize plugs at runtime for faster test compilation config :phoenix, :plug_init_mode, :runtime diff --git a/config/config.exs b/config/config.exs index e9a89f74..786c8080 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,15 +1,15 @@ import Config -config :jellyfish, JellyfishWeb.Endpoint, +config :fishjam, FishjamWeb.Endpoint, url: [host: "localhost"], render_errors: [ - formats: [json: JellyfishWeb.ErrorJSON], + formats: [json: FishjamWeb.ErrorJSON], layout: false ], - pubsub_server: Jellyfish.PubSub, + pubsub_server: Fishjam.PubSub, live_view: [signing_salt: "/Lo03qJT"] -config :jellyfish, +config :fishjam, webrtc_metrics_scrape_interval: 1000, room_metrics_scrape_interval: 10 @@ -37,12 +37,12 @@ config :logger, [application: :membrane_rtc_engine_sip, level_lower_than: :warning] ] -config :jellyfish, +config :fishjam, divo: "docker-compose.yaml", divo_wait: [dwell: 1_500, max_tries: 50] config :ex_aws, - http_client: Jellyfish.Component.HLS.HTTPoison, + http_client: Fishjam.Component.HLS.HTTPoison, normalize_path: false config :bundlex, :disable_precompiled_os_deps, apps: [:membrane_h264_ffmpeg_plugin, :ex_libsrtp] diff --git a/config/dev.exs b/config/dev.exs index 550fd318..3e6e61f0 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -2,7 +2,7 @@ import Config # Binding to loopback ipv4 address prevents access from other machines. # Change to `ip: {0, 0, 0, 0}` to allow access from other machines. -config :jellyfish, +config :fishjam, ip: {127, 0, 0, 1}, port: 5002, server_api_token: "development", @@ -14,7 +14,7 @@ config :jellyfish, # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with esbuild to bundle .js and .css sources. -config :jellyfish, JellyfishWeb.Endpoint, +config :fishjam, FishjamWeb.Endpoint, check_origin: false, code_reloader: true, debug_errors: true, diff --git a/config/prod.exs b/config/prod.exs index bf9b68aa..1499af52 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -7,12 +7,12 @@ import Config # Do not print debug messages in production config :logger, level: :info -config :jellyfish, +config :fishjam, ip: {127, 0, 0, 1}, port: 8080 # run the server automatically when using prod release -config :jellyfish, JellyfishWeb.Endpoint, server: true +config :fishjam, FishjamWeb.Endpoint, server: true # Runtime production configuration, including reading # of environment variables, is done on config/runtime.exs. diff --git a/config/runtime.exs b/config/runtime.exs index f00aedca..47b4e331 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,6 +1,6 @@ import Config -alias Jellyfish.ConfigReader +alias Fishjam.ConfigReader # config/runtime.exs is executed for all environments, including # during releases. It is executed after compilation and before the @@ -10,31 +10,31 @@ alias Jellyfish.ConfigReader # The block below contains prod specific runtime configuration. config :ex_dtls, impl: :nif -structured_logging? = ConfigReader.read_boolean("JF_STRUCTURED_LOGGING") || false +structured_logging? = ConfigReader.read_boolean("FJ_STRUCTURED_LOGGING") || false config :logger, backends: [if(structured_logging?, do: LoggerJSON, else: :console)] prod? = config_env() == :prod -ip = ConfigReader.read_ip("JF_IP") || Application.fetch_env!(:jellyfish, :ip) +ip = ConfigReader.read_ip("FJ_IP") || Application.fetch_env!(:fishjam, :ip) -port = ConfigReader.read_port("JF_PORT") || Application.fetch_env!(:jellyfish, :port) +port = ConfigReader.read_port("FJ_PORT") || Application.fetch_env!(:fishjam, :port) host = - case System.get_env("JF_HOST") do + case System.get_env("FJ_HOST") do nil -> "#{:inet.ntoa(ip)}:#{port}" other -> other end components_used = ConfigReader.read_components_used() -sip_used? = Jellyfish.Component.SIP in components_used +sip_used? = Fishjam.Component.SIP in components_used -config :jellyfish, +config :fishjam, jwt_max_age: 24 * 3600, media_files_path: - System.get_env("JF_RESOURCES_BASE_PATH", "jellyfish_resources") |> Path.expand(), + System.get_env("FJ_RESOURCES_BASE_PATH", "fishjam_resources") |> Path.expand(), address: host, - metrics_ip: ConfigReader.read_ip("JF_METRICS_IP") || {127, 0, 0, 1}, - metrics_port: ConfigReader.read_port("JF_METRICS_PORT") || 9568, + metrics_ip: ConfigReader.read_ip("FJ_METRICS_IP") || {127, 0, 0, 1}, + metrics_port: ConfigReader.read_port("FJ_METRICS_PORT") || 9568, dist_config: ConfigReader.read_dist_config(), webrtc_config: ConfigReader.read_webrtc_config(), components_used: components_used, @@ -42,11 +42,11 @@ config :jellyfish, s3_config: ConfigReader.read_s3_config(), git_commit: ConfigReader.read_git_commit() -case System.get_env("JF_SERVER_API_TOKEN") do +case System.get_env("FJ_SERVER_API_TOKEN") do nil when prod? == true -> raise """ - environment variable JF_SERVER_API_TOKEN is missing. - JF_SERVER_API_TOKEN is used for HTTP requests and + environment variable FJ_SERVER_API_TOKEN is missing. + FJ_SERVER_API_TOKEN is used for HTTP requests and server WebSocket authorization. """ @@ -54,14 +54,14 @@ case System.get_env("JF_SERVER_API_TOKEN") do :ok token -> - config :jellyfish, server_api_token: token + config :fishjam, server_api_token: token end external_uri = URI.parse("//" <> host) -config :jellyfish, JellyfishWeb.Endpoint, +config :fishjam, FishjamWeb.Endpoint, secret_key_base: - System.get_env("JF_SECRET_KEY_BASE") || Base.encode64(:crypto.strong_rand_bytes(48)), + System.get_env("FJ_SECRET_KEY_BASE") || Base.encode64(:crypto.strong_rand_bytes(48)), url: [ host: external_uri.host, port: external_uri.port || 443, @@ -73,7 +73,7 @@ config :jellyfish, JellyfishWeb.Endpoint, # Mix task: mix phx.gen.cert case ConfigReader.read_ssl_config() do {ssl_key_path, ssl_cert_path} -> - config :jellyfish, JellyfishWeb.Endpoint, + config :fishjam, FishjamWeb.Endpoint, https: [ ip: ip, port: port, @@ -83,15 +83,15 @@ case ConfigReader.read_ssl_config() do ] nil -> - config :jellyfish, JellyfishWeb.Endpoint, http: [ip: ip, port: port] + config :fishjam, FishjamWeb.Endpoint, http: [ip: ip, port: port] end -check_origin = ConfigReader.read_check_origin("JF_CHECK_ORIGIN") +check_origin = ConfigReader.read_check_origin("FJ_CHECK_ORIGIN") if check_origin != nil do - config :jellyfish, JellyfishWeb.Endpoint, check_origin: check_origin + config :fishjam, FishjamWeb.Endpoint, check_origin: check_origin end if prod? do - config :jellyfish, JellyfishWeb.Endpoint, url: [scheme: "https"] + config :fishjam, FishjamWeb.Endpoint, url: [scheme: "https"] end diff --git a/config/test.exs b/config/test.exs index f94f47f6..1d0de5e8 100644 --- a/config/test.exs +++ b/config/test.exs @@ -1,13 +1,13 @@ import Config -config :jellyfish, +config :fishjam, ip: {127, 0, 0, 1}, port: 4002, server_api_token: "development", webrtc_metrics_scrape_interval: 50, room_metrics_scrape_interval: 1 -config :jellyfish, JellyfishWeb.Endpoint, +config :fishjam, FishjamWeb.Endpoint, http: [ip: {127, 0, 0, 1}, port: 4002], server: true diff --git a/docker-compose-dns.yaml b/docker-compose-dns.yaml index abb90499..1b7af457 100644 --- a/docker-compose-dns.yaml +++ b/docker-compose-dns.yaml @@ -1,12 +1,12 @@ version: "3" -x-jellyfish-template: &jellyfish-template +x-fishjam-template: &fishjam-template build: . - environment: &jellyfish-environment - JF_SERVER_API_TOKEN: "development" - JF_DIST_ENABLED: "true" - JF_DIST_MODE: "name" - JF_DIST_STRATEGY_NAME: "DNS" + environment: &fishjam-environment + FJ_SERVER_API_TOKEN: "development" + FJ_DIST_ENABLED: "true" + FJ_DIST_MODE: "name" + FJ_DIST_STRATEGY_NAME: "DNS" restart: on-failure services: @@ -28,12 +28,12 @@ services: - app2 app1: - <<: *jellyfish-template + <<: *fishjam-template environment: - <<: *jellyfish-environment - JF_HOST: "localhost:4001" - JF_PORT: 4001 - JF_DIST_QUERY: app.dns-network + <<: *fishjam-environment + FJ_HOST: "localhost:4001" + FJ_PORT: 4001 + FJ_DIST_QUERY: app.dns-network ports: - 4001:4001 networks: @@ -42,12 +42,12 @@ services: - app.dns-network app2: - <<: *jellyfish-template + <<: *fishjam-template environment: - <<: *jellyfish-environment - JF_HOST: "localhost:4002" - JF_PORT: 4002 - JF_DIST_QUERY: app.dns-network + <<: *fishjam-environment + FJ_HOST: "localhost:4002" + FJ_PORT: 4002 + FJ_DIST_QUERY: app.dns-network ports: - 4002:4002 networks: diff --git a/docker-compose-epmd.yaml b/docker-compose-epmd.yaml index 3f99872e..e60c521f 100644 --- a/docker-compose-epmd.yaml +++ b/docker-compose-epmd.yaml @@ -1,11 +1,11 @@ version: "3" -x-jellyfish-template: &jellyfish-template +x-fishjam-template: &fishjam-template build: . - environment: &jellyfish-environment - JF_SERVER_API_TOKEN: "development" - JF_DIST_ENABLED: "true" - JF_DIST_NODES: "app@app1 app@app2" + environment: &fishjam-environment + FJ_SERVER_API_TOKEN: "development" + FJ_DIST_ENABLED: "true" + FJ_DIST_NODES: "app@app1 app@app2" restart: on-failure services: @@ -27,21 +27,21 @@ services: - app2 app1: - <<: *jellyfish-template + <<: *fishjam-template environment: - <<: *jellyfish-environment - JF_HOST: "localhost:4001" - JF_PORT: 4001 - JF_DIST_NODE_NAME: app@app1 + <<: *fishjam-environment + FJ_HOST: "localhost:4001" + FJ_PORT: 4001 + FJ_DIST_NODE_NAME: app@app1 ports: - 4001:4001 app2: - <<: *jellyfish-template + <<: *fishjam-template environment: - <<: *jellyfish-environment - JF_HOST: "localhost:4002" - JF_PORT: 4002 - JF_DIST_NODE_NAME: app@app2 + <<: *fishjam-environment + FJ_HOST: "localhost:4002" + FJ_PORT: 4002 + FJ_DIST_NODE_NAME: app@app2 ports: - 4002:4002 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4338d5e8..c81c1db6 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -11,10 +11,10 @@ log_debug() { if [ "$(id -u)" = '0' ]; then log_debug "Running as root. Fixing permissions for: \ - $(find . \! -user jellyfish -exec echo '{} \n' \;)" + $(find . \! -user fishjam -exec echo '{} \n' \;)" - find . \! -user jellyfish -exec chown jellyfish '{}' + - exec gosu jellyfish "$0" "$@" + find . \! -user fishjam -exec chown fishjam '{}' + + exec gosu fishjam "$0" "$@" fi log_debug "Running as user with UID: $(id -u) GID: $(id -g)" diff --git a/docs/api_versioning.md b/docs/api_versioning.md index 1081b123..584dd450 100644 --- a/docs/api_versioning.md +++ b/docs/api_versioning.md @@ -2,11 +2,11 @@ ## Motivation -The Jellyfish API consists of two transports: http REST API +The Fishjam API consists of two transports: http REST API and WebSocket using protobuf. The two APIs can be found in -the [api-description repository](https://github.com/jellyfish-dev/protos). +the [api-description repository](https://github.com/fishjam-dev/protos). -In order to ensure ease of use we introduce versioning to the Jellyfish API. +In order to ensure ease of use we introduce versioning to the Fishjam API. The versioning of the API provides reference points when comparing changes and allows to name compatible (and incompatible) versions of the API. @@ -14,15 +14,15 @@ versions of the API. ## Workflow Whenever it is possible, we try to introduce backward-compatible changes -in the API, allowing for a smoother transition between Jellyfish versions. +in the API, allowing for a smoother transition between Fishjam versions. -The API is versioned separately from Jellyfish, so a Jellyfish release +The API is versioned separately from Fishjam, so a Fishjam release does not necessarily cause a change to the API. When we decide to remove a particular functionality, we first mark -it as `deprecated` and only then remove it in a later version of Jellyfish. +it as `deprecated` and only then remove it in a later version of Fishjam. This makes the older versions of the SDKs still compatible with -newer Jellyfish until they are upgraded as well. +newer Fishjam until they are upgraded as well. ## Testing diff --git a/docs/authentication_architecture.md b/docs/authentication_architecture.md index 0545a19b..cc215dd2 100644 --- a/docs/authentication_architecture.md +++ b/docs/authentication_architecture.md @@ -4,31 +4,31 @@ - **CL** - client - **BE** - business logic (backend) implemented by the user -- **JF** - Jellyfish +- **FJ** - Fishjam ## Approaches and connection with signaling architecture Authentication might be a big factor when deciding on signaling architecture (see the other document). We need to consider 2 situations: -- **CL** connect directly do **JF**, -- **CL** connect to **BE** which forwards signaling messages to **JF**. +- **CL** connect directly do **FJ**, +- **CL** connect to **BE** which forwards signaling messages to **FJ**. Let's start with the first approach. -### Direct connection between **CL** and **JF** +### Direct connection between **CL** and **FJ** Let's assume **CL** wants to join some multimedia room and is already authenticated (from the bussines logic perspective, e.g. he is logged into his account). -Also, **JF** and **BE** share common secret (more about that later). +Also, **FJ** and **BE** share common secret (more about that later). Scenario: 1) **CL** sends request to join the multimedia room to **BE**. -2) **BE** recieves the request and sends `add_peer` request to **JF**. -3) **JF** sends back created `peer_id`. -4) **BE** uses received `peer_id` and id of the **JF** instance to create JWT that is signed with the secret (or the **JF** creates the token in the previous step). +2) **BE** recieves the request and sends `add_peer` request to **FJ**. +3) **FJ** sends back created `peer_id`. +4) **BE** uses received `peer_id` and id of the **FJ** instance to create JWT that is signed with the secret (or the **FJ** creates the token in the previous step). The token can also contain permissions (which may differ between "normal" clients and administrators). 5) **BE** responds to **CL** with the token. -6) **CL** can now open WebSocket connection to **JF** using the token to authorize themselves. **JF** (thanks to informations included in the token) -can tell who opened the connection and that it was intended for this instance of **JF**. +6) **CL** can now open WebSocket connection to **FJ** using the token to authorize themselves. **FJ** (thanks to informations included in the token) +can tell who opened the connection and that it was intended for this instance of **FJ**. Problems: @@ -55,23 +55,23 @@ to think if we want to use the token to tag the signaling messages (seems unnece ### **BE** -If **BE** (server SDK) is responsible for creating tokens, then it has to know the secret that will be used in signing JWT. It also needs `peer_id`, which can be obtained from **JF**. That takes care of **CL** authorization, but we also need to authorize **BE** - **JF** connection. One possible solution is to use the very same secret as before to create tokens that will be used by **BE**. So **BE** will generate token and then, instead of sending them to client, will use it itself (which may seem wierd, but we came to conclusion that the approach is alright). +If **BE** (server SDK) is responsible for creating tokens, then it has to know the secret that will be used in signing JWT. It also needs `peer_id`, which can be obtained from **FJ**. That takes care of **CL** authorization, but we also need to authorize **BE** - **FJ** connection. One possible solution is to use the very same secret as before to create tokens that will be used by **BE**. So **BE** will generate token and then, instead of sending them to client, will use it itself (which may seem wierd, but we came to conclusion that the approach is alright). -This approach only makes sense when using direct signaling, otherwise tokens are not necessary at all (except for **BE** - **JF** connection). +This approach only makes sense when using direct signaling, otherwise tokens are not necessary at all (except for **BE** - **FJ** connection). -### **JF** +### **FJ** -In this approach **JF** creates the tokens (when using `add_peer`, token is send in the response), so user only needs to pass it to the **CL**. -You also might need to pass expected token presmissions to **JF**. -Despite that, we still need a way to authenticate **BE** - **JF** connection. Possible solutions: +In this approach **FJ** creates the tokens (when using `add_peer`, token is send in the response), so user only needs to pass it to the **CL**. +You also might need to pass expected token presmissions to **FJ**. +Despite that, we still need a way to authenticate **BE** - **FJ** connection. Possible solutions: -- create JWT on **BE** side anyway (in such case you might as well use the first approach in order not to split logic responsible for token generation between Server SDK and Jellyfish), +- create JWT on **BE** side anyway (in such case you might as well use the first approach in order not to split logic responsible for token generation between Server SDK and Fishjam), - create JWT (or some other token type) once and use it in configuration (makes it easier to change **BE** permissions, if that's ever necessary, but the token never expires, I'm not sure whether that's a problem, also **BE** doesn't need to know the secret). No matter who generates the tokens, effort from the user comes to passing the token to **CL** (in direct signaling, otherwise no need to do anything except for creating the signalling connection). ## Consclusion -We will be using **JF** to generate tokens, as it makes it easier to maintain (we don't need to implement token generation in all of our SDKs) and we keep all of the logic responsible for generation and validation together. -Also, **BE** authentication might not be very difficult: they may just share a common secret and use it directly to authenticate (e.g. via HTTP authorization request header), especially when **JF** and **BE** are in the same internal -network, which will be a common case. Using **BE** to generate tokens could also make it harder to make modifications related to tokens (need to redeploy both **JF** and **BE** in such case). +We will be using **FJ** to generate tokens, as it makes it easier to maintain (we don't need to implement token generation in all of our SDKs) and we keep all of the logic responsible for generation and validation together. +Also, **BE** authentication might not be very difficult: they may just share a common secret and use it directly to authenticate (e.g. via HTTP authorization request header), especially when **FJ** and **BE** are in the same internal +network, which will be a common case. Using **BE** to generate tokens could also make it harder to make modifications related to tokens (need to redeploy both **FJ** and **BE** in such case). diff --git a/docs/server_notifications.md b/docs/server_notifications.md index e453f4a7..041af857 100644 --- a/docs/server_notifications.md +++ b/docs/server_notifications.md @@ -1,6 +1,6 @@ # Server notifications -Client SDKs communicate with Jellyfish using so called Control Messages (CM), which are messages exchanged using Websockets. +Client SDKs communicate with Fishjam using so called Control Messages (CM), which are messages exchanged using Websockets. A few examples when Control Messages are sent: * `join` - sent when peer joins WebRTC room @@ -15,7 +15,7 @@ In general we have two major options here: ### JSON -JSON has been used for a long time in [membrane_rtc_engine](https://github.com/jellyfish-dev/membrane_rtc_engine). +JSON has been used for a long time in [membrane_rtc_engine](https://github.com/fishjam-dev/membrane_rtc_engine). This solution has several drawbacks: * there is no versioning so it’s hard to track which version of CM is used on the server side and which one on the client side @@ -136,7 +136,7 @@ AsyncAPI and JsonSchema would be quite difficult to implement since we would hav GraphQL in general could be useful in our case, however there are a couple issues which overall would probably cause us headaches: * No code generator for Elixir - we would have to implement schema using `Absinthe.Schema`. From Elixir code we could generate GraphQL Schema and use it for generating code in other languages. -* No single code generator for all languages. This means we would have to find and integrate a separate code generator for each SDK. This may not be a problem for 2-3 SDK but would also likely discourage external developers from using Jellyfish. +* No single code generator for all languages. This means we would have to find and integrate a separate code generator for each SDK. This may not be a problem for 2-3 SDK but would also likely discourage external developers from using Fishjam. * Issues with maintaining signalling connection - so far we haven't found simple or non-hacky way of monitoring whether the client-server websocket connection is alive. Absinthe doesn't allow for access to the tcp socket. Overall it feels like our requirements are very specific in the context of GraphQL use-case and we would be be using it on the edge of what it was designed for in the first place. diff --git a/docs/signaling_architecture.md b/docs/signaling_architecture.md index 719c6619..7d2b6c35 100644 --- a/docs/signaling_architecture.md +++ b/docs/signaling_architecture.md @@ -4,76 +4,76 @@ - **CL** - client - **BE** - business logic (backend) implemented by the user -- **JF** - Jellyfish +- **FJ** - Fishjam ## Approaches Currently we consider three approaches to the signaling implementation: -- direct connection between **CL** and **JF** bypassing **BE**, +- direct connection between **CL** and **FJ** bypassing **BE**, - using **BE** as a middleman to pass signaling messages, - ability to use either of the options above, but providing some default implementation (i.e provide default implementation of direct signaling, but let the user replace it with his own implementation). ### Direct connection -**CL** must be able to open connection to **JF** (e.g. WebSocket). For that **CL** requires **JF** address and some form of authentication. +**CL** must be able to open connection to **FJ** (e.g. WebSocket). For that **CL** requires **FJ** address and some form of authentication. **Example:** 1) **CL** sends request to **BE** to join some room (meeting, webinar etc.). -2) **BE** sends request to **JF** (*add_peer*). -3) **JF** responds positively. +2) **BE** sends request to **FJ** (*add_peer*). +3) **FJ** responds positively. 4) **BE** responds to client positively with generated token. -5) **CL** opens WebSocket connection to **JF**, flow of signaling messages begins. +5) **CL** opens WebSocket connection to **FJ**, flow of signaling messages begins. -**JF** can diferentiate between the clients by the opened WebSocket connection. It knows +**FJ** can diferentiate between the clients by the opened WebSocket connection. It knows who is the sender of incoming Media Events and where to send generated Media Events. **Advantages:** - Easier option, the user doesn't have to do much more than passing authentication token to **CL**, client SDK handles the rest. -- Both **CL** and **JF** can tell when signaling connection was broken. That prevents situation when signaling connection between **CL** and **BE** was broken, but **BE** -did not notify **JF** of such occurence, is that case media is still flowing with no signaling (when new peer joins, tracks are not renegotiated, etc.). +- Both **CL** and **FJ** can tell when signaling connection was broken. That prevents situation when signaling connection between **CL** and **BE** was broken, but **BE** +did not notify **FJ** of such occurence, is that case media is still flowing with no signaling (when new peer joins, tracks are not renegotiated, etc.). **Disadvantages:** - **CL** has to participate in the authentication process (so they probably need to be -authenticated by **BE** and then authenticated again to open connection to **JF**). -- Some events can get desynchronized. Imagine scenerio where **JF** sent notification to +authenticated by **BE** and then authenticated again to open connection to **FJ**). +- Some events can get desynchronized. Imagine scenerio where **FJ** sent notification to **BE** that recording has begun (it is **BE**'s responibility to propagate this information to clients so they can show some icon indicator). At the same time, media and signaling connections were broken for some reason. -For a brief moment (until **JF** passes that information to **BE** and **BE** passes +For a brief moment (until **FJ** passes that information to **BE** and **BE** passes it to **CL**) **CL** might think that their screen is being recorded even though that is not the case (situation in this example can be prevented, but I hope you get the gist). ### Using **BE** as a middleman -Client SDK generates signaling messages, but requires the user to implement logic that handles forwarding them to **JF** (using **BE** in described scenario). +Client SDK generates signaling messages, but requires the user to implement logic that handles forwarding them to **FJ** (using **BE** in described scenario). **Exmaple:** 1) **CL** sends request to **BE** to join some room (meeting, webinar etc.). -2) **BE** sends request to **JF** (*add_peer*). -3) **JF** responds positively. +2) **BE** sends request to **FJ** (*add_peer*). +3) **FJ** responds positively. 4) **BE** responds to client positively. -5) **CL** starts generating signaling messages which are forwarded to **JF** by **BE**. +5) **CL** starts generating signaling messages which are forwarded to **FJ** by **BE**. In that case we need a way to identify the sender of signaling messages, we thought of 2 approaches (you'r welcome to suggest a better one): -- make **BE** open WebSocket connection to **JF** for every client (here seems like a very bad idea, makes a bit more sense in the mixed approach described later), -- tag every signaling message with something like `peer_id`, requires only one WebSocket connection between **BE** and **JF** (should SDK do this, or should it be the users responsibility?). +- make **BE** open WebSocket connection to **FJ** for every client (here seems like a very bad idea, makes a bit more sense in the mixed approach described later), +- tag every signaling message with something like `peer_id`, requires only one WebSocket connection between **BE** and **FJ** (should SDK do this, or should it be the users responsibility?). **Advantages:** -- Easy to implement (from our, Jellyfish developers, perspective). +- Easy to implement (from our, Fishjam developers, perspective). - **CL** does not require additional connection and authentication, everything is handled by **BE**. **Disadvantages:** -- Harder to implement by the user, much more error-prone (isn't that the point of Jellyfish to make it as simple as possible?). +- Harder to implement by the user, much more error-prone (isn't that the point of Fishjam to make it as simple as possible?). - Encourages the user to implement logic that relies on content of signaling messages (at least while it's JSON) which they should treat as a "black box". ### Mixed approach @@ -83,7 +83,7 @@ We assume that only one approach is being used at once (there cannot be a situat Now the problem with identifying signaling messages becomes much more apparent. -If signaling messages are individually tagged, when using direct connection approach there's some redundancy (**JF** doesn't need the "tag", it can tell who +If signaling messages are individually tagged, when using direct connection approach there's some redundancy (**FJ** doesn't need the "tag", it can tell who is who by the WebSocket connection), but the tags are necessary when using **BE** as a middleman. Obviously, we can handle each situation differently and not tag messages passed in direct connection, but that makes the implementation much more complicated. @@ -105,5 +105,5 @@ On the other hand, when tags are not used, there's everything alright with direc The approach that we are going to use is the **direct connection**, mostly because it's a lot easier for the user to implement (which outweights benefits like the flexibility of the other approach). Also, the drawbacks seem not to be very severe: some of the information about the state of rooms and peers (like the fact that recording has begun) can be -kept and shared by **JF** via the signalling connection. +kept and shared by **FJ** via the signalling connection. Mixed approach is not considered at the moment (as it brings some difficulties) but can be added in the future if there's need. diff --git a/examples/README.md b/examples/README.md index a11af330..9eb9dfaf 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,17 +1,17 @@ -# Jellyfish examples +# Fishjam examples -This directory contains example Elixir scripts for the most common Jellyfish use cases, +This directory contains example Elixir scripts for the most common Fishjam use cases, as well as the instructions necessary to run them. ## RTSP to HLS ### Elixir -1. Start a local instance of Jellyfish (e.g. by running `mix phx.server`) +1. Start a local instance of Fishjam (e.g. by running `mix phx.server`) 2. Run `elixir ./rtsp_to_hls.exs "rtsp://your-rtsp-stream-source:port/stream"` ### Python -1. Install the Jellyfish Python Server SDK: `pip install jellyfish-server-sdk` -2. Start a local instance of Jellyfish (e.g. by running `mix phx.server`) +1. Install the Fishjam Python Server SDK: `pip install fishjam-server-sdk` +2. Start a local instance of Fishjam (e.g. by running `mix phx.server`) 3. Run `python3 ./rtsp_to_hls.py "rtsp://your-rtsp-stream-source:port/stream"` diff --git a/examples/rtsp_to_hls.exs b/examples/rtsp_to_hls.exs index cbb0a795..d6e5d10c 100644 --- a/examples/rtsp_to_hls.exs +++ b/examples/rtsp_to_hls.exs @@ -1,36 +1,36 @@ Mix.install([ - # Keep in mind that you should lock onto a specific version of Jellyfish - # and the Jellyfish Server SDK in production code - {:jellyfish_server_sdk, github: "jellyfish-dev/elixir_server_sdk"} + # Keep in mind that you should lock onto a specific version of Fishjam + # and the Fishjam Server SDK in production code + {:fishjam_server_sdk, github: "fishjam-dev/elixir_server_sdk"} ]) defmodule Example do require Logger - @jellyfish_hostname "localhost" - @jellyfish_port 5002 - @jellyfish_token "development" + @fishjam_hostname "localhost" + @fishjam_port 5002 + @fishjam_token "development" def run(stream_uri) do client = - Jellyfish.Client.new( - server_address: "#{@jellyfish_hostname}:#{@jellyfish_port}", - server_api_token: @jellyfish_token + Fishjam.Client.new( + server_address: "#{@fishjam_hostname}:#{@fishjam_port}", + server_api_token: @fishjam_token ) - with {:ok, %Jellyfish.Room{id: room_id}, _jellyfish_address} <- - Jellyfish.Room.create(client, video_codec: :h264), - {:ok, %Jellyfish.Component{id: _hls_component_id}} <- - Jellyfish.Room.add_component(client, room_id, Jellyfish.Component.HLS), - {:ok, %Jellyfish.Component{id: _rtsp_component_id}} <- - Jellyfish.Room.add_component(client, room_id, %Jellyfish.Component.RTSP{ + with {:ok, %Fishjam.Room{id: room_id}, _fishjam_address} <- + Fishjam.Room.create(client, video_codec: :h264), + {:ok, %Fishjam.Component{id: _hls_component_id}} <- + Fishjam.Room.add_component(client, room_id, Fishjam.Component.HLS), + {:ok, %Fishjam.Component{id: _rtsp_component_id}} <- + Fishjam.Room.add_component(client, room_id, %Fishjam.Component.RTSP{ source_uri: stream_uri }) do Logger.info("Components added successfully") else {:error, reason} -> Logger.error(""" - Error when attempting to communicate with Jellyfish: #{inspect(reason)} + Error when attempting to communicate with Fishjam: #{inspect(reason)} Make sure you have started it by running `mix phx.server` """) end diff --git a/examples/rtsp_to_hls.py b/examples/rtsp_to_hls.py index 6a362054..b903afc5 100644 --- a/examples/rtsp_to_hls.py +++ b/examples/rtsp_to_hls.py @@ -1,12 +1,12 @@ import sys -# You can install the Jellyfish Python Server SDK by running `pip install jellyfish-server-sdk` -from jellyfish import RoomApi, ComponentOptionsHLS, ComponentOptionsRTSP +# You can install the Fishjam Python Server SDK by running `pip install fishjam-server-sdk` +from fishjam import RoomApi, ComponentOptionsHLS, ComponentOptionsRTSP -JELLYFISH_HOSTNAME="localhost" -JELLYFISH_PORT=5002 -JELLYFISH_TOKEN="development" +FISHJAM_HOSTNAME="localhost" +FISHJAM_PORT=5002 +FISHJAM_TOKEN="development" if len(sys.argv) > 1: @@ -15,9 +15,9 @@ raise RuntimeError("No stream URI specified, make sure you pass it as the argument to this script") try: - room_api = RoomApi(server_address=f"{JELLYFISH_HOSTNAME}:{JELLYFISH_PORT}", server_api_token=JELLYFISH_TOKEN) + room_api = RoomApi(server_address=f"{FISHJAM_HOSTNAME}:{FISHJAM_PORT}", server_api_token=FISHJAM_TOKEN) - _jellyfish_address, room = room_api.create_room(video_codec="h264") + _fishjam_address, room = room_api.create_room(video_codec="h264") _component_hls = room_api.add_component(room.id, options=ComponentOptionsHLS()) _component_rtsp = room_api.add_component(room.id, options=ComponentOptionsRTSP(source_uri=stream_uri)) @@ -25,7 +25,7 @@ except Exception as e: print(f""" - Error when attempting to communicate with Jellyfish: {e} + Error when attempting to communicate with Fishjam: {e} Make sure you have started it by running `mix phx.server` """) sys.exit(1) diff --git a/grafana/jellyfish-server-overiew.json b/grafana/jellyfish-server-overiew.json index ad6a2a48..ffb97e1e 100644 --- a/grafana/jellyfish-server-overiew.json +++ b/grafana/jellyfish-server-overiew.json @@ -88,7 +88,7 @@ "uid": "PBFA97CFB590B2093" }, "editorMode": "code", - "expr": "sum(jellyfish_rooms{instance=~\"$instance\"}) by(instance)", + "expr": "sum(fishjam_rooms{instance=~\"$instance\"}) by(instance)", "instant": false, "legendFormat": "{{instance}}", "range": true, @@ -103,7 +103,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "Present the current number of rooms by jellyfish instance.", + "description": "Present the current number of rooms by fishjam instance.", "fieldConfig": { "defaults": { "color": { @@ -186,7 +186,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "sum(jellyfish_rooms{instance=~\"$instance\"}) by(instance)", + "expr": "sum(fishjam_rooms{instance=~\"$instance\"}) by(instance)", "instant": false, "legendFormat": "{{instance}}", "range": true, @@ -211,7 +211,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "Ingress throughput from each of the jellyfish instances", + "description": "Ingress throughput from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -293,7 +293,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "irate(jellyfish_traffic_ingress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+ \nirate(jellyfish_traffic_ingress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", + "expr": "irate(fishjam_traffic_ingress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+ \nirate(fishjam_traffic_ingress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", "instant": false, "legendFormat": "{{instance}}", "range": true, @@ -308,7 +308,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "Egress throughput from each of the jellyfish instances", + "description": "Egress throughput from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -390,7 +390,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "irate(jellyfish_traffic_egress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(jellyfish_traffic_egress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", + "expr": "irate(fishjam_traffic_egress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(fishjam_traffic_egress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", "instant": false, "legendFormat": "{{instance}}", "range": true, @@ -405,7 +405,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "Ingress and Egress throughput from each of the jellyfish instances", + "description": "Ingress and Egress throughput from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -503,7 +503,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "irate(jellyfish_traffic_ingress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(jellyfish_traffic_ingress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", + "expr": "irate(fishjam_traffic_ingress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(fishjam_traffic_ingress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", "instant": false, "legendFormat": "{{instance}} ingress", "range": true, @@ -515,7 +515,7 @@ "uid": "${ds}" }, "editorMode": "code", - "expr": "irate(jellyfish_traffic_egress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(jellyfish_traffic_egress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", + "expr": "irate(fishjam_traffic_egress_webrtc_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8\n+\nirate(fishjam_traffic_egress_http_total_bytes{instance=~\"$instance\"}[$__rate_interval])*8", "hide": false, "instant": false, "legendFormat": "{{instance}} egress", @@ -545,7 +545,7 @@ "type": "prometheus", "uid": "${ds}" }, - "description": "VM usage from each of the jellyfish instances", + "description": "VM usage from each of the fishjam instances", "fieldConfig": { "defaults": { "color": { @@ -679,7 +679,7 @@ "type": "prometheus", "uid": "PBFA97CFB590B2093" }, - "definition": "label_values(jellyfish_rooms,instance)", + "definition": "label_values(fishjam_rooms,instance)", "description": "Allows you limit graphs only to selected instances", "hide": 0, "includeAll": true, @@ -688,7 +688,7 @@ "name": "instance", "options": [], "query": { - "query": "label_values(jellyfish_rooms,instance)", + "query": "label_values(fishjam_rooms,instance)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, @@ -705,7 +705,7 @@ }, "timepicker": {}, "timezone": "", - "title": "Jellyfishes dashboard", + "title": "Fishjams dashboard", "uid": "ef7bdb94-c912-49ac-a273-e7a31598001a", "version": 48, "weekStart": "" diff --git a/lib/jellyfish.ex b/lib/jellyfish.ex index 144ed968..3dafd640 100644 --- a/lib/jellyfish.ex +++ b/lib/jellyfish.ex @@ -1,6 +1,6 @@ -defmodule Jellyfish do +defmodule Fishjam do @moduledoc """ - Jellyfish keeps the contexts that define your domain + Fishjam keeps the contexts that define your domain and business logic. Contexts are also responsible for managing your data, regardless @@ -13,11 +13,11 @@ defmodule Jellyfish do @spec address() :: binary() def address() do - Application.fetch_env!(:jellyfish, :address) + Application.fetch_env!(:fishjam, :address) end @spec peer_websocket_address() :: binary() def peer_websocket_address() do - Application.fetch_env!(:jellyfish, :address) <> "/socket/peer/websocket" + Application.fetch_env!(:fishjam, :address) <> "/socket/peer/websocket" end end diff --git a/lib/jellyfish/application.ex b/lib/jellyfish/application.ex index 1beba9d8..0092e9bd 100644 --- a/lib/jellyfish/application.ex +++ b/lib/jellyfish/application.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Application do +defmodule Fishjam.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false @@ -16,38 +16,38 @@ defmodule Jellyfish.Application do @impl true def start(_type, _args) do - scrape_interval = Application.fetch_env!(:jellyfish, :webrtc_metrics_scrape_interval) - dist_config = Application.fetch_env!(:jellyfish, :dist_config) - webrtc_config = Application.fetch_env!(:jellyfish, :webrtc_config) - git_commit = Application.get_env(:jellyfish, :git_commit) - components_used = Application.get_env(:jellyfish, :components_used) + scrape_interval = Application.fetch_env!(:fishjam, :webrtc_metrics_scrape_interval) + dist_config = Application.fetch_env!(:fishjam, :dist_config) + webrtc_config = Application.fetch_env!(:fishjam, :webrtc_config) + git_commit = Application.get_env(:fishjam, :git_commit) + components_used = Application.get_env(:fishjam, :components_used) - Logger.info("Starting Jellyfish v#{Jellyfish.version()} (#{git_commit})") + Logger.info("Starting Fishjam v#{Fishjam.version()} (#{git_commit})") Logger.info("Distribution config: #{inspect(Keyword.delete(dist_config, :cookie))}") Logger.info("WebRTC config: #{inspect(webrtc_config)}") Logger.info("Allowed components: #{inspect(components_used)}") children = [ - {Phoenix.PubSub, name: Jellyfish.PubSub}, + {Phoenix.PubSub, name: Fishjam.PubSub}, {Membrane.TelemetryMetrics.Reporter, [ metrics: Membrane.RTC.Engine.Endpoint.WebRTC.Metrics.metrics(), - name: JellyfishMetricsReporter + name: FishjamMetricsReporter ]}, - {Jellyfish.MetricsScraper, scrape_interval}, - JellyfishWeb.Endpoint, + {Fishjam.MetricsScraper, scrape_interval}, + FishjamWeb.Endpoint, # Start the RoomService - Jellyfish.RoomService, + Fishjam.RoomService, # Start the ResourceManager, responsible for cleaning old recordings - {Jellyfish.ResourceManager, @resource_manager_opts}, - Jellyfish.WebhookNotifier, - {Registry, keys: :unique, name: Jellyfish.RoomRegistry}, - {Registry, keys: :unique, name: Jellyfish.RequestHandlerRegistry}, - # Start the Telemetry supervisor (must be started after Jellyfish.RoomRegistry) - JellyfishWeb.Telemetry, - {Task.Supervisor, name: Jellyfish.TaskSupervisor}, - {DynamicSupervisor, name: Jellyfish.HLS.ManagerSupervisor, strategy: :one_for_one} + {Fishjam.ResourceManager, @resource_manager_opts}, + Fishjam.WebhookNotifier, + {Registry, keys: :unique, name: Fishjam.RoomRegistry}, + {Registry, keys: :unique, name: Fishjam.RequestHandlerRegistry}, + # Start the Telemetry supervisor (must be started after Fishjam.RoomRegistry) + FishjamWeb.Telemetry, + {Task.Supervisor, name: Fishjam.TaskSupervisor}, + {DynamicSupervisor, name: Fishjam.HLS.ManagerSupervisor, strategy: :one_for_one} ] ++ if dist_config[:enabled] do config_distribution(dist_config) @@ -60,15 +60,15 @@ defmodule Jellyfish.Application do # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options - opts = [strategy: :one_for_one, name: Jellyfish.Supervisor] + opts = [strategy: :one_for_one, name: Fishjam.Supervisor] - Application.put_env(:jellyfish, :start_time, System.monotonic_time(:second)) + Application.put_env(:fishjam, :start_time, System.monotonic_time(:second)) result = Supervisor.start_link(children, opts) # If we do not set a default value for WebRTC metrics, # the metrics will be sent from the moment the first peer joins a room. - JellyfishWeb.Telemetry.default_webrtc_metrics() + FishjamWeb.Telemetry.default_webrtc_metrics() result end @@ -77,14 +77,14 @@ defmodule Jellyfish.Application do # whenever the application is updated. @impl true def config_change(changed, _new, removed) do - JellyfishWeb.Endpoint.config_change(changed, removed) + FishjamWeb.Endpoint.config_change(changed, removed) :ok end defp config_distribution(dist_config) do :ok = ensure_epmd_started!() - # When running JF not in a cluster and using + # When running FJ not in a cluster and using # mix release, it starts in the distributed mode # automatically unless Node.alive?() do @@ -93,7 +93,7 @@ defmodule Jellyfish.Application do :ok {:error, reason} -> - raise "Couldn't start Jellyfish node, reason: #{inspect(reason)}" + raise "Couldn't start Fishjam node, reason: #{inspect(reason)}" end Node.set_cookie(dist_config[:cookie]) @@ -106,7 +106,7 @@ defmodule Jellyfish.Application do ] ] - [{Cluster.Supervisor, [topologies, [name: Jellyfish.ClusterSupervisor]]}] + [{Cluster.Supervisor, [topologies, [name: Fishjam.ClusterSupervisor]]}] end defp ensure_epmd_started!() do @@ -119,12 +119,12 @@ defmodule Jellyfish.Application do _exit_or_error, _e -> raise """ Couldn't start epmd daemon. - Epmd is required to run Jellyfish in distributed mode. + Epmd is required to run Fishjam in distributed mode. You can try to start it manually with: epmd -daemon - and run Jellyfish again. + and run Fishjam again. """ end diff --git a/lib/jellyfish/component.ex b/lib/jellyfish/component.ex index a8bbc219..1cd2e663 100644 --- a/lib/jellyfish/component.ex +++ b/lib/jellyfish/component.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Component do +defmodule Fishjam.Component do @moduledoc """ Component is a server side entity that can publish a track, subscribe to tracks and process them. @@ -10,9 +10,9 @@ defmodule Jellyfish.Component do use Bunch.Access - alias Jellyfish.Room - alias Jellyfish.Component.{File, HLS, Recording, RTSP, SIP} - alias Jellyfish.Track + alias Fishjam.Room + alias Fishjam.Component.{File, HLS, Recording, RTSP, SIP} + alias Fishjam.Track @enforce_keys [ :id, @@ -67,7 +67,7 @@ defmodule Jellyfish.Component do defmacro __using__(_opts) do quote location: :keep do - @behaviour Jellyfish.Component + @behaviour Fishjam.Component @impl true def after_init(_room_state, _component, _component_options), do: :ok diff --git a/lib/jellyfish/component/file.ex b/lib/jellyfish/component/file.ex index 3c465aff..70aa6f04 100644 --- a/lib/jellyfish/component/file.ex +++ b/lib/jellyfish/component/file.ex @@ -1,16 +1,16 @@ -defmodule Jellyfish.Component.File do +defmodule Fishjam.Component.File do @moduledoc """ Module representing the File component. """ - @behaviour Jellyfish.Endpoint.Config - use Jellyfish.Component + @behaviour Fishjam.Endpoint.Config + use Fishjam.Component alias ExSDP.Attribute.FMTP alias Membrane.RTC.Engine.Endpoint.File, as: FileEndpoint - alias Jellyfish.Utils.PathValidation - alias JellyfishWeb.ApiSpec.Component.File.Options + alias Fishjam.Utils.PathValidation + alias FishjamWeb.ApiSpec.Component.File.Options @type properties :: %{ file_path: Path.t(), @@ -61,7 +61,7 @@ defmodule Jellyfish.Component.File do defp validate_file_path(file_path) do base_path = - Application.fetch_env!(:jellyfish, :media_files_path) + Application.fetch_env!(:fishjam, :media_files_path) |> Path.join(@files_location) |> Path.expand() @@ -75,7 +75,7 @@ defmodule Jellyfish.Component.File do end defp expand_file_path(file_path) do - media_files_path = Application.fetch_env!(:jellyfish, :media_files_path) + media_files_path = Application.fetch_env!(:fishjam, :media_files_path) [media_files_path, @files_location, file_path] |> Path.join() |> Path.expand() end diff --git a/lib/jellyfish/component/hls.ex b/lib/jellyfish/component/hls.ex index ace0bd2d..fe64aae1 100644 --- a/lib/jellyfish/component/hls.ex +++ b/lib/jellyfish/component/hls.ex @@ -1,12 +1,12 @@ -defmodule Jellyfish.Component.HLS do +defmodule Fishjam.Component.HLS do @moduledoc """ Module representing HLS component. """ - @behaviour Jellyfish.Endpoint.Config - use Jellyfish.Component + @behaviour Fishjam.Endpoint.Config + use Fishjam.Component - alias Jellyfish.Component.HLS.{ + alias Fishjam.Component.HLS.{ EtsHelper, LLStorage, Manager, @@ -15,9 +15,9 @@ defmodule Jellyfish.Component.HLS do Storage } - alias Jellyfish.Room + alias Fishjam.Room - alias JellyfishWeb.ApiSpec.Component.HLS.Options + alias FishjamWeb.ApiSpec.Component.HLS.Options alias Membrane.RTC.Engine.Endpoint.HLS alias Membrane.RTC.Engine.Endpoint.HLS.{CompositorConfig, HLSConfig, MixerConfig} @@ -97,7 +97,7 @@ defmodule Jellyfish.Component.HLS do end def output_dir(room_id, persistent: false) do - base_path = Application.fetch_env!(:jellyfish, :media_files_path) + base_path = Application.fetch_env!(:fishjam, :media_files_path) Path.join([base_path, "temporary_hls", "#{room_id}"]) end diff --git a/lib/jellyfish/component/hls/ets_helper.ex b/lib/jellyfish/component/hls/ets_helper.ex index f8d11232..3f27bc18 100644 --- a/lib/jellyfish/component/hls/ets_helper.ex +++ b/lib/jellyfish/component/hls/ets_helper.ex @@ -1,7 +1,7 @@ -defmodule Jellyfish.Component.HLS.EtsHelper do +defmodule Fishjam.Component.HLS.EtsHelper do @moduledoc false - alias Jellyfish.Room + alias Fishjam.Room @rooms_to_tables :rooms_to_tables diff --git a/lib/jellyfish/component/hls/httpoison.ex b/lib/jellyfish/component/hls/httpoison.ex index 4a506e0f..50f3d865 100644 --- a/lib/jellyfish/component/hls/httpoison.ex +++ b/lib/jellyfish/component/hls/httpoison.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Component.HLS.HTTPoison do +defmodule Fishjam.Component.HLS.HTTPoison do @moduledoc false @behaviour ExAws.Request.HttpClient diff --git a/lib/jellyfish/component/hls/ll_storage.ex b/lib/jellyfish/component/hls/ll_storage.ex index 20d5b5c7..ef3f5fef 100644 --- a/lib/jellyfish/component/hls/ll_storage.ex +++ b/lib/jellyfish/component/hls/ll_storage.ex @@ -1,10 +1,10 @@ -defmodule Jellyfish.Component.HLS.LLStorage do +defmodule Fishjam.Component.HLS.LLStorage do @moduledoc false @behaviour Membrane.HTTPAdaptiveStream.Storage - alias Jellyfish.Component.HLS.{EtsHelper, RequestHandler} - alias Jellyfish.Room + alias Fishjam.Component.HLS.{EtsHelper, RequestHandler} + alias Fishjam.Room @enforce_keys [:directory, :room_id] defstruct @enforce_keys ++ diff --git a/lib/jellyfish/component/hls/manager.ex b/lib/jellyfish/component/hls/manager.ex index 2812220d..f56f2ccf 100644 --- a/lib/jellyfish/component/hls/manager.ex +++ b/lib/jellyfish/component/hls/manager.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Component.HLS.Manager do +defmodule Fishjam.Component.HLS.Manager do @moduledoc """ Module responsible for HLS processing. It: @@ -11,8 +11,8 @@ defmodule Jellyfish.Component.HLS.Manager do require Logger - alias Jellyfish.Event - alias Jellyfish.Room + alias Fishjam.Event + alias Fishjam.Room @hls_extensions [".m4s", ".m3u8", ".mp4"] @playlist_content_type "application/vnd.apple.mpegurl" @@ -27,7 +27,7 @@ defmodule Jellyfish.Component.HLS.Manager do @spec start(Room.id(), pid(), String.t(), map()) :: {:ok, pid()} | {:error, term()} def start(room_id, engine_pid, hls_dir, hls_options) do DynamicSupervisor.start_child( - Jellyfish.HLS.ManagerSupervisor, + Fishjam.HLS.ManagerSupervisor, {__MODULE__, %{room_id: room_id, engine_pid: engine_pid, hls_dir: hls_dir, hls_options: hls_options}} ) diff --git a/lib/jellyfish/component/hls/recording.ex b/lib/jellyfish/component/hls/recording.ex index 95c636f1..b2e05e45 100644 --- a/lib/jellyfish/component/hls/recording.ex +++ b/lib/jellyfish/component/hls/recording.ex @@ -1,9 +1,9 @@ -defmodule Jellyfish.Component.HLS.Recording do +defmodule Fishjam.Component.HLS.Recording do @moduledoc false - alias Jellyfish.Component.HLS.EtsHelper - alias Jellyfish.Room - alias Jellyfish.Utils.PathValidation + alias Fishjam.Component.HLS.EtsHelper + alias Fishjam.Room + alias Fishjam.Utils.PathValidation @recordings_folder "recordings" @@ -45,7 +45,7 @@ defmodule Jellyfish.Component.HLS.Recording do end defp root_directory() do - Application.fetch_env!(:jellyfish, :media_files_path) + Application.fetch_env!(:fishjam, :media_files_path) |> Path.join(@recordings_folder) |> Path.expand() end diff --git a/lib/jellyfish/component/hls/request_handler.ex b/lib/jellyfish/component/hls/request_handler.ex index 36720fa1..e8bbd303 100644 --- a/lib/jellyfish/component/hls/request_handler.ex +++ b/lib/jellyfish/component/hls/request_handler.ex @@ -1,12 +1,12 @@ -defmodule Jellyfish.Component.HLS.RequestHandler do +defmodule Fishjam.Component.HLS.RequestHandler do @moduledoc false use GenServer use Bunch.Access - alias Jellyfish.Utils.PathValidation - alias Jellyfish.Component.HLS.{EtsHelper, Recording} - alias Jellyfish.Room + alias Fishjam.Utils.PathValidation + alias Fishjam.Component.HLS.{EtsHelper, Recording} + alias Fishjam.Room @enforce_keys [:room_id, :room_pid] defstruct @enforce_keys ++ @@ -300,7 +300,7 @@ defmodule Jellyfish.Component.HLS.RequestHandler do |> List.to_tuple() end - defp registry_id(room_id), do: {:via, Registry, {Jellyfish.RequestHandlerRegistry, room_id}} + defp registry_id(room_id), do: {:via, Registry, {Fishjam.RequestHandlerRegistry, room_id}} defp send_partial_ready(waiting_pids) do Enum.each(waiting_pids, fn pid -> send(pid, :manifest_ready) end) diff --git a/lib/jellyfish/component/hls/storage.ex b/lib/jellyfish/component/hls/storage.ex index d989218b..c8f23c1f 100644 --- a/lib/jellyfish/component/hls/storage.ex +++ b/lib/jellyfish/component/hls/storage.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Component.HLS.Storage do +defmodule Fishjam.Component.HLS.Storage do @moduledoc false @behaviour Membrane.HTTPAdaptiveStream.Storage @@ -27,7 +27,7 @@ defmodule Jellyfish.Component.HLS.Storage do write_to_file(directory, name, content, [:binary]) %{mode: :binary, type: :partial_segment} -> - raise "This storage doesn't support ll-hls. Use `Jellyfish.Component.HLS.LLStorage` instead" + raise "This storage doesn't support ll-hls. Use `Fishjam.Component.HLS.LLStorage` instead" %{mode: :binary, type: :header} -> write_to_file(directory, name, content, [:binary]) diff --git a/lib/jellyfish/component/recording.ex b/lib/jellyfish/component/recording.ex index b8036990..772159ca 100644 --- a/lib/jellyfish/component/recording.ex +++ b/lib/jellyfish/component/recording.ex @@ -1,19 +1,19 @@ -defmodule Jellyfish.Component.Recording do +defmodule Fishjam.Component.Recording do @moduledoc """ Module representing the Recording component. """ - @behaviour Jellyfish.Endpoint.Config - use Jellyfish.Component + @behaviour Fishjam.Endpoint.Config + use Fishjam.Component - alias JellyfishWeb.ApiSpec.Component.Recording.Options + alias FishjamWeb.ApiSpec.Component.Recording.Options alias Membrane.RTC.Engine.Endpoint.Recording @type properties :: %{path_prefix: Path.t()} @impl true def config(%{engine_pid: engine} = options) do - sink_config = Application.fetch_env!(:jellyfish, :s3_config) + sink_config = Application.fetch_env!(:fishjam, :s3_config) with {:ok, serialized_opts} <- serialize_options(options, Options.schema()), result_opts <- parse_subscribe_mode(serialized_opts), @@ -52,7 +52,7 @@ defmodule Jellyfish.Component.Recording do end def get_base_path(), - do: :jellyfish |> Application.fetch_env!(:media_files_path) |> Path.join("raw_recordings") + do: :fishjam |> Application.fetch_env!(:media_files_path) |> Path.join("raw_recordings") defp parse_subscribe_mode(opts) do Map.update!(opts, :subscribe_mode, &String.to_atom/1) diff --git a/lib/jellyfish/component/rtsp.ex b/lib/jellyfish/component/rtsp.ex index dae6bdc9..ab9e5fb1 100644 --- a/lib/jellyfish/component/rtsp.ex +++ b/lib/jellyfish/component/rtsp.ex @@ -1,14 +1,14 @@ -defmodule Jellyfish.Component.RTSP do +defmodule Fishjam.Component.RTSP do @moduledoc """ Module representing the RTSP component. """ - @behaviour Jellyfish.Endpoint.Config - use Jellyfish.Component + @behaviour Fishjam.Endpoint.Config + use Fishjam.Component alias Membrane.RTC.Engine.Endpoint.RTSP - alias JellyfishWeb.ApiSpec.Component.RTSP.Options + alias FishjamWeb.ApiSpec.Component.RTSP.Options @type properties :: %{ sourceUri: String.t(), diff --git a/lib/jellyfish/component/sip.ex b/lib/jellyfish/component/sip.ex index cf90c164..fb1cee12 100644 --- a/lib/jellyfish/component/sip.ex +++ b/lib/jellyfish/component/sip.ex @@ -1,15 +1,15 @@ -defmodule Jellyfish.Component.SIP do +defmodule Fishjam.Component.SIP do @moduledoc """ Module representing the SIP component. """ - @behaviour Jellyfish.Endpoint.Config - use Jellyfish.Component + @behaviour Fishjam.Endpoint.Config + use Fishjam.Component alias Membrane.RTC.Engine.Endpoint.SIP alias Membrane.RTC.Engine.Endpoint.SIP.RegistrarCredentials - alias JellyfishWeb.ApiSpec.Component.SIP.Options + alias FishjamWeb.ApiSpec.Component.SIP.Options @type properties :: %{ registrar_credentials: %{ @@ -21,7 +21,7 @@ defmodule Jellyfish.Component.SIP do @impl true def config(%{engine_pid: engine} = options) do - external_ip = Application.fetch_env!(:jellyfish, :sip_config)[:sip_external_ip] + external_ip = Application.fetch_env!(:fishjam, :sip_config)[:sip_external_ip] with {:ok, serialized_opts} <- serialize_options(options, Options.schema()) do endpoint_spec = %SIP{ diff --git a/lib/jellyfish/config_reader.ex b/lib/jellyfish/config_reader.ex index 572abb5e..f22be44f 100644 --- a/lib/jellyfish/config_reader.ex +++ b/lib/jellyfish/config_reader.ex @@ -1,10 +1,10 @@ -defmodule Jellyfish.ConfigReader do +defmodule Fishjam.ConfigReader do @moduledoc false require Logger def read_port_range(env) do - if value = System.get_env(env) do + if value = get_env(env) do with [str1, str2] <- String.split(value, "-"), from when from in 0..65_535 <- String.to_integer(str1), to when to in from..65_535 and from <= to <- String.to_integer(str2) do @@ -21,7 +21,7 @@ defmodule Jellyfish.ConfigReader do end def read_ip(env) do - if value = System.get_env(env) do + if value = get_env(env) do value = value |> to_charlist() case :inet.parse_address(value) do @@ -37,7 +37,7 @@ defmodule Jellyfish.ConfigReader do end def read_and_resolve_hostname(env) do - if value = System.get_env(env) do + if value = get_env(env) do # resolve_hostname will raise if address is invalid/unresolvable {:ok, resolved_ip} = value |> resolve_hostname() |> to_charlist() |> :inet.parse_address() @@ -46,7 +46,7 @@ defmodule Jellyfish.ConfigReader do end def read_port(env) do - if value = System.get_env(env) do + if value = get_env(env) do case Integer.parse(value) do {port, _sufix} when port in 1..65_535 -> port @@ -70,7 +70,7 @@ defmodule Jellyfish.ConfigReader do end def read_boolean(env, fallback \\ nil) do - if value = System.get_env(env) do + if value = get_env(env) do case String.downcase(value) do "true" -> true @@ -88,18 +88,18 @@ defmodule Jellyfish.ConfigReader do end def read_ssl_config() do - ssl_key_path = System.get_env("JF_SSL_KEY_PATH") - ssl_cert_path = System.get_env("JF_SSL_CERT_PATH") + ssl_key_path = get_env("FJ_SSL_KEY_PATH") + ssl_cert_path = get_env("FJ_SSL_CERT_PATH") case {ssl_key_path, ssl_cert_path} do {nil, nil} -> nil {nil, ssl_cert_path} when ssl_cert_path != nil -> - raise "JF_SSL_CERT_PATH has been set but JF_SSL_KEY_PATH remains unset" + raise "FJ_SSL_CERT_PATH has been set but FJ_SSL_KEY_PATH remains unset" {ssl_key_path, nil} when ssl_key_path != nil -> - raise "JF_SSL_KEY_PATH has been set but JF_SSL_CERT_PATH remains unset" + raise "FJ_SSL_KEY_PATH has been set but FJ_SSL_CERT_PATH remains unset" other -> other @@ -107,15 +107,15 @@ defmodule Jellyfish.ConfigReader do end def read_webrtc_config() do - webrtc_used? = read_boolean("JF_WEBRTC_USED") + webrtc_used? = read_boolean("FJ_WEBRTC_USED") if webrtc_used? != false do [ webrtc_used?: true, - turn_ip: read_ip("JF_WEBRTC_TURN_IP") || {127, 0, 0, 1}, - turn_listen_ip: read_and_resolve_hostname("JF_WEBRTC_TURN_LISTEN_IP") || {127, 0, 0, 1}, - turn_port_range: read_port_range("JF_WEBRTC_TURN_PORT_RANGE") || {50_000, 59_999}, - turn_tcp_port: read_port("JF_WEBRTC_TURN_TCP_PORT") + turn_ip: read_ip("FJ_WEBRTC_TURN_IP") || {127, 0, 0, 1}, + turn_listen_ip: read_and_resolve_hostname("FJ_WEBRTC_TURN_LISTEN_IP") || {127, 0, 0, 1}, + turn_port_range: read_port_range("FJ_WEBRTC_TURN_PORT_RANGE") || {50_000, 59_999}, + turn_tcp_port: read_port("FJ_WEBRTC_TURN_TCP_PORT") ] else [ @@ -129,25 +129,25 @@ defmodule Jellyfish.ConfigReader do end def read_components_used() do - components_used = System.get_env("JF_COMPONENTS_USED") || "" + components_used = get_env("FJ_COMPONENTS_USED") || "" components_used |> String.split(" ", trim: true) |> Enum.map(fn type -> - case Jellyfish.Component.parse_type(type) do + case Fishjam.Component.parse_type(type) do {:ok, component} -> component {:error, :invalid_type} -> raise( - "Invalid value in JF_COMPONENTS_USED. Expected a lowercase component name, got: #{type}" + "Invalid value in FJ_COMPONENTS_USED. Expected a lowercase component name, got: #{type}" ) end end) end def read_sip_config(sip_used?) do - sip_ip = System.get_env("JF_SIP_IP") || "" + sip_ip = get_env("FJ_SIP_IP") || "" cond do sip_used? != true -> @@ -162,20 +162,20 @@ defmodule Jellyfish.ConfigReader do true -> raise """ - SIP components are allowed, but incorrect IP address was provided as `JF_SIP_IP` + SIP components are allowed, but incorrect IP address was provided as `FJ_SIP_IP` """ end end def read_s3_config() do credentials = [ - bucket: System.get_env("JF_S3_BUCKET"), - region: System.get_env("JF_S3_REGION"), - access_key_id: System.get_env("JF_S3_ACCESS_KEY_ID"), - secret_access_key: System.get_env("JF_S3_SECRET_ACCESS_KEY") + bucket: get_env("FJ_S3_BUCKET"), + region: get_env("FJ_S3_REGION"), + access_key_id: get_env("FJ_S3_ACCESS_KEY_ID"), + secret_access_key: get_env("FJ_S3_SECRET_ACCESS_KEY") ] - path_prefix = System.get_env("JF_S3_PATH_PREFIX") + path_prefix = get_env("FJ_S3_PATH_PREFIX") credentials = cond do @@ -190,11 +190,11 @@ defmodule Jellyfish.ConfigReader do credentials |> Enum.filter(fn {_key, val} -> val == nil end) |> Enum.map(fn {key, _val} -> - "JF_" <> (key |> Atom.to_string() |> String.upcase()) + "FJ_" <> (key |> Atom.to_string() |> String.upcase()) end) raise """ - Either all S3 credentials have to be set: `JF_S3_BUCKET`, `JF_S3_REGION`, `JF_S3_ACCESS_KEY_ID`, `JF_S3_SECRET_ACCESS_KEY`, or none must be set. + Either all S3 credentials have to be set: `FJ_S3_BUCKET`, `FJ_S3_REGION`, `FJ_S3_ACCESS_KEY_ID`, `FJ_S3_SECRET_ACCESS_KEY`, or none must be set. Currently, the following required credentials are missing: #{inspect(missing_envs)}. """ end @@ -206,13 +206,13 @@ defmodule Jellyfish.ConfigReader do end def read_dist_config() do - dist_enabled? = read_boolean("JF_DIST_ENABLED") - dist_strategy = System.get_env("JF_DIST_STRATEGY_NAME") - mode_value = System.get_env("JF_DIST_MODE", "sname") - cookie_value = System.get_env("JF_DIST_COOKIE", "jellyfish_cookie") + dist_enabled? = read_boolean("FJ_DIST_ENABLED") + dist_strategy = get_env("FJ_DIST_STRATEGY_NAME") + mode_value = get_env("FJ_DIST_MODE", "sname") + cookie_value = get_env("FJ_DIST_COOKIE", "fishjam_cookie") {:ok, hostname} = :inet.gethostname() - node_name_value = System.get_env("JF_DIST_NODE_NAME", "jellyfish@#{hostname}") + node_name_value = get_env("FJ_DIST_NODE_NAME", "fishjam@#{hostname}") cookie = parse_cookie(cookie_value) mode = parse_mode(mode_value) @@ -236,26 +236,26 @@ defmodule Jellyfish.ConfigReader do true -> raise """ - JF_DIST_ENABLED has been set but unknown JF_DIST_STRATEGY was provided. + FJ_DIST_ENABLED has been set but unknown FJ_DIST_STRATEGY was provided. Availabile strategies are EPMD or DNS, provided strategy name was: "#{dist_strategy}" """ end end def read_git_commit() do - System.get_env("JF_GIT_COMMIT", "dev") + get_env("FJ_GIT_COMMIT", "dev") end defp do_read_nodes_list_config(node_name_value, cookie, mode) do - nodes_value = System.get_env("JF_DIST_NODES", "") + nodes_value = get_env("FJ_DIST_NODES", "") node_name = parse_node_name(node_name_value) nodes = parse_nodes(nodes_value) if nodes == [] do Logger.warning(""" - NODES_LIST strategy requires JF_DIST_NODES to be set - by at least one Jellyfish instace. This instance has JF_DIST_NODES unset. + NODES_LIST strategy requires FJ_DIST_NODES to be set + by at least one Fishjam instace. This instance has FJ_DIST_NODES unset. """) end @@ -270,17 +270,17 @@ defmodule Jellyfish.ConfigReader do end defp do_read_dns_config(_node_name_value, _cookie, :shortnames) do - raise "DNS strategy requires `JF_DIST_MODE` to be `name`" + raise "DNS strategy requires `FJ_DIST_MODE` to be `name`" end defp do_read_dns_config(node_name_value, cookie, mode) do # Verify the node name is formatted correctly _node_name = parse_node_name(node_name_value) - query_value = System.get_env("JF_DIST_QUERY") + query_value = get_env("FJ_DIST_QUERY") unless query_value do - raise "JF_DIST_QUERY is required by DNS strategy" + raise "FJ_DIST_QUERY is required by DNS strategy" end [node_basename, hostname | []] = String.split(node_name_value, "@") @@ -309,7 +309,7 @@ defmodule Jellyfish.ConfigReader do String.to_atom(node_name) _other -> - raise "JF_DIST_NODE_NAME has to be in form of @. Got: #{node_name}" + raise "FJ_DIST_NODE_NAME has to be in form of @. Got: #{node_name}" end end @@ -322,20 +322,20 @@ defmodule Jellyfish.ConfigReader do end defp parse_polling_interval() do - env_value = System.get_env("JF_DIST_POLLING_INTERVAL", "5000") + env_value = get_env("FJ_DIST_POLLING_INTERVAL", "5000") case Integer.parse(env_value) do {polling_interval, ""} when polling_interval > 0 -> polling_interval _other -> - raise "`JF_DIST_POLLING_INTERVAL` must be a positivie integer. Got: #{env_value}" + raise "`FJ_DIST_POLLING_INTERVAL` must be a positivie integer. Got: #{env_value}" end end defp parse_mode("name"), do: :longnames defp parse_mode("sname"), do: :shortnames - defp parse_mode(other), do: raise("Invalid JF_DIST_MODE. Expected sname or name, got: #{other}") + defp parse_mode(other), do: raise("Invalid FJ_DIST_MODE. Expected sname or name, got: #{other}") defp ip_address?(hostname) do case :inet.parse_address(String.to_charlist(hostname)) do @@ -363,4 +363,22 @@ defmodule Jellyfish.ConfigReader do """ end end + + defp get_env("FJ_" <> rest = name, default \\ nil) do + fj_name = name + jf_name = "JF_" <> rest + + fj_var = System.get_env(fj_name) + jf_var = System.get_env(jf_name) + + if jf_var != nil do + Logger.warning(""" + It looks like you have still an env variable prefixed with JF_ set. + Support for those variables will be removed in version 0.8.0. + Variable: #{jf_name} + """) + end + + fj_var || jf_var || default + end end diff --git a/lib/jellyfish/endpoint/config.ex b/lib/jellyfish/endpoint/config.ex index e14bc2a3..5d0e2fa2 100644 --- a/lib/jellyfish/endpoint/config.ex +++ b/lib/jellyfish/endpoint/config.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Endpoint.Config do +defmodule Fishjam.Endpoint.Config do @moduledoc """ An interface for RTC Engine endpoint configuration. """ diff --git a/lib/jellyfish/event.ex b/lib/jellyfish/event.ex index 918fd843..e4def2a8 100644 --- a/lib/jellyfish/event.ex +++ b/lib/jellyfish/event.ex @@ -1,7 +1,7 @@ -defmodule Jellyfish.Event do +defmodule Fishjam.Event do @moduledoc false - alias Jellyfish.ServerMessage.{ + alias Fishjam.ServerMessage.{ ComponentCrashed, HlsPlayable, HlsUploadCrashed, @@ -24,7 +24,7 @@ defmodule Jellyfish.Event do alias Membrane.RTC.Engine.Message - @pubsub Jellyfish.PubSub + @pubsub Fishjam.PubSub @valid_topics [:server_notification, :metrics] def broadcast_metrics(message), do: broadcast(:metrics, message) @@ -115,7 +115,7 @@ defmodule Jellyfish.Event do defp to_proto_server_notification({:hls_upload_crashed, room_id}), do: {:hls_upload_crashed, %HlsUploadCrashed{room_id: room_id}} - defp to_proto_track(%Jellyfish.Track{} = track) do + defp to_proto_track(%Fishjam.Track{} = track) do %Track{ id: track.id, type: to_proto_track_type(track.type), diff --git a/lib/jellyfish/metrics_scraper.ex b/lib/jellyfish/metrics_scraper.ex index 75eaa7a0..5f50081d 100644 --- a/lib/jellyfish/metrics_scraper.ex +++ b/lib/jellyfish/metrics_scraper.ex @@ -1,9 +1,9 @@ -defmodule Jellyfish.MetricsScraper do +defmodule Fishjam.MetricsScraper do @moduledoc false use GenServer, restart: :temporary - alias Jellyfish.Event + alias Fishjam.Event alias Membrane.TelemetryMetrics.Reporter @metrics_to_derive [ @@ -41,7 +41,7 @@ defmodule Jellyfish.MetricsScraper do @impl true def handle_info(:scrape, state) do - report = Reporter.scrape(JellyfishMetricsReporter) + report = Reporter.scrape(FishjamMetricsReporter) report |> prepare_report(state) diff --git a/lib/jellyfish/peer.ex b/lib/jellyfish/peer.ex index ae00ef01..88251884 100644 --- a/lib/jellyfish/peer.ex +++ b/lib/jellyfish/peer.ex @@ -1,12 +1,12 @@ -defmodule Jellyfish.Peer do +defmodule Fishjam.Peer do @moduledoc """ Peer is an entity that connects to the server to publish, subscribe or publish and subscribe to tracks published by producers or other peers. Peer process is spawned after peer connects to the server. """ use Bunch.Access - alias Jellyfish.Peer.WebRTC - alias Jellyfish.Track + alias Fishjam.Peer.WebRTC + alias Fishjam.Track @enforce_keys [ :id, diff --git a/lib/jellyfish/peer/webrtc.ex b/lib/jellyfish/peer/webrtc.ex index aa34bec3..f9409b35 100644 --- a/lib/jellyfish/peer/webrtc.ex +++ b/lib/jellyfish/peer/webrtc.ex @@ -1,16 +1,16 @@ -defmodule Jellyfish.Peer.WebRTC do +defmodule Fishjam.Peer.WebRTC do @moduledoc """ Module representing WebRTC peer. """ - @behaviour Jellyfish.Endpoint.Config + @behaviour Fishjam.Endpoint.Config alias Membrane.RTC.Engine.Endpoint.WebRTC alias Membrane.RTC.Engine.Endpoint.WebRTC.SimulcastConfig alias Membrane.WebRTC.Extension.{Mid, RepairedRid, Rid, TWCC, VAD} alias Membrane.WebRTC.Track.Encoding - alias JellyfishWeb.ApiSpec + alias FishjamWeb.ApiSpec @impl true def config(options) do diff --git a/lib/jellyfish/resource_manager.ex b/lib/jellyfish/resource_manager.ex index e164c4d5..65310e47 100644 --- a/lib/jellyfish/resource_manager.ex +++ b/lib/jellyfish/resource_manager.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.ResourceManager do +defmodule Fishjam.ResourceManager do @moduledoc """ Module responsible for deleting outdated resources. Right now it only removes outdated resources created by recording component. @@ -8,8 +8,8 @@ defmodule Jellyfish.ResourceManager do require Logger - alias Jellyfish.Component.Recording - alias Jellyfish.RoomService + alias Fishjam.Component.Recording + alias Fishjam.RoomService @type seconds :: pos_integer() @type opts :: %{interval: seconds(), recording_timeout: seconds()} diff --git a/lib/jellyfish/room.ex b/lib/jellyfish/room.ex index 62de054c..ac41daa7 100644 --- a/lib/jellyfish/room.ex +++ b/lib/jellyfish/room.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Room do +defmodule Fishjam.Room do @moduledoc """ Module representing room. """ @@ -6,14 +6,14 @@ defmodule Jellyfish.Room do use Bunch.Access use GenServer - import Jellyfish.Room.State + import Fishjam.Room.State require Logger - alias Jellyfish.Component - alias Jellyfish.Component.{HLS, Recording, SIP} - alias Jellyfish.Peer - alias Jellyfish.Room.{Config, State} + alias Fishjam.Component + alias Fishjam.Component.{HLS, Recording, SIP} + alias Fishjam.Peer + alias Fishjam.Room.{Config, State} alias Membrane.RTC.Engine alias Membrane.RTC.Engine.Endpoint @@ -32,7 +32,7 @@ defmodule Jellyfish.Room do @type id :: String.t() @type t :: State.t() - def registry_id(room_id), do: {:via, Registry, {Jellyfish.RoomRegistry, room_id}} + def registry_id(room_id), do: {:via, Registry, {Fishjam.RoomRegistry, room_id}} @spec start(Config.t()) :: {:ok, pid(), id()} def start(%Config{room_id: id} = config) do diff --git a/lib/jellyfish/room/config.ex b/lib/jellyfish/room/config.ex index c8cb5053..92f9703e 100644 --- a/lib/jellyfish/room/config.ex +++ b/lib/jellyfish/room/config.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Room.Config do +defmodule Fishjam.Room.Config do @moduledoc """ Room configuration """ diff --git a/lib/jellyfish/room/state.ex b/lib/jellyfish/room/state.ex index 8cf9fe63..fd2ac547 100644 --- a/lib/jellyfish/room/state.ex +++ b/lib/jellyfish/room/state.ex @@ -1,13 +1,13 @@ -defmodule Jellyfish.Room.State do +defmodule Fishjam.Room.State do @moduledoc false use Bunch.Access require Logger - alias Jellyfish.{Component, Event, Peer, Room, Track} - alias Jellyfish.Component.{HLS, Recording, RTSP} - alias Jellyfish.Room.Config + alias Fishjam.{Component, Event, Peer, Room, Track} + alias Fishjam.Component.{HLS, Recording, RTSP} + alias Fishjam.Room.Config alias Membrane.ICE.TURNManager alias Membrane.RTC.Engine @@ -64,7 +64,7 @@ defmodule Jellyfish.Room.State do {:ok, pid} = Engine.start_link(rtc_engine_options, []) Engine.register(pid, self()) - webrtc_config = Application.fetch_env!(:jellyfish, :webrtc_config) + webrtc_config = Application.fetch_env!(:fishjam, :webrtc_config) turn_options = if webrtc_config[:webrtc_used?] do @@ -232,7 +232,7 @@ defmodule Jellyfish.Room.State do Logger.info("Peer #{inspect(peer.id)} connected") - :telemetry.execute([:jellyfish, :room], %{peer_connects: 1}, %{room_id: state.id}) + :telemetry.execute([:fishjam, :room], %{peer_connects: 1}, %{room_id: state.id}) state end @@ -247,7 +247,7 @@ defmodule Jellyfish.Room.State do :ok = Engine.remove_endpoint(state.engine_pid, peer_id) Event.broadcast_server_notification({:peer_disconnected, state.id, peer_id}) - :telemetry.execute([:jellyfish, :room], %{peer_disconnects: 1}, %{room_id: state.id}) + :telemetry.execute([:fishjam, :room], %{peer_disconnects: 1}, %{room_id: state.id}) peer.tracks |> Map.values() @@ -289,13 +289,13 @@ defmodule Jellyfish.Room.State do if peer.status == :connected and reason == :peer_removed do Event.broadcast_server_notification({:peer_disconnected, state.id, peer_id}) - :telemetry.execute([:jellyfish, :room], %{peer_disconnects: 1}, %{room_id: state.id}) + :telemetry.execute([:fishjam, :room], %{peer_disconnects: 1}, %{room_id: state.id}) end case reason do {:peer_crashed, crash_reason} -> Event.broadcast_server_notification({:peer_crashed, state.id, peer_id, crash_reason}) - :telemetry.execute([:jellyfish, :room], %{peer_crashes: 1}, %{room_id: state.id}) + :telemetry.execute([:fishjam, :room], %{peer_crashes: 1}, %{room_id: state.id}) _other -> Event.broadcast_server_notification({:peer_deleted, state.id, peer.id}) @@ -386,7 +386,7 @@ defmodule Jellyfish.Room.State do :ok | {:error, :peer_disabled_globally | :reached_peers_limit} def check_peer_allowed(Peer.WebRTC, state) do cond do - not Application.fetch_env!(:jellyfish, :webrtc_config)[:webrtc_used?] -> + not Application.fetch_env!(:fishjam, :webrtc_config)[:webrtc_used?] -> {:error, :peer_disabled_globally} Enum.count(state.peers) >= state.config.max_peers -> @@ -402,7 +402,7 @@ defmodule Jellyfish.Room.State do | {:error, :component_disabled_globally | :incompatible_codec | :reached_components_limit} def check_component_allowed(type, state) do - if type in Application.fetch_env!(:jellyfish, :components_used) do + if type in Application.fetch_env!(:fishjam, :components_used) do check_component_allowed_in_room(type, state) else {:error, :component_disabled_globally} diff --git a/lib/jellyfish/room_service.ex b/lib/jellyfish/room_service.ex index 379f1fa5..1b6614b2 100644 --- a/lib/jellyfish/room_service.ex +++ b/lib/jellyfish/room_service.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.RoomService do +defmodule Fishjam.RoomService do @moduledoc """ Module responsible for managing rooms. """ @@ -7,9 +7,9 @@ defmodule Jellyfish.RoomService do require Logger - alias Jellyfish.{Event, Room, WebhookNotifier} + alias Fishjam.{Event, Room, WebhookNotifier} - @metric_interval_in_seconds Application.compile_env!(:jellyfish, :room_metrics_scrape_interval) + @metric_interval_in_seconds Application.compile_env!(:fishjam, :room_metrics_scrape_interval) @metric_interval_in_milliseconds @metric_interval_in_seconds * 1_000 def start_link(args) do @@ -18,7 +18,7 @@ defmodule Jellyfish.RoomService do @spec find_room(Room.id()) :: {:ok, pid()} | {:error, :room_not_found} def find_room(room_id) do - case Registry.lookup(Jellyfish.RoomRegistry, room_id) do + case Registry.lookup(Fishjam.RoomRegistry, room_id) do [{room_pid, _value}] -> {:ok, room_pid} @@ -59,7 +59,7 @@ defmodule Jellyfish.RoomService do @spec create_room(Room.Config.t()) :: {:ok, Room.t(), String.t()} | {:error, atom()} def create_room(config) do {node_resources, failed_nodes} = - :rpc.multicall(Jellyfish.RoomService, :get_resource_usage, []) + :rpc.multicall(Fishjam.RoomService, :get_resource_usage, []) if Enum.count(failed_nodes) > 0 do Logger.warning( @@ -102,7 +102,7 @@ defmodule Jellyfish.RoomService do room_ids |> Enum.map(fn room_id -> - Task.Supervisor.async_nolink(Jellyfish.TaskSupervisor, fn -> + Task.Supervisor.async_nolink(Fishjam.TaskSupervisor, fn -> Room.get_num_forwarded_tracks(room_id) end) end) @@ -128,7 +128,7 @@ defmodule Jellyfish.RoomService do @impl true def handle_continue(_continue_arg, state) do Process.send_after(self(), :rooms_metrics, @metric_interval_in_milliseconds) - :ok = Phoenix.PubSub.subscribe(Jellyfish.PubSub, "jellyfishes") + :ok = Phoenix.PubSub.subscribe(Fishjam.PubSub, "fishjams") {:noreply, state} end @@ -146,7 +146,7 @@ defmodule Jellyfish.RoomService do Event.broadcast_server_notification({:room_created, room_id}) - {:reply, {:ok, room, Jellyfish.address()}, state} + {:reply, {:ok, room, Fishjam.address()}, state} else {:error, :room_already_exists} = error -> {:reply, error, state} @@ -173,7 +173,7 @@ defmodule Jellyfish.RoomService do rooms = list_rooms() :telemetry.execute( - [:jellyfish], + [:fishjam], %{ rooms: Enum.count(rooms) } @@ -183,7 +183,7 @@ defmodule Jellyfish.RoomService do peer_count = room.peers |> Enum.count() :telemetry.execute( - [:jellyfish, :room], + [:fishjam, :room], %{ peers: peer_count, peer_time: peer_count * @metric_interval_in_seconds, @@ -204,7 +204,7 @@ defmodule Jellyfish.RoomService do Logger.debug("Room #{room_id} is down with reason: normal") - Phoenix.PubSub.broadcast(Jellyfish.PubSub, room_id, :room_stopped) + Phoenix.PubSub.broadcast(Fishjam.PubSub, room_id, :room_stopped) Event.broadcast_server_notification({:room_deleted, room_id}) clear_room_metrics(room_id) @@ -217,7 +217,7 @@ defmodule Jellyfish.RoomService do Logger.warning("Process #{room_id} is down with reason: #{inspect(reason)}") - Phoenix.PubSub.broadcast(Jellyfish.PubSub, room_id, :room_crashed) + Phoenix.PubSub.broadcast(Fishjam.PubSub, room_id, :room_crashed) Event.broadcast_server_notification({:room_crashed, room_id}) clear_room_metrics(room_id) @@ -225,7 +225,7 @@ defmodule Jellyfish.RoomService do end defp clear_room_metrics(room_id) do - :telemetry.execute([:jellyfish, :room], %{peers: 0}, %{room_id: room_id}) + :telemetry.execute([:fishjam, :room], %{peers: 0}, %{room_id: room_id}) end defp find_best_node(node_resources) do @@ -247,7 +247,7 @@ defmodule Jellyfish.RoomService do end defp get_rooms_ids() do - Jellyfish.RoomRegistry + Fishjam.RoomRegistry |> Registry.select([{{:"$1", :_, :_}, [], [:"$1"]}]) end diff --git a/lib/jellyfish/track.ex b/lib/jellyfish/track.ex index 418d0382..c48b43b6 100644 --- a/lib/jellyfish/track.ex +++ b/lib/jellyfish/track.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Track do +defmodule Fishjam.Track do @moduledoc """ Represents a media track send from Component or Peer. """ diff --git a/lib/jellyfish/utils/parser_json.ex b/lib/jellyfish/utils/parser_json.ex index 011a3c0e..28f1e4a1 100644 --- a/lib/jellyfish/utils/parser_json.ex +++ b/lib/jellyfish/utils/parser_json.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Utils.ParserJSON do +defmodule Fishjam.Utils.ParserJSON do @moduledoc """ A utility module for converting controller responses into JSON format. """ diff --git a/lib/jellyfish/utils/path_validation.ex b/lib/jellyfish/utils/path_validation.ex index 3add9865..d4cc37ca 100644 --- a/lib/jellyfish/utils/path_validation.ex +++ b/lib/jellyfish/utils/path_validation.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.Utils.PathValidation do +defmodule Fishjam.Utils.PathValidation do @moduledoc """ A helper module for validating file and directory paths. This module is mainly used to validate filenames and paths embedded in requests. @@ -14,10 +14,10 @@ defmodule Jellyfish.Utils.PathValidation do ## Example: - iex> Jellyfish.Utils.PathValidation.inside_directory?("relative/path/to/file", "relative/path") + iex> Fishjam.Utils.PathValidation.inside_directory?("relative/path/to/file", "relative/path") true - iex> Jellyfish.Utils.PathValidation.inside_directory?("/absolute/path/to/file", "relative/path") + iex> Fishjam.Utils.PathValidation.inside_directory?("/absolute/path/to/file", "relative/path") false """ diff --git a/lib/jellyfish/webhook_notifier.ex b/lib/jellyfish/webhook_notifier.ex index 2ac0cdf7..c68377f5 100644 --- a/lib/jellyfish/webhook_notifier.ex +++ b/lib/jellyfish/webhook_notifier.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.WebhookNotifier do +defmodule Fishjam.WebhookNotifier do @moduledoc """ Module responsible for sending notifications through webhooks. """ @@ -7,8 +7,8 @@ defmodule Jellyfish.WebhookNotifier do require Logger - alias Jellyfish.Event - alias Jellyfish.ServerMessage + alias Fishjam.Event + alias Fishjam.ServerMessage def start_link(args) do GenServer.start_link(__MODULE__, args, name: __MODULE__) diff --git a/lib/jellyfish_web.ex b/lib/jellyfish_web.ex index e50ea0f5..6977bb29 100644 --- a/lib/jellyfish_web.ex +++ b/lib/jellyfish_web.ex @@ -1,11 +1,11 @@ -defmodule JellyfishWeb do +defmodule FishjamWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, components, channels, and so on. This can be used in your application as: - use JellyfishWeb, :controller + use FishjamWeb, :controller The definitions below will be executed for every controller, component, etc, so keep them short and clean, focused @@ -48,9 +48,9 @@ defmodule JellyfishWeb do def verified_routes do quote do use Phoenix.VerifiedRoutes, - endpoint: JellyfishWeb.Endpoint, - router: JellyfishWeb.Router, - statics: JellyfishWeb.static_paths() + endpoint: FishjamWeb.Endpoint, + router: FishjamWeb.Router, + statics: FishjamWeb.static_paths() end end diff --git a/lib/jellyfish_web/api_spec.ex b/lib/jellyfish_web/api_spec.ex index 194925b2..1d065132 100644 --- a/lib/jellyfish_web/api_spec.ex +++ b/lib/jellyfish_web/api_spec.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec do +defmodule FishjamWeb.ApiSpec do @moduledoc false @behaviour OpenApiSpex.OpenApi @@ -10,14 +10,14 @@ defmodule JellyfishWeb.ApiSpec do def spec() do %OpenApiSpex.OpenApi{ info: %Info{ - title: "Jellyfish Media Server", - version: Jellyfish.version(), + title: "Fishjam Media Server", + version: Fishjam.version(), license: %License{ name: "Apache 2.0", url: "https://www.apache.org/licenses/LICENSE-2.0" } }, - paths: Paths.from_router(JellyfishWeb.Router), + paths: Paths.from_router(FishjamWeb.Router), components: %Components{ securitySchemes: %{"authorization" => %SecurityScheme{type: "http", scheme: "bearer"}} } @@ -32,6 +32,6 @@ defmodule JellyfishWeb.ApiSpec do @spec error(String.t()) :: {String.t(), String.t(), module()} def error(description) do - {description, "application/json", JellyfishWeb.ApiSpec.Error} + {description, "application/json", FishjamWeb.ApiSpec.Error} end end diff --git a/lib/jellyfish_web/api_spec/component.ex b/lib/jellyfish_web/api_spec/component.ex index 119d2328..2f2e6ef1 100644 --- a/lib/jellyfish_web/api_spec/component.ex +++ b/lib/jellyfish_web/api_spec/component.ex @@ -1,9 +1,9 @@ -defmodule JellyfishWeb.ApiSpec.Component do +defmodule FishjamWeb.ApiSpec.Component do @moduledoc false require OpenApiSpex - alias JellyfishWeb.ApiSpec.Component.{File, HLS, Recording, RTSP, SIP} + alias FishjamWeb.ApiSpec.Component.{File, HLS, Recording, RTSP, SIP} defmodule Type do @moduledoc false diff --git a/lib/jellyfish_web/api_spec/component/file.ex b/lib/jellyfish_web/api_spec/component/file.ex index 059915e9..d4d0459b 100644 --- a/lib/jellyfish_web/api_spec/component/file.ex +++ b/lib/jellyfish_web/api_spec/component/file.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Component.File do +defmodule FishjamWeb.ApiSpec.Component.File do @moduledoc false require OpenApiSpex @@ -68,7 +68,7 @@ defmodule JellyfishWeb.ApiSpec.Component.File do properties: Properties, tracks: %Schema{ type: :array, - items: JellyfishWeb.ApiSpec.Track, + items: FishjamWeb.ApiSpec.Track, description: "List of all component's tracks" } }, diff --git a/lib/jellyfish_web/api_spec/component/hls.ex b/lib/jellyfish_web/api_spec/component/hls.ex index 9eca9cb5..861eebe2 100644 --- a/lib/jellyfish_web/api_spec/component/hls.ex +++ b/lib/jellyfish_web/api_spec/component/hls.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Component.HLS do +defmodule FishjamWeb.ApiSpec.Component.HLS do @moduledoc false require OpenApiSpex @@ -129,7 +129,7 @@ defmodule JellyfishWeb.ApiSpec.Component.HLS do properties: Properties, tracks: %Schema{ type: :array, - items: JellyfishWeb.ApiSpec.Track, + items: FishjamWeb.ApiSpec.Track, description: "List of all component's tracks" } }, diff --git a/lib/jellyfish_web/api_spec/component/recording.ex b/lib/jellyfish_web/api_spec/component/recording.ex index f1c6f7f3..c1c18751 100644 --- a/lib/jellyfish_web/api_spec/component/recording.ex +++ b/lib/jellyfish_web/api_spec/component/recording.ex @@ -1,9 +1,9 @@ -defmodule JellyfishWeb.ApiSpec.Component.Recording do +defmodule FishjamWeb.ApiSpec.Component.Recording do @moduledoc false require OpenApiSpex - alias JellyfishWeb.ApiSpec.Component.HLS.S3 + alias FishjamWeb.ApiSpec.Component.HLS.S3 alias OpenApiSpex.Schema defmodule Properties do @@ -73,7 +73,7 @@ defmodule JellyfishWeb.ApiSpec.Component.Recording do properties: Properties, tracks: %Schema{ type: :array, - items: JellyfishWeb.ApiSpec.Track, + items: FishjamWeb.ApiSpec.Track, description: "List of all component's tracks" } }, diff --git a/lib/jellyfish_web/api_spec/component/rtsp.ex b/lib/jellyfish_web/api_spec/component/rtsp.ex index 1ee98028..a32fb7a2 100644 --- a/lib/jellyfish_web/api_spec/component/rtsp.ex +++ b/lib/jellyfish_web/api_spec/component/rtsp.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Component.RTSP do +defmodule FishjamWeb.ApiSpec.Component.RTSP do @moduledoc false require OpenApiSpex @@ -99,7 +99,7 @@ defmodule JellyfishWeb.ApiSpec.Component.RTSP do properties: Properties, tracks: %Schema{ type: :array, - items: JellyfishWeb.ApiSpec.Track, + items: FishjamWeb.ApiSpec.Track, description: "List of all component's tracks" } }, diff --git a/lib/jellyfish_web/api_spec/component/sip.ex b/lib/jellyfish_web/api_spec/component/sip.ex index eaa8b8ac..c41e9a93 100644 --- a/lib/jellyfish_web/api_spec/component/sip.ex +++ b/lib/jellyfish_web/api_spec/component/sip.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Component.SIP do +defmodule FishjamWeb.ApiSpec.Component.SIP do @moduledoc false require OpenApiSpex @@ -70,7 +70,7 @@ defmodule JellyfishWeb.ApiSpec.Component.SIP do properties: Properties, tracks: %Schema{ type: :array, - items: JellyfishWeb.ApiSpec.Track, + items: FishjamWeb.ApiSpec.Track, description: "List of all component's tracks" } }, diff --git a/lib/jellyfish_web/api_spec/dial.ex b/lib/jellyfish_web/api_spec/dial.ex index 51ce1060..20999c9e 100644 --- a/lib/jellyfish_web/api_spec/dial.ex +++ b/lib/jellyfish_web/api_spec/dial.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Dial do +defmodule FishjamWeb.ApiSpec.Dial do @moduledoc false require OpenApiSpex diff --git a/lib/jellyfish_web/api_spec/error.ex b/lib/jellyfish_web/api_spec/error.ex index 72619b8b..9252646a 100644 --- a/lib/jellyfish_web/api_spec/error.ex +++ b/lib/jellyfish_web/api_spec/error.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Error do +defmodule FishjamWeb.ApiSpec.Error do @moduledoc false require OpenApiSpex diff --git a/lib/jellyfish_web/api_spec/health_report.ex b/lib/jellyfish_web/api_spec/health_report.ex index 682c12dd..014971ec 100644 --- a/lib/jellyfish_web/api_spec/health_report.ex +++ b/lib/jellyfish_web/api_spec/health_report.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.HealthReport do +defmodule FishjamWeb.ApiSpec.HealthReport do @moduledoc false require OpenApiSpex @@ -11,7 +11,7 @@ defmodule JellyfishWeb.ApiSpec.HealthReport do OpenApiSpex.schema(%{ title: "HealthReportStatus", - description: "Informs about the status of Jellyfish or a specific service", + description: "Informs about the status of Fishjam or a specific service", type: :string, enum: ["UP", "DOWN"], example: "UP" @@ -25,18 +25,18 @@ defmodule JellyfishWeb.ApiSpec.HealthReport do OpenApiSpex.schema(%{ title: "HealthReportDistribution", - description: "Informs about the status of Jellyfish distribution", + description: "Informs about the status of Fishjam distribution", type: :object, properties: %{ enabled: %Schema{ type: :boolean, - description: "Whether distribution is enabled on this Jellyfish" + description: "Whether distribution is enabled on this Fishjam" }, nodeStatus: Status, nodesInCluster: %Schema{ type: :integer, description: - "Amount of nodes (including this Jellyfish's node) in the distribution cluster" + "Amount of nodes (including this Fishjam's node) in the distribution cluster" } }, required: [:nodeStatus, :nodesInCluster] @@ -45,13 +45,13 @@ defmodule JellyfishWeb.ApiSpec.HealthReport do OpenApiSpex.schema(%{ title: "HealthReport", - description: "Describes overall Jellyfish health", + description: "Describes overall Fishjam health", type: :object, properties: %{ status: Status, - uptime: %Schema{type: :integer, description: "Uptime of Jellyfish (in seconds)"}, + uptime: %Schema{type: :integer, description: "Uptime of Fishjam (in seconds)"}, distribution: Distribution, - version: %Schema{type: :string, description: "Version of Jellyfish"}, + version: %Schema{type: :string, description: "Version of Fishjam"}, gitCommit: %Schema{type: :string, description: "Commit hash of the build"} }, required: [:status, :uptime, :distribution, :version, :gitCommit] diff --git a/lib/jellyfish_web/api_spec/hls.ex b/lib/jellyfish_web/api_spec/hls.ex index 4e365294..2ec3d394 100644 --- a/lib/jellyfish_web/api_spec/hls.ex +++ b/lib/jellyfish_web/api_spec/hls.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.HLS do +defmodule FishjamWeb.ApiSpec.HLS do require OpenApiSpex defmodule Params do diff --git a/lib/jellyfish_web/api_spec/peer.ex b/lib/jellyfish_web/api_spec/peer.ex index 3f2c1b6d..c953facc 100644 --- a/lib/jellyfish_web/api_spec/peer.ex +++ b/lib/jellyfish_web/api_spec/peer.ex @@ -1,10 +1,10 @@ -defmodule JellyfishWeb.ApiSpec.Peer do +defmodule FishjamWeb.ApiSpec.Peer do @moduledoc false require OpenApiSpex alias OpenApiSpex.Schema - alias JellyfishWeb.ApiSpec.Peer.WebRTC + alias FishjamWeb.ApiSpec.Peer.WebRTC defmodule Type do @moduledoc false @@ -70,7 +70,7 @@ defmodule JellyfishWeb.ApiSpec.Peer do title: "WebsocketURL", description: "Websocket URL to which peer has to connect", type: :string, - example: "www.jellyfish.org/socket/peer" + example: "www.fishjam.org/socket/peer" }) end @@ -82,7 +82,7 @@ defmodule JellyfishWeb.ApiSpec.Peer do OpenApiSpex.schema(%{ title: "PeerMetadata", description: "Custom metadata set by the peer", - example: %{name: "JellyfishUser"}, + example: %{name: "FishjamUser"}, nullable: true }) end @@ -97,7 +97,7 @@ defmodule JellyfishWeb.ApiSpec.Peer do status: Status, tracks: %Schema{ type: :array, - items: JellyfishWeb.ApiSpec.Track, + items: FishjamWeb.ApiSpec.Track, description: "List of all peer's tracks" }, metadata: PeerMetadata diff --git a/lib/jellyfish_web/api_spec/peer/webrtc.ex b/lib/jellyfish_web/api_spec/peer/webrtc.ex index 0207bd20..d1b28b4a 100644 --- a/lib/jellyfish_web/api_spec/peer/webrtc.ex +++ b/lib/jellyfish_web/api_spec/peer/webrtc.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Peer.WebRTC do +defmodule FishjamWeb.ApiSpec.Peer.WebRTC do @moduledoc false require OpenApiSpex diff --git a/lib/jellyfish_web/api_spec/responses.ex b/lib/jellyfish_web/api_spec/responses.ex index e8237e17..dd7c3905 100644 --- a/lib/jellyfish_web/api_spec/responses.ex +++ b/lib/jellyfish_web/api_spec/responses.ex @@ -3,38 +3,38 @@ %OpenApiSpex.Schema{ type: :object, properties: %{ - peer: JellyfishWeb.ApiSpec.Peer, - token: JellyfishWeb.ApiSpec.Peer.Token, - peer_websocket_url: JellyfishWeb.ApiSpec.Peer.WebSocketUrl + peer: FishjamWeb.ApiSpec.Peer, + token: FishjamWeb.ApiSpec.Peer.Token, + peer_websocket_url: FishjamWeb.ApiSpec.Peer.WebSocketUrl }, required: [:peer, :token] }}, - {RoomDetailsResponse, "Response containing room details", JellyfishWeb.ApiSpec.Room}, + {RoomDetailsResponse, "Response containing room details", FishjamWeb.ApiSpec.Room}, {RoomCreateDetailsResponse, "Response containing room details", %OpenApiSpex.Schema{ type: :object, properties: %{ - room: JellyfishWeb.ApiSpec.Room, - jellyfish_address: %OpenApiSpex.Schema{ + room: FishjamWeb.ApiSpec.Room, + fishjam_address: %OpenApiSpex.Schema{ description: - "Jellyfish instance address where the room was created. This might be different than the address of Jellyfish where the request was sent only when running a cluster of Jellyfishes.", + "Fishjam instance address where the room was created. This might be different than the address of Fishjam where the request was sent only when running a cluster of Fishjams.", type: :string, - example: "jellyfish1:5003" + example: "fishjam1:5003" } }, - required: [:room, :jellyfish_address] + required: [:room, :fishjam_address] }}, {ComponentDetailsResponse, "Response containing component details", - JellyfishWeb.ApiSpec.Component}, + FishjamWeb.ApiSpec.Component}, {RoomsListingResponse, "Response containing list of all rooms", - %OpenApiSpex.Schema{type: :array, items: JellyfishWeb.ApiSpec.Room}}, + %OpenApiSpex.Schema{type: :array, items: FishjamWeb.ApiSpec.Room}}, {RecordingListResponse, "Response containing list of all recording", %OpenApiSpex.Schema{type: :array, items: %OpenApiSpex.Schema{type: :string}}}, - {HealthcheckResponse, "Response containing health report of Jellyfish", - JellyfishWeb.ApiSpec.HealthReport} + {HealthcheckResponse, "Response containing health report of Fishjam", + FishjamWeb.ApiSpec.HealthReport} ] |> Enum.map(fn {title, description, schema} -> - module = Module.concat(JellyfishWeb.ApiSpec, title) + module = Module.concat(FishjamWeb.ApiSpec, title) title_str = inspect(title) defmodule module do diff --git a/lib/jellyfish_web/api_spec/room.ex b/lib/jellyfish_web/api_spec/room.ex index c9ab507f..0c192723 100644 --- a/lib/jellyfish_web/api_spec/room.ex +++ b/lib/jellyfish_web/api_spec/room.ex @@ -1,7 +1,7 @@ -defmodule JellyfishWeb.ApiSpec.Room do +defmodule FishjamWeb.ApiSpec.Room do require OpenApiSpex - alias JellyfishWeb.ApiSpec.{Component, Peer} + alias FishjamWeb.ApiSpec.{Component, Peer} alias OpenApiSpex.Schema defmodule Config do @@ -17,7 +17,7 @@ defmodule JellyfishWeb.ApiSpec.Room do roomId: %Schema{ type: :string, description: - "Custom id used for identifying room within Jellyfish. Must be unique across all rooms. If not provided, random UUID is generated.", + "Custom id used for identifying room within Fishjam. Must be unique across all rooms. If not provided, random UUID is generated.", nullable: true }, maxPeers: %Schema{ @@ -34,9 +34,9 @@ defmodule JellyfishWeb.ApiSpec.Room do nullable: true }, webhookUrl: %Schema{ - description: "URL where Jellyfish notifications will be sent", + description: "URL where Fishjam notifications will be sent", type: :string, - example: "https://backend.address.com/jellyfish-notifications-endpoint", + example: "https://backend.address.com/fishjam-notifications-endpoint", nullable: true }, peerlessPurgeTimeout: %Schema{ diff --git a/lib/jellyfish_web/api_spec/subscription.ex b/lib/jellyfish_web/api_spec/subscription.ex index 293b16f8..2a0d0d3e 100644 --- a/lib/jellyfish_web/api_spec/subscription.ex +++ b/lib/jellyfish_web/api_spec/subscription.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Subscription do +defmodule FishjamWeb.ApiSpec.Subscription do require OpenApiSpex alias OpenApiSpex.Schema diff --git a/lib/jellyfish_web/api_spec/track.ex b/lib/jellyfish_web/api_spec/track.ex index a12c4358..d6f3f4fd 100644 --- a/lib/jellyfish_web/api_spec/track.ex +++ b/lib/jellyfish_web/api_spec/track.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ApiSpec.Track do +defmodule FishjamWeb.ApiSpec.Track do @moduledoc false require OpenApiSpex diff --git a/lib/jellyfish_web/controllers/component_controller.ex b/lib/jellyfish_web/controllers/component_controller.ex index 443fdc3b..f50a8024 100644 --- a/lib/jellyfish_web/controllers/component_controller.ex +++ b/lib/jellyfish_web/controllers/component_controller.ex @@ -1,14 +1,14 @@ -defmodule JellyfishWeb.ComponentController do - use JellyfishWeb, :controller +defmodule FishjamWeb.ComponentController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs - alias Jellyfish.Component - alias Jellyfish.Room - alias Jellyfish.RoomService - alias JellyfishWeb.ApiSpec + alias Fishjam.Component + alias Fishjam.Room + alias Fishjam.RoomService + alias FishjamWeb.ApiSpec alias OpenApiSpex.{Response, Schema} - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController tags [:room] @@ -83,7 +83,7 @@ defmodule JellyfishWeb.ComponentController do {:error, :bad_request, "Invalid component type"} {:error, {:component_disabled_globally, type}} -> - {:error, :bad_request, "Components of type #{type} are disabled on this Jellyfish"} + {:error, :bad_request, "Components of type #{type} are disabled on this Fishjam"} {:error, :incompatible_codec} -> {:error, :bad_request, "Incompatible video codec enforced in room #{room_id}"} diff --git a/lib/jellyfish_web/controllers/component_json.ex b/lib/jellyfish_web/controllers/component_json.ex index c7987d67..63746b19 100644 --- a/lib/jellyfish_web/controllers/component_json.ex +++ b/lib/jellyfish_web/controllers/component_json.ex @@ -1,8 +1,8 @@ -defmodule JellyfishWeb.ComponentJSON do +defmodule FishjamWeb.ComponentJSON do @moduledoc false - alias Jellyfish.Component.{File, HLS, Recording, RTSP, SIP} - alias Jellyfish.Utils.ParserJSON + alias Fishjam.Component.{File, HLS, Recording, RTSP, SIP} + alias Fishjam.Utils.ParserJSON def show(%{component: component}) do %{data: data(component)} diff --git a/lib/jellyfish_web/controllers/error_json.ex b/lib/jellyfish_web/controllers/error_json.ex index f5de1ac5..60e5f108 100644 --- a/lib/jellyfish_web/controllers/error_json.ex +++ b/lib/jellyfish_web/controllers/error_json.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ErrorJSON do +defmodule FishjamWeb.ErrorJSON do @moduledoc false # If you want to customize a particular status code, # you may add your own clauses, such as: diff --git a/lib/jellyfish_web/controllers/fallback_controller.ex b/lib/jellyfish_web/controllers/fallback_controller.ex index d3168591..00f424eb 100644 --- a/lib/jellyfish_web/controllers/fallback_controller.ex +++ b/lib/jellyfish_web/controllers/fallback_controller.ex @@ -1,5 +1,5 @@ -defmodule JellyfishWeb.FallbackController do - use JellyfishWeb, :controller +defmodule FishjamWeb.FallbackController do + use FishjamWeb, :controller def call(conn, {:error, status, reason}) do conn diff --git a/lib/jellyfish_web/controllers/healthcheck_controller.ex b/lib/jellyfish_web/controllers/healthcheck_controller.ex index de2ab21b..724eaef3 100644 --- a/lib/jellyfish_web/controllers/healthcheck_controller.ex +++ b/lib/jellyfish_web/controllers/healthcheck_controller.ex @@ -1,10 +1,10 @@ -defmodule JellyfishWeb.HealthcheckController do - use JellyfishWeb, :controller +defmodule FishjamWeb.HealthcheckController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs - alias JellyfishWeb.ApiSpec + alias FishjamWeb.ApiSpec - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController tags [:health] @@ -12,7 +12,7 @@ defmodule JellyfishWeb.HealthcheckController do operation :show, operation_id: "healthcheck", - summary: "Describes the health of Jellyfish", + summary: "Describes the health of Fishjam", responses: [ ok: ApiSpec.data("Healthy", ApiSpec.HealthcheckResponse), unauthorized: ApiSpec.error("Unauthorized") @@ -31,13 +31,13 @@ defmodule JellyfishWeb.HealthcheckController do status: :up, uptime: get_uptime(), distribution: get_distribution_report(), - version: Jellyfish.version(), - gitCommit: Application.get_env(:jellyfish, :git_commit) + version: Fishjam.version(), + gitCommit: Application.get_env(:fishjam, :git_commit) } end defp get_uptime() do - System.monotonic_time(:second) - Application.fetch_env!(:jellyfish, :start_time) + System.monotonic_time(:second) - Application.fetch_env!(:fishjam, :start_time) end defp get_distribution_report() do @@ -45,7 +45,7 @@ defmodule JellyfishWeb.HealthcheckController do visible_nodes = Node.list() |> length() %{ - enabled: Application.fetch_env!(:jellyfish, :dist_config)[:enabled], + enabled: Application.fetch_env!(:fishjam, :dist_config)[:enabled], node_status: if(alive?, do: :up, else: :down), nodes_in_cluster: visible_nodes + if(alive?, do: 1, else: 0) } diff --git a/lib/jellyfish_web/controllers/healthcheck_json.ex b/lib/jellyfish_web/controllers/healthcheck_json.ex index 22d2dc31..3c5452d1 100644 --- a/lib/jellyfish_web/controllers/healthcheck_json.ex +++ b/lib/jellyfish_web/controllers/healthcheck_json.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.HealthcheckJSON do +defmodule FishjamWeb.HealthcheckJSON do @moduledoc false def show(%{report: report}) do diff --git a/lib/jellyfish_web/controllers/hls_content_controller.ex b/lib/jellyfish_web/controllers/hls_content_controller.ex index ba935346..940d2524 100644 --- a/lib/jellyfish_web/controllers/hls_content_controller.ex +++ b/lib/jellyfish_web/controllers/hls_content_controller.ex @@ -1,16 +1,16 @@ -defmodule JellyfishWeb.HLSContentController do - use JellyfishWeb, :controller +defmodule FishjamWeb.HLSContentController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs require Logger - alias Jellyfish.Component.HLS.RequestHandler - alias JellyfishWeb.ApiSpec - alias JellyfishWeb.ApiSpec.HLS.{Params, Response} + alias Fishjam.Component.HLS.RequestHandler + alias FishjamWeb.ApiSpec + alias FishjamWeb.ApiSpec.HLS.{Params, Response} alias Plug.Conn - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController tags [:hls] diff --git a/lib/jellyfish_web/controllers/peer_controller.ex b/lib/jellyfish_web/controllers/peer_controller.ex index 39d846ba..39baa587 100644 --- a/lib/jellyfish_web/controllers/peer_controller.ex +++ b/lib/jellyfish_web/controllers/peer_controller.ex @@ -1,15 +1,15 @@ -defmodule JellyfishWeb.PeerController do - use JellyfishWeb, :controller +defmodule FishjamWeb.PeerController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs - alias Jellyfish.Peer - alias Jellyfish.Room - alias Jellyfish.RoomService - alias JellyfishWeb.ApiSpec - alias JellyfishWeb.PeerToken + alias Fishjam.Peer + alias Fishjam.Room + alias Fishjam.RoomService + alias FishjamWeb.ApiSpec + alias FishjamWeb.PeerToken alias OpenApiSpex.{Response, Schema} - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController tags [:room] @@ -77,7 +77,7 @@ defmodule JellyfishWeb.PeerController do assigns = [ peer: peer, token: PeerToken.generate(%{peer_id: peer.id, room_id: room_id}), - peer_websocket_url: Jellyfish.peer_websocket_address() + peer_websocket_url: Fishjam.peer_websocket_address() ] conn @@ -95,7 +95,7 @@ defmodule JellyfishWeb.PeerController do {:error, :bad_request, "Invalid peer type"} {:error, {:peer_disabled_globally, type}} -> - {:error, :bad_request, "Peers of type #{type} are disabled on this Jellyfish"} + {:error, :bad_request, "Peers of type #{type} are disabled on this Fishjam"} {:error, {:reached_peers_limit, type}} -> {:error, :service_unavailable, "Reached #{type} peers limit in room #{room_id}"} diff --git a/lib/jellyfish_web/controllers/peer_json.ex b/lib/jellyfish_web/controllers/peer_json.ex index 974afee2..0d2fdb7e 100644 --- a/lib/jellyfish_web/controllers/peer_json.ex +++ b/lib/jellyfish_web/controllers/peer_json.ex @@ -1,6 +1,6 @@ -defmodule JellyfishWeb.PeerJSON do +defmodule FishjamWeb.PeerJSON do @moduledoc false - alias Jellyfish.Peer.WebRTC + alias Fishjam.Peer.WebRTC def show(%{peer: peer, token: token, peer_websocket_url: ws_url}) do %{data: %{peer: data(peer), token: token, peer_websocket_url: ws_url}} diff --git a/lib/jellyfish_web/controllers/recording_content_controller.ex b/lib/jellyfish_web/controllers/recording_content_controller.ex index 51d30db2..17facf1e 100644 --- a/lib/jellyfish_web/controllers/recording_content_controller.ex +++ b/lib/jellyfish_web/controllers/recording_content_controller.ex @@ -1,15 +1,15 @@ -defmodule JellyfishWeb.RecordingContentController do - use JellyfishWeb, :controller +defmodule FishjamWeb.RecordingContentController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs require Logger - alias Jellyfish.Component.HLS.RequestHandler - alias JellyfishWeb.ApiSpec + alias Fishjam.Component.HLS.RequestHandler + alias FishjamWeb.ApiSpec alias Plug.Conn - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController @playlist_content_type "application/vnd.apple.mpegurl" @recording_id_spec [in: :path, description: "Recording id", type: :string] diff --git a/lib/jellyfish_web/controllers/recording_controller.ex b/lib/jellyfish_web/controllers/recording_controller.ex index 1678635c..d1059941 100644 --- a/lib/jellyfish_web/controllers/recording_controller.ex +++ b/lib/jellyfish_web/controllers/recording_controller.ex @@ -1,15 +1,15 @@ -defmodule JellyfishWeb.RecordingController do - use JellyfishWeb, :controller +defmodule FishjamWeb.RecordingController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs require Logger - alias Jellyfish.Component.HLS.{Recording, RequestHandler} - alias JellyfishWeb.ApiSpec + alias Fishjam.Component.HLS.{Recording, RequestHandler} + alias FishjamWeb.ApiSpec alias Plug.Conn - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController @playlist_content_type "application/vnd.apple.mpegurl" @recording_id_spec [in: :path, description: "Recording id", type: :string] diff --git a/lib/jellyfish_web/controllers/recording_json.ex b/lib/jellyfish_web/controllers/recording_json.ex index 08201530..6a601f8a 100644 --- a/lib/jellyfish_web/controllers/recording_json.ex +++ b/lib/jellyfish_web/controllers/recording_json.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.RecordingJSON do +defmodule FishjamWeb.RecordingJSON do @moduledoc false def show(%{recordings: recordings}) do diff --git a/lib/jellyfish_web/controllers/room_controller.ex b/lib/jellyfish_web/controllers/room_controller.ex index 00e9e419..76b236a9 100644 --- a/lib/jellyfish_web/controllers/room_controller.ex +++ b/lib/jellyfish_web/controllers/room_controller.ex @@ -1,13 +1,13 @@ -defmodule JellyfishWeb.RoomController do - use JellyfishWeb, :controller +defmodule FishjamWeb.RoomController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs - alias Jellyfish.Room - alias Jellyfish.RoomService - alias JellyfishWeb.ApiSpec + alias Fishjam.Room + alias Fishjam.RoomService + alias FishjamWeb.ApiSpec alias OpenApiSpex.Response - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController tags [:room] @@ -75,11 +75,11 @@ defmodule JellyfishWeb.RoomController do def create(conn, params) do with {:ok, config} <- Room.Config.from_params(params), - {:ok, room, jellyfish_address} <- RoomService.create_room(config) do + {:ok, room, fishjam_address} <- RoomService.create_room(config) do conn |> put_resp_content_type("application/json") |> put_status(:created) - |> render("show.json", room: room, jellyfish_address: jellyfish_address) + |> render("show.json", room: room, fishjam_address: fishjam_address) else {:error, :invalid_max_peers} -> max_peers = Map.get(params, "maxPeers") diff --git a/lib/jellyfish_web/controllers/room_json.ex b/lib/jellyfish_web/controllers/room_json.ex index b117dd03..880f9d72 100644 --- a/lib/jellyfish_web/controllers/room_json.ex +++ b/lib/jellyfish_web/controllers/room_json.ex @@ -1,17 +1,17 @@ -defmodule JellyfishWeb.RoomJSON do +defmodule FishjamWeb.RoomJSON do @moduledoc false - alias JellyfishWeb.ComponentJSON - alias JellyfishWeb.PeerJSON + alias FishjamWeb.ComponentJSON + alias FishjamWeb.PeerJSON - alias Jellyfish.Utils.ParserJSON + alias Fishjam.Utils.ParserJSON def index(%{rooms: rooms}) do %{data: rooms |> Enum.map(&data/1)} end - def show(%{room: room, jellyfish_address: jellyfish_address}) do - %{data: data(room, jellyfish_address)} + def show(%{room: room, fishjam_address: fishjam_address}) do + %{data: data(room, fishjam_address)} end def show(%{room: room}) do @@ -20,8 +20,8 @@ defmodule JellyfishWeb.RoomJSON do def data(room), do: room_data(room) - def data(room, jellyfish_address) do - %{room: room_data(room), jellyfish_address: jellyfish_address} + def data(room, fishjam_address) do + %{room: room_data(room), fishjam_address: fishjam_address} end defp room_data(room) do diff --git a/lib/jellyfish_web/controllers/sip_call_controller.ex b/lib/jellyfish_web/controllers/sip_call_controller.ex index 1654e850..a1ee43f0 100644 --- a/lib/jellyfish_web/controllers/sip_call_controller.ex +++ b/lib/jellyfish_web/controllers/sip_call_controller.ex @@ -1,13 +1,13 @@ -defmodule JellyfishWeb.SIPCallController do - use JellyfishWeb, :controller +defmodule FishjamWeb.SIPCallController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs - alias Jellyfish.Room - alias Jellyfish.RoomService - alias JellyfishWeb.ApiSpec + alias Fishjam.Room + alias Fishjam.RoomService + alias FishjamWeb.ApiSpec alias OpenApiSpex.Response - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController tags [:sip] diff --git a/lib/jellyfish_web/controllers/subscription_controller.ex b/lib/jellyfish_web/controllers/subscription_controller.ex index 16261a8a..c62a5c35 100644 --- a/lib/jellyfish_web/controllers/subscription_controller.ex +++ b/lib/jellyfish_web/controllers/subscription_controller.ex @@ -1,13 +1,13 @@ -defmodule JellyfishWeb.SubscriptionController do - use JellyfishWeb, :controller +defmodule FishjamWeb.SubscriptionController do + use FishjamWeb, :controller use OpenApiSpex.ControllerSpecs - alias Jellyfish.Room - alias Jellyfish.RoomService - alias JellyfishWeb.ApiSpec + alias Fishjam.Room + alias Fishjam.RoomService + alias FishjamWeb.ApiSpec alias OpenApiSpex.Response - action_fallback JellyfishWeb.FallbackController + action_fallback FishjamWeb.FallbackController tags [:room] diff --git a/lib/jellyfish_web/endpoint.ex b/lib/jellyfish_web/endpoint.ex index 18d0c75c..29dac23e 100644 --- a/lib/jellyfish_web/endpoint.ex +++ b/lib/jellyfish_web/endpoint.ex @@ -1,11 +1,11 @@ -defmodule JellyfishWeb.Endpoint do - use Phoenix.Endpoint, otp_app: :jellyfish +defmodule FishjamWeb.Endpoint do + use Phoenix.Endpoint, otp_app: :fishjam - socket "/socket/peer", JellyfishWeb.PeerSocket, + socket "/socket/peer", FishjamWeb.PeerSocket, websocket: true, longpoll: false - socket "/socket/server", JellyfishWeb.ServerSocket, + socket "/socket/server", FishjamWeb.ServerSocket, websocket: true, longpoll: false @@ -14,7 +14,7 @@ defmodule JellyfishWeb.Endpoint do # Set :encryption_salt if you would also like to encrypt it. @session_options [ store: :cookie, - key: "_jellyfish_key", + key: "_fishjam_key", signing_salt: "ojOkSTjg", same_site: "Lax" ] @@ -27,9 +27,9 @@ defmodule JellyfishWeb.Endpoint do # when deploying your static files in production. plug Plug.Static, at: "/", - from: :jellyfish, + from: :fishjam, gzip: false, - only: JellyfishWeb.static_paths() + only: FishjamWeb.static_paths() # Code reloading can be explicitly enabled under the # :code_reloader configuration of your endpoint. @@ -53,6 +53,6 @@ defmodule JellyfishWeb.Endpoint do plug Plug.Head plug Plug.Session, @session_options plug CORSPlug, origin: ["*"] - plug JellyfishWeb.TrafficMetricsPlug - plug JellyfishWeb.Router + plug FishjamWeb.TrafficMetricsPlug + plug FishjamWeb.Router end diff --git a/lib/jellyfish_web/peer_socket.ex b/lib/jellyfish_web/peer_socket.ex index 1f1d605d..b00077a3 100644 --- a/lib/jellyfish_web/peer_socket.ex +++ b/lib/jellyfish_web/peer_socket.ex @@ -1,13 +1,13 @@ -defmodule JellyfishWeb.PeerSocket do +defmodule FishjamWeb.PeerSocket do @moduledoc false @behaviour Phoenix.Socket.Transport require Logger - alias Jellyfish.Event - alias Jellyfish.PeerMessage - alias Jellyfish.PeerMessage.{Authenticated, AuthRequest, MediaEvent} - alias Jellyfish.{Room, RoomService} - alias JellyfishWeb.PeerToken + alias Fishjam.Event + alias Fishjam.PeerMessage + alias Fishjam.PeerMessage.{Authenticated, AuthRequest, MediaEvent} + alias Fishjam.{Room, RoomService} + alias FishjamWeb.PeerToken @heartbeat_interval 30_000 @@ -33,7 +33,7 @@ defmodule JellyfishWeb.PeerSocket do with {:ok, %{peer_id: peer_id, room_id: room_id}} <- PeerToken.verify(token), {:ok, room_pid} <- RoomService.find_room(room_id), :ok <- Room.set_peer_connected(room_id, peer_id), - :ok <- Phoenix.PubSub.subscribe(Jellyfish.PubSub, room_id) do + :ok <- Phoenix.PubSub.subscribe(Fishjam.PubSub, room_id) do Process.send_after(self(), :send_ping, @heartbeat_interval) encoded_message = diff --git a/lib/jellyfish_web/peer_token.ex b/lib/jellyfish_web/peer_token.ex index 4f682ab9..d06e3ce3 100644 --- a/lib/jellyfish_web/peer_token.ex +++ b/lib/jellyfish_web/peer_token.ex @@ -1,12 +1,12 @@ -defmodule JellyfishWeb.PeerToken do +defmodule FishjamWeb.PeerToken do @moduledoc false - alias JellyfishWeb.Endpoint + alias FishjamWeb.Endpoint @spec generate(map()) :: nonempty_binary def generate(data) do Phoenix.Token.sign( Endpoint, - Application.fetch_env!(:jellyfish, Endpoint)[:secret_key_base], + Application.fetch_env!(:fishjam, Endpoint)[:secret_key_base], data ) end @@ -15,9 +15,9 @@ defmodule JellyfishWeb.PeerToken do def verify(token) do Phoenix.Token.verify( Endpoint, - Application.fetch_env!(:jellyfish, Endpoint)[:secret_key_base], + Application.fetch_env!(:fishjam, Endpoint)[:secret_key_base], token, - max_age: Application.fetch_env!(:jellyfish, :jwt_max_age) + max_age: Application.fetch_env!(:fishjam, :jwt_max_age) ) end end diff --git a/lib/jellyfish_web/router.ex b/lib/jellyfish_web/router.ex index 69df8212..930af3a4 100644 --- a/lib/jellyfish_web/router.ex +++ b/lib/jellyfish_web/router.ex @@ -1,12 +1,12 @@ -defmodule JellyfishWeb.Router do - use JellyfishWeb, :router +defmodule FishjamWeb.Router do + use FishjamWeb, :router pipeline :api do plug :accepts, ["json"] plug :bearer_auth end - scope "/", JellyfishWeb do + scope "/", FishjamWeb do pipe_through :api scope "/health" do @@ -38,13 +38,13 @@ defmodule JellyfishWeb.Router do end # Paths which DO NOT require auth - scope "/", JellyfishWeb do + scope "/", FishjamWeb do get "/hls/:room_id/:filename", HLSContentController, :index get "/recording/:recording_id/:filename", RecordingContentController, :index end # Enable LiveDashboard in development - if Application.compile_env(:jellyfish, :dev_routes) do + if Application.compile_env(:fishjam, :dev_routes) do # If you want to use the LiveDashboard in production, you should put # it behind authentication and allow only admins to access it. # If your application does not have an admins-only section yet, @@ -55,11 +55,11 @@ defmodule JellyfishWeb.Router do scope "/dev" do pipe_through [:fetch_session, :protect_from_forgery] - live_dashboard "/dashboard", metrics: JellyfishWeb.Telemetry + live_dashboard "/dashboard", metrics: FishjamWeb.Telemetry end pipeline :open_api_spec do - plug OpenApiSpex.Plug.PutApiSpec, module: JellyfishWeb.ApiSpec + plug OpenApiSpex.Plug.PutApiSpec, module: FishjamWeb.ApiSpec end scope "/" do @@ -71,7 +71,7 @@ defmodule JellyfishWeb.Router do def bearer_auth(conn, _opts) do with ["Bearer " <> token] <- get_req_header(conn, "authorization"), - true <- token == Application.fetch_env!(:jellyfish, :server_api_token) do + true <- token == Application.fetch_env!(:fishjam, :server_api_token) do conn else false -> diff --git a/lib/jellyfish_web/server_socket.ex b/lib/jellyfish_web/server_socket.ex index 1367a281..cfda7b24 100644 --- a/lib/jellyfish_web/server_socket.ex +++ b/lib/jellyfish_web/server_socket.ex @@ -1,18 +1,18 @@ -defmodule JellyfishWeb.ServerSocket do +defmodule FishjamWeb.ServerSocket do @moduledoc false @behaviour Phoenix.Socket.Transport require Logger - alias Jellyfish.ServerMessage + alias Fishjam.ServerMessage - alias Jellyfish.ServerMessage.{ + alias Fishjam.ServerMessage.{ Authenticated, AuthRequest, SubscribeRequest, SubscribeResponse } - alias Jellyfish.Event + alias Fishjam.Event @heartbeat_interval 30_000 @@ -42,7 +42,7 @@ defmodule JellyfishWeb.ServerSocket do def handle_in({encoded_message, [opcode: :binary]}, %{authenticated?: false} = state) do case ServerMessage.decode(encoded_message) do %ServerMessage{content: {:auth_request, %AuthRequest{token: token}}} -> - if token == Application.fetch_env!(:jellyfish, :server_api_token) do + if token == Application.fetch_env!(:fishjam, :server_api_token) do Process.send_after(self(), :send_ping, @heartbeat_interval) encoded_message = diff --git a/lib/jellyfish_web/telemetry.ex b/lib/jellyfish_web/telemetry.ex index 8cdef662..4cb3b9c0 100644 --- a/lib/jellyfish_web/telemetry.ex +++ b/lib/jellyfish_web/telemetry.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.Telemetry do +defmodule FishjamWeb.Telemetry do @moduledoc false use Supervisor @@ -7,8 +7,8 @@ defmodule JellyfishWeb.Telemetry do @ice_received_event [Membrane.ICE, :ice, :payload, :received] @ice_sent_event [Membrane.ICE, :ice, :payload, :sent] - @http_request_event [:jellyfish_web, :request] - @http_response_event [:jellyfish_web, :response] + @http_request_event [:fishjam_web, :request] + @http_response_event [:fishjam_web, :response] def start_link(arg) do Supervisor.start_link(__MODULE__, arg, name: __MODULE__) @@ -16,8 +16,8 @@ defmodule JellyfishWeb.Telemetry do @impl true def init(_arg) do - metrics_ip = Application.fetch_env!(:jellyfish, :metrics_ip) - metrics_port = Application.fetch_env!(:jellyfish, :metrics_port) + metrics_ip = Application.fetch_env!(:fishjam, :metrics_ip) + metrics_port = Application.fetch_env!(:fishjam, :metrics_port) Logger.info( "Starting prometheus metrics endpoint at: http://#{:inet.ntoa(metrics_ip)}:#{metrics_port}" @@ -98,70 +98,70 @@ defmodule JellyfishWeb.Telemetry do metric_type.("vm.total_run_queue_lengths.io", []) ] ++ [ - # Jellyfish Metrics + # Fishjam Metrics # FIXME: At the moment, the traffic metrics track: - # - Most HTTP traffic (Jellyfish API, HLS) + # - Most HTTP traffic (Fishjam API, HLS) # - ICE events (WebRTC) # # which means they don't count: # - WebSocket traffic # - RTP events (RTSP components don't use ICE) # - HTTP traffic related to metrics (not handled by Phoenix) - sum("jellyfish.traffic.ingress.webrtc.total.bytes", + sum("fishjam.traffic.ingress.webrtc.total.bytes", event_name: @ice_received_event, description: "Total WebRTC traffic received (bytes)" ), - sum("jellyfish.traffic.egress.webrtc.total.bytes", + sum("fishjam.traffic.egress.webrtc.total.bytes", event_name: @ice_sent_event, description: "Total WebRTC traffic sent (bytes)" ), - sum("jellyfish.traffic.ingress.http.total.bytes", + sum("fishjam.traffic.ingress.http.total.bytes", event_name: @http_request_event, description: "Total HTTP traffic received (bytes)" ), - sum("jellyfish.traffic.egress.http.total.bytes", + sum("fishjam.traffic.egress.http.total.bytes", event_name: @http_response_event, description: "Total HTTP traffic sent (bytes)" ), - last_value("jellyfish.rooms", - description: "Number of rooms currently present in Jellyfish" + last_value("fishjam.rooms", + description: "Number of rooms currently present in Fishjam" ), # FIXME: Prometheus warns about using labels to store dimensions with high cardinality, # such as UUIDs. For more information refer here: https://prometheus.io/docs/practices/naming/#labels - last_value("jellyfish.room.peers", + last_value("fishjam.room.peers", tags: [:room_id], description: "Number of peers currently present in a given room" ), - sum("jellyfish.room.peer_time.total.seconds", - event_name: [:jellyfish, :room], + sum("fishjam.room.peer_time.total.seconds", + event_name: [:fishjam, :room], measurement: :peer_time, tags: [:room_id], description: "Total peer time accumulated for a given room (seconds)" ), - sum("jellyfish.room.duration.seconds", - event_name: [:jellyfish, :room], + sum("fishjam.room.duration.seconds", + event_name: [:fishjam, :room], measurement: :duration, tags: [:room_id], description: "Duration of a given room (seconds)" ), - sum("jellyfish.room.peer_connects.total", - event_name: [:jellyfish, :room], + sum("fishjam.room.peer_connects.total", + event_name: [:fishjam, :room], measurement: :peer_connects, tags: [:room_id], description: "Number of PeerConnected events emitted during the lifetime of a given room" ), - sum("jellyfish.room.peer_disconnects.total", - event_name: [:jellyfish, :room], + sum("fishjam.room.peer_disconnects.total", + event_name: [:fishjam, :room], measurement: :peer_disconnects, tags: [:room_id], description: "Number of PeerDisconnected events emitted during the lifetime of a given room" ), - sum("jellyfish.room.peer_crashes.total", - event_name: [:jellyfish, :room], + sum("fishjam.room.peer_crashes.total", + event_name: [:fishjam, :room], measurement: :peer_crashes, tags: [:room_id], description: "Number of PeerCrashed events emitted during the lifetime of a given room" diff --git a/lib/jellyfish_web/traffic_metrics_plug.ex b/lib/jellyfish_web/traffic_metrics_plug.ex index 98de2898..edf8ad3b 100644 --- a/lib/jellyfish_web/traffic_metrics_plug.ex +++ b/lib/jellyfish_web/traffic_metrics_plug.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.TrafficMetricsPlug do +defmodule FishjamWeb.TrafficMetricsPlug do @moduledoc false import Plug.Conn @@ -24,13 +24,13 @@ defmodule JellyfishWeb.TrafficMetricsPlug do def call(conn, _opts) do :telemetry.execute( - [:jellyfish_web, :request], + [:fishjam_web, :request], %{bytes: request_size(conn)} ) register_before_send(conn, fn conn -> :telemetry.execute( - [:jellyfish_web, :response], + [:fishjam_web, :response], %{bytes: response_size(conn)} ) diff --git a/lib/protos/jellyfish/peer_notifications.pb.ex b/lib/protos/fishjam/peer_notifications.pb.ex similarity index 57% rename from lib/protos/jellyfish/peer_notifications.pb.ex rename to lib/protos/fishjam/peer_notifications.pb.ex index 452c83e9..33cb2c51 100644 --- a/lib/protos/jellyfish/peer_notifications.pb.ex +++ b/lib/protos/fishjam/peer_notifications.pb.ex @@ -1,10 +1,10 @@ -defmodule Jellyfish.PeerMessage.Authenticated do +defmodule Fishjam.PeerMessage.Authenticated do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" end -defmodule Jellyfish.PeerMessage.AuthRequest do +defmodule Fishjam.PeerMessage.AuthRequest do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -12,7 +12,7 @@ defmodule Jellyfish.PeerMessage.AuthRequest do field :token, 1, type: :string end -defmodule Jellyfish.PeerMessage.MediaEvent do +defmodule Fishjam.PeerMessage.MediaEvent do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -20,19 +20,19 @@ defmodule Jellyfish.PeerMessage.MediaEvent do field :data, 1, type: :string end -defmodule Jellyfish.PeerMessage do +defmodule Fishjam.PeerMessage do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" oneof :content, 0 - field :authenticated, 1, type: Jellyfish.PeerMessage.Authenticated, oneof: 0 + field :authenticated, 1, type: Fishjam.PeerMessage.Authenticated, oneof: 0 field :auth_request, 2, - type: Jellyfish.PeerMessage.AuthRequest, + type: Fishjam.PeerMessage.AuthRequest, json_name: "authRequest", oneof: 0 - field :media_event, 3, type: Jellyfish.PeerMessage.MediaEvent, json_name: "mediaEvent", oneof: 0 + field :media_event, 3, type: Fishjam.PeerMessage.MediaEvent, json_name: "mediaEvent", oneof: 0 end diff --git a/lib/protos/jellyfish/server_notifications.pb.ex b/lib/protos/fishjam/server_notifications.pb.ex similarity index 68% rename from lib/protos/jellyfish/server_notifications.pb.ex rename to lib/protos/fishjam/server_notifications.pb.ex index 5e599133..e44c8524 100644 --- a/lib/protos/jellyfish/server_notifications.pb.ex +++ b/lib/protos/fishjam/server_notifications.pb.ex @@ -1,4 +1,4 @@ -defmodule Jellyfish.ServerMessage.EventType do +defmodule Fishjam.ServerMessage.EventType do @moduledoc false use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -8,7 +8,7 @@ defmodule Jellyfish.ServerMessage.EventType do field :EVENT_TYPE_METRICS, 2 end -defmodule Jellyfish.ServerMessage.TrackType do +defmodule Fishjam.ServerMessage.TrackType do @moduledoc false use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -18,7 +18,7 @@ defmodule Jellyfish.ServerMessage.TrackType do field :TRACK_TYPE_AUDIO, 2 end -defmodule Jellyfish.ServerMessage.RoomCrashed do +defmodule Fishjam.ServerMessage.RoomCrashed do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -26,7 +26,7 @@ defmodule Jellyfish.ServerMessage.RoomCrashed do field :room_id, 1, type: :string, json_name: "roomId" end -defmodule Jellyfish.ServerMessage.PeerAdded do +defmodule Fishjam.ServerMessage.PeerAdded do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -35,7 +35,7 @@ defmodule Jellyfish.ServerMessage.PeerAdded do field :peer_id, 2, type: :string, json_name: "peerId" end -defmodule Jellyfish.ServerMessage.PeerDeleted do +defmodule Fishjam.ServerMessage.PeerDeleted do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -44,7 +44,7 @@ defmodule Jellyfish.ServerMessage.PeerDeleted do field :peer_id, 2, type: :string, json_name: "peerId" end -defmodule Jellyfish.ServerMessage.PeerConnected do +defmodule Fishjam.ServerMessage.PeerConnected do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -53,7 +53,7 @@ defmodule Jellyfish.ServerMessage.PeerConnected do field :peer_id, 2, type: :string, json_name: "peerId" end -defmodule Jellyfish.ServerMessage.PeerDisconnected do +defmodule Fishjam.ServerMessage.PeerDisconnected do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -62,7 +62,7 @@ defmodule Jellyfish.ServerMessage.PeerDisconnected do field :peer_id, 2, type: :string, json_name: "peerId" end -defmodule Jellyfish.ServerMessage.PeerCrashed do +defmodule Fishjam.ServerMessage.PeerCrashed do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -72,7 +72,7 @@ defmodule Jellyfish.ServerMessage.PeerCrashed do field :reason, 3, type: :string end -defmodule Jellyfish.ServerMessage.ComponentCrashed do +defmodule Fishjam.ServerMessage.ComponentCrashed do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -81,13 +81,13 @@ defmodule Jellyfish.ServerMessage.ComponentCrashed do field :component_id, 2, type: :string, json_name: "componentId" end -defmodule Jellyfish.ServerMessage.Authenticated do +defmodule Fishjam.ServerMessage.Authenticated do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" end -defmodule Jellyfish.ServerMessage.AuthRequest do +defmodule Fishjam.ServerMessage.AuthRequest do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -95,29 +95,23 @@ defmodule Jellyfish.ServerMessage.AuthRequest do field :token, 1, type: :string end -defmodule Jellyfish.ServerMessage.SubscribeRequest do +defmodule Fishjam.ServerMessage.SubscribeRequest do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - field :event_type, 1, - type: Jellyfish.ServerMessage.EventType, - json_name: "eventType", - enum: true + field :event_type, 1, type: Fishjam.ServerMessage.EventType, json_name: "eventType", enum: true end -defmodule Jellyfish.ServerMessage.SubscribeResponse do +defmodule Fishjam.ServerMessage.SubscribeResponse do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - field :event_type, 1, - type: Jellyfish.ServerMessage.EventType, - json_name: "eventType", - enum: true + field :event_type, 1, type: Fishjam.ServerMessage.EventType, json_name: "eventType", enum: true end -defmodule Jellyfish.ServerMessage.RoomCreated do +defmodule Fishjam.ServerMessage.RoomCreated do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -125,7 +119,7 @@ defmodule Jellyfish.ServerMessage.RoomCreated do field :room_id, 1, type: :string, json_name: "roomId" end -defmodule Jellyfish.ServerMessage.RoomDeleted do +defmodule Fishjam.ServerMessage.RoomDeleted do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -133,7 +127,7 @@ defmodule Jellyfish.ServerMessage.RoomDeleted do field :room_id, 1, type: :string, json_name: "roomId" end -defmodule Jellyfish.ServerMessage.MetricsReport do +defmodule Fishjam.ServerMessage.MetricsReport do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -141,7 +135,7 @@ defmodule Jellyfish.ServerMessage.MetricsReport do field :metrics, 1, type: :string end -defmodule Jellyfish.ServerMessage.HlsPlayable do +defmodule Fishjam.ServerMessage.HlsPlayable do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -150,7 +144,7 @@ defmodule Jellyfish.ServerMessage.HlsPlayable do field :component_id, 2, type: :string, json_name: "componentId" end -defmodule Jellyfish.ServerMessage.HlsUploaded do +defmodule Fishjam.ServerMessage.HlsUploaded do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -158,7 +152,7 @@ defmodule Jellyfish.ServerMessage.HlsUploaded do field :room_id, 1, type: :string, json_name: "roomId" end -defmodule Jellyfish.ServerMessage.HlsUploadCrashed do +defmodule Fishjam.ServerMessage.HlsUploadCrashed do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -166,7 +160,7 @@ defmodule Jellyfish.ServerMessage.HlsUploadCrashed do field :room_id, 1, type: :string, json_name: "roomId" end -defmodule Jellyfish.ServerMessage.PeerMetadataUpdated do +defmodule Fishjam.ServerMessage.PeerMetadataUpdated do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -176,17 +170,17 @@ defmodule Jellyfish.ServerMessage.PeerMetadataUpdated do field :metadata, 3, type: :string end -defmodule Jellyfish.ServerMessage.Track do +defmodule Fishjam.ServerMessage.Track do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" field :id, 1, type: :string - field :type, 2, type: Jellyfish.ServerMessage.TrackType, enum: true + field :type, 2, type: Fishjam.ServerMessage.TrackType, enum: true field :metadata, 3, type: :string end -defmodule Jellyfish.ServerMessage.TrackAdded do +defmodule Fishjam.ServerMessage.TrackAdded do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -196,10 +190,10 @@ defmodule Jellyfish.ServerMessage.TrackAdded do field :room_id, 1, type: :string, json_name: "roomId" field :peer_id, 2, type: :string, json_name: "peerId", oneof: 0 field :component_id, 3, type: :string, json_name: "componentId", oneof: 0 - field :track, 4, type: Jellyfish.ServerMessage.Track + field :track, 4, type: Fishjam.ServerMessage.Track end -defmodule Jellyfish.ServerMessage.TrackRemoved do +defmodule Fishjam.ServerMessage.TrackRemoved do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -209,10 +203,10 @@ defmodule Jellyfish.ServerMessage.TrackRemoved do field :room_id, 1, type: :string, json_name: "roomId" field :peer_id, 2, type: :string, json_name: "peerId", oneof: 0 field :component_id, 3, type: :string, json_name: "componentId", oneof: 0 - field :track, 4, type: Jellyfish.ServerMessage.Track + field :track, 4, type: Fishjam.ServerMessage.Track end -defmodule Jellyfish.ServerMessage.TrackMetadataUpdated do +defmodule Fishjam.ServerMessage.TrackMetadataUpdated do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -222,10 +216,10 @@ defmodule Jellyfish.ServerMessage.TrackMetadataUpdated do field :room_id, 1, type: :string, json_name: "roomId" field :peer_id, 2, type: :string, json_name: "peerId", oneof: 0 field :component_id, 3, type: :string, json_name: "componentId", oneof: 0 - field :track, 4, type: Jellyfish.ServerMessage.Track + field :track, 4, type: Fishjam.ServerMessage.Track end -defmodule Jellyfish.ServerMessage do +defmodule Fishjam.ServerMessage do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" @@ -233,101 +227,101 @@ defmodule Jellyfish.ServerMessage do oneof :content, 0 field :room_crashed, 1, - type: Jellyfish.ServerMessage.RoomCrashed, + type: Fishjam.ServerMessage.RoomCrashed, json_name: "roomCrashed", oneof: 0 field :peer_connected, 2, - type: Jellyfish.ServerMessage.PeerConnected, + type: Fishjam.ServerMessage.PeerConnected, json_name: "peerConnected", oneof: 0 field :peer_disconnected, 3, - type: Jellyfish.ServerMessage.PeerDisconnected, + type: Fishjam.ServerMessage.PeerDisconnected, json_name: "peerDisconnected", oneof: 0 field :peer_crashed, 4, - type: Jellyfish.ServerMessage.PeerCrashed, + type: Fishjam.ServerMessage.PeerCrashed, json_name: "peerCrashed", oneof: 0 field :component_crashed, 5, - type: Jellyfish.ServerMessage.ComponentCrashed, + type: Fishjam.ServerMessage.ComponentCrashed, json_name: "componentCrashed", oneof: 0 - field :authenticated, 6, type: Jellyfish.ServerMessage.Authenticated, oneof: 0 + field :authenticated, 6, type: Fishjam.ServerMessage.Authenticated, oneof: 0 field :auth_request, 7, - type: Jellyfish.ServerMessage.AuthRequest, + type: Fishjam.ServerMessage.AuthRequest, json_name: "authRequest", oneof: 0 field :subscribe_request, 8, - type: Jellyfish.ServerMessage.SubscribeRequest, + type: Fishjam.ServerMessage.SubscribeRequest, json_name: "subscribeRequest", oneof: 0 field :subscribe_response, 9, - type: Jellyfish.ServerMessage.SubscribeResponse, + type: Fishjam.ServerMessage.SubscribeResponse, json_name: "subscribeResponse", oneof: 0 field :room_created, 10, - type: Jellyfish.ServerMessage.RoomCreated, + type: Fishjam.ServerMessage.RoomCreated, json_name: "roomCreated", oneof: 0 field :room_deleted, 11, - type: Jellyfish.ServerMessage.RoomDeleted, + type: Fishjam.ServerMessage.RoomDeleted, json_name: "roomDeleted", oneof: 0 field :metrics_report, 12, - type: Jellyfish.ServerMessage.MetricsReport, + type: Fishjam.ServerMessage.MetricsReport, json_name: "metricsReport", oneof: 0 field :hls_playable, 13, - type: Jellyfish.ServerMessage.HlsPlayable, + type: Fishjam.ServerMessage.HlsPlayable, json_name: "hlsPlayable", oneof: 0 field :hls_uploaded, 14, - type: Jellyfish.ServerMessage.HlsUploaded, + type: Fishjam.ServerMessage.HlsUploaded, json_name: "hlsUploaded", oneof: 0 field :hls_upload_crashed, 15, - type: Jellyfish.ServerMessage.HlsUploadCrashed, + type: Fishjam.ServerMessage.HlsUploadCrashed, json_name: "hlsUploadCrashed", oneof: 0 field :peer_metadata_updated, 16, - type: Jellyfish.ServerMessage.PeerMetadataUpdated, + type: Fishjam.ServerMessage.PeerMetadataUpdated, json_name: "peerMetadataUpdated", oneof: 0 field :track_added, 17, - type: Jellyfish.ServerMessage.TrackAdded, + type: Fishjam.ServerMessage.TrackAdded, json_name: "trackAdded", oneof: 0 field :track_removed, 18, - type: Jellyfish.ServerMessage.TrackRemoved, + type: Fishjam.ServerMessage.TrackRemoved, json_name: "trackRemoved", oneof: 0 field :track_metadata_updated, 19, - type: Jellyfish.ServerMessage.TrackMetadataUpdated, + type: Fishjam.ServerMessage.TrackMetadataUpdated, json_name: "trackMetadataUpdated", oneof: 0 - field :peer_added, 20, type: Jellyfish.ServerMessage.PeerAdded, json_name: "peerAdded", oneof: 0 + field :peer_added, 20, type: Fishjam.ServerMessage.PeerAdded, json_name: "peerAdded", oneof: 0 field :peer_deleted, 21, - type: Jellyfish.ServerMessage.PeerDeleted, + type: Fishjam.ServerMessage.PeerDeleted, json_name: "peerDeleted", oneof: 0 end diff --git a/mix.exs b/mix.exs index fffd98d7..5e393486 100644 --- a/mix.exs +++ b/mix.exs @@ -1,10 +1,10 @@ -defmodule Jellyfish.MixProject do +defmodule Fishjam.MixProject do use Mix.Project def project do [ - app: :jellyfish, - version: "0.5.0", + app: :fishjam, + version: "0.6.0-dev", elixir: "~> 1.14", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, @@ -13,8 +13,7 @@ defmodule Jellyfish.MixProject do dialyzer: dialyzer(), # hex - description: "Jellyfish media server", - package: package(), + description: "Fishjam media server", # test coverage test_coverage: [tool: ExCoveralls], @@ -35,7 +34,7 @@ defmodule Jellyfish.MixProject do # Type `mix help compile.app` for more information. def application do [ - mod: {Jellyfish.Application, []}, + mod: {Fishjam.Application, []}, extra_applications: [:logger, :runtime_tools] ] end @@ -132,17 +131,6 @@ defmodule Jellyfish.MixProject do end end - defp package do - [ - maintainers: ["Membrane Team"], - licenses: ["Apache-2.0"], - links: %{ - "GitHub" => "https://github.com/jellyfish-dev/jellyfish", - "Membrane Framework Homepage" => "https://membrane.stream" - } - ] - end - defp generate_api_spec(_args) do output_filename = "openapi.yaml" generated_filename = "openapi-gen.yaml" @@ -156,7 +144,7 @@ defmodule Jellyfish.MixProject do "openapi.spec.yaml", "--start-app=false", "--spec", - "JellyfishWeb.ApiSpec", + "FishjamWeb.ApiSpec", generated_filename ], into: IO.stream() diff --git a/openapi.yaml b/openapi.yaml index fc5e1637..2a800621 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -13,16 +13,16 @@ components: example: disconnected title: PeerStatus type: string - x-struct: Elixir.JellyfishWeb.ApiSpec.Peer.Status + x-struct: Elixir.FishjamWeb.ApiSpec.Peer.Status HealthReportStatus: - description: Informs about the status of Jellyfish or a specific service + description: Informs about the status of Fishjam or a specific service enum: - UP - DOWN example: UP title: HealthReportStatus type: string - x-struct: Elixir.JellyfishWeb.ApiSpec.HealthReport.Status + x-struct: Elixir.FishjamWeb.ApiSpec.HealthReport.Status RoomDetailsResponse: description: Response containing room details properties: @@ -32,7 +32,7 @@ components: - data title: RoomDetailsResponse type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.RoomDetailsResponse + x-struct: Elixir.FishjamWeb.ApiSpec.RoomDetailsResponse ComponentOptionsRTSP: description: Options specific to the RTSP component properties: @@ -64,7 +64,7 @@ components: - sourceUri title: ComponentOptionsRTSP type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.RTSP.Options + x-struct: Elixir.FishjamWeb.ApiSpec.Component.RTSP.Options ComponentOptionsSIP: description: Options specific to the SIP component properties: @@ -87,12 +87,12 @@ components: - password title: SIPCredentials type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.SIP.SIPCredentials + x-struct: Elixir.FishjamWeb.ApiSpec.Component.SIP.SIPCredentials required: - registrarCredentials title: ComponentOptionsSIP type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.SIP.Options + x-struct: Elixir.FishjamWeb.ApiSpec.Component.SIP.Options ComponentPropertiesHLS: description: Properties specific to the HLS component properties: @@ -123,7 +123,7 @@ components: - subscribeMode title: ComponentPropertiesHLS type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.HLS.Properties + x-struct: Elixir.FishjamWeb.ApiSpec.Component.HLS.Properties Room: description: Description of the room state properties: @@ -150,7 +150,7 @@ components: - peers title: Room type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Room + x-struct: Elixir.FishjamWeb.ApiSpec.Room ComponentOptionsRecording: description: Options specific to the Recording component properties: @@ -173,7 +173,7 @@ components: type: string title: ComponentOptionsRecording type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.Recording.Options + x-struct: Elixir.FishjamWeb.ApiSpec.Component.Recording.Options Component: description: Describes component discriminator: @@ -192,7 +192,7 @@ components: - $ref: '#/components/schemas/ComponentRecording' title: Component type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component + x-struct: Elixir.FishjamWeb.ApiSpec.Component PeerOptionsWebRTC: description: Options specific to the WebRTC peer properties: @@ -202,9 +202,9 @@ components: type: boolean title: PeerOptionsWebRTC type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Peer.WebRTC + x-struct: Elixir.FishjamWeb.ApiSpec.Peer.WebRTC HealthcheckResponse: - description: Response containing health report of Jellyfish + description: Response containing health report of Fishjam properties: data: $ref: '#/components/schemas/HealthReport' @@ -212,7 +212,7 @@ components: - data title: HealthcheckResponse type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.HealthcheckResponse + x-struct: Elixir.FishjamWeb.ApiSpec.HealthcheckResponse ComponentSIP: description: Describes the SIP component properties: @@ -238,7 +238,7 @@ components: - tracks title: ComponentSIP type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.SIP + x-struct: Elixir.FishjamWeb.ApiSpec.Component.SIP ComponentHLS: description: Describes the HLS component properties: @@ -264,21 +264,21 @@ components: - tracks title: ComponentHLS type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.HLS + x-struct: Elixir.FishjamWeb.ApiSpec.Component.HLS HlsSkip: description: Set to "YES" if delta manifest should be requested example: YES nullable: true title: HlsSkip type: string - x-struct: Elixir.JellyfishWeb.ApiSpec.HLS.Params.HlsSkip + x-struct: Elixir.FishjamWeb.ApiSpec.HLS.Params.HlsSkip PeerMetadata: description: Custom metadata set by the peer example: - name: JellyfishUser + name: FishjamUser nullable: true title: PeerMetadata - x-struct: Elixir.JellyfishWeb.ApiSpec.Peer.PeerMetadata + x-struct: Elixir.FishjamWeb.ApiSpec.Peer.PeerMetadata ComponentPropertiesFile: description: Properties specific to the File component properties: @@ -295,7 +295,7 @@ components: - framerate title: ComponentPropertiesFile type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.File.Properties + x-struct: Elixir.FishjamWeb.ApiSpec.Component.File.Properties ComponentFile: description: Describes the File component properties: @@ -320,7 +320,7 @@ components: - tracks title: ComponentFile type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.File + x-struct: Elixir.FishjamWeb.ApiSpec.Component.File SubscriptionConfig: description: Subscription config properties: @@ -331,7 +331,7 @@ components: type: array title: SubscriptionConfig type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Subscription.Origins + x-struct: Elixir.FishjamWeb.ApiSpec.Subscription.Origins HlsMsn: description: Segment sequence number example: 10 @@ -339,7 +339,7 @@ components: nullable: true title: HlsMsn type: integer - x-struct: Elixir.JellyfishWeb.ApiSpec.HLS.Params.HlsMsn + x-struct: Elixir.FishjamWeb.ApiSpec.HLS.Params.HlsMsn ComponentPropertiesRecording: description: Properties specific to the Recording component properties: @@ -353,7 +353,7 @@ components: - subscribeMode title: ComponentPropertiesRecording type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.Recording.Properties + x-struct: Elixir.FishjamWeb.ApiSpec.Component.Recording.Properties DialConfig: description: Dial config properties: @@ -362,7 +362,7 @@ components: type: string title: DialConfig type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Dial.PhoneNumber + x-struct: Elixir.FishjamWeb.ApiSpec.Dial.PhoneNumber ComponentRTSP: description: Describes the RTSP component properties: @@ -388,7 +388,7 @@ components: - tracks title: ComponentRTSP type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.RTSP + x-struct: Elixir.FishjamWeb.ApiSpec.Component.RTSP HlsPart: description: Partial segment sequence number example: 10 @@ -396,13 +396,13 @@ components: nullable: true title: HlsPart type: integer - x-struct: Elixir.JellyfishWeb.ApiSpec.HLS.Params.HlsPart + x-struct: Elixir.FishjamWeb.ApiSpec.HLS.Params.HlsPart WebsocketURL: description: Websocket URL to which peer has to connect - example: www.jellyfish.org/socket/peer + example: www.fishjam.org/socket/peer title: WebsocketURL type: string - x-struct: Elixir.JellyfishWeb.ApiSpec.Peer.WebSocketUrl + x-struct: Elixir.FishjamWeb.ApiSpec.Peer.WebSocketUrl ComponentDetailsResponse: description: Response containing component details properties: @@ -412,7 +412,7 @@ components: - data title: ComponentDetailsResponse type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.ComponentDetailsResponse + x-struct: Elixir.FishjamWeb.ApiSpec.ComponentDetailsResponse ComponentOptionsHLS: description: Options specific to the HLS component properties: @@ -443,7 +443,7 @@ components: type: integer title: ComponentOptionsHLS type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.HLS.Options + x-struct: Elixir.FishjamWeb.ApiSpec.Component.HLS.Options SIPCredentials: description: Credentials used to authorize in SIP Provider service properties: @@ -463,7 +463,7 @@ components: - password title: SIPCredentials type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.SIP.SIPCredentials + x-struct: Elixir.FishjamWeb.ApiSpec.Component.SIP.SIPCredentials S3Credentials: description: An AWS S3 credential that will be used to send HLS stream. The stream will only be uploaded if credentials are provided properties: @@ -486,7 +486,7 @@ components: - bucket title: S3Credentials type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.HLS.S3 + x-struct: Elixir.FishjamWeb.ApiSpec.Component.HLS.S3 RecordingListResponse: description: Response containing list of all recording properties: @@ -498,7 +498,7 @@ components: - data title: RecordingListResponse type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.RecordingListResponse + x-struct: Elixir.FishjamWeb.ApiSpec.RecordingListResponse ComponentOptions: description: Component-specific options oneOf: @@ -509,7 +509,7 @@ components: - $ref: '#/components/schemas/ComponentOptionsRecording' title: ComponentOptions type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.Options + x-struct: Elixir.FishjamWeb.ApiSpec.Component.Options Track: description: Describes media track of a Peer or Component properties: @@ -524,24 +524,24 @@ components: type: string title: Track type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Track + x-struct: Elixir.FishjamWeb.ApiSpec.Track HealthReportDistribution: - description: Informs about the status of Jellyfish distribution + description: Informs about the status of Fishjam distribution properties: enabled: - description: Whether distribution is enabled on this Jellyfish + description: Whether distribution is enabled on this Fishjam type: boolean nodeStatus: $ref: '#/components/schemas/HealthReportStatus' nodesInCluster: - description: Amount of nodes (including this Jellyfish's node) in the distribution cluster + description: Amount of nodes (including this Fishjam's node) in the distribution cluster type: integer required: - nodeStatus - nodesInCluster title: HealthReportDistribution type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.HealthReport.Distribution + x-struct: Elixir.FishjamWeb.ApiSpec.HealthReport.Distribution ComponentPropertiesRTSP: description: Properties specific to the RTSP component properties: @@ -568,16 +568,16 @@ components: - pierceNat title: ComponentPropertiesRTSP type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.RTSP.Properties + x-struct: Elixir.FishjamWeb.ApiSpec.Component.RTSP.Properties PeerOptions: description: Peer-specific options oneOf: - $ref: '#/components/schemas/PeerOptionsWebRTC' title: PeerOptions type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Peer.Options + x-struct: Elixir.FishjamWeb.ApiSpec.Peer.Options HealthReport: - description: Describes overall Jellyfish health + description: Describes overall Fishjam health properties: distribution: $ref: '#/components/schemas/HealthReportDistribution' @@ -587,10 +587,10 @@ components: status: $ref: '#/components/schemas/HealthReportStatus' uptime: - description: Uptime of Jellyfish (in seconds) + description: Uptime of Fishjam (in seconds) type: integer version: - description: Version of Jellyfish + description: Version of Fishjam type: string required: - status @@ -600,7 +600,7 @@ components: - gitCommit title: HealthReport type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.HealthReport + x-struct: Elixir.FishjamWeb.ApiSpec.HealthReport Peer: description: Describes peer status properties: @@ -627,19 +627,19 @@ components: - metadata title: Peer type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Peer + x-struct: Elixir.FishjamWeb.ApiSpec.Peer ComponentType: description: Component type example: hls title: ComponentType type: string - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.Type + x-struct: Elixir.FishjamWeb.ApiSpec.Component.Type AuthToken: description: Token for authorizing websocket connection example: 5cdac726-57a3-4ecb-b1d5-72a3d62ec242 title: AuthToken type: string - x-struct: Elixir.JellyfishWeb.ApiSpec.Peer.Token + x-struct: Elixir.FishjamWeb.ApiSpec.Peer.Token RoomsListingResponse: description: Response containing list of all rooms properties: @@ -651,7 +651,7 @@ components: - data title: RoomsListingResponse type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.RoomsListingResponse + x-struct: Elixir.FishjamWeb.ApiSpec.RoomsListingResponse ComponentPropertiesSIP: description: Properties specific to the SIP component properties: @@ -674,12 +674,12 @@ components: - password title: SIPCredentials type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.SIP.SIPCredentials + x-struct: Elixir.FishjamWeb.ApiSpec.Component.SIP.SIPCredentials required: - registrarCredentials title: ComponentPropertiesSIP type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.SIP.Properties + x-struct: Elixir.FishjamWeb.ApiSpec.Component.SIP.Properties PeerDetailsResponse: description: Response containing peer details and their token properties: @@ -699,12 +699,12 @@ components: - data title: PeerDetailsResponse type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.PeerDetailsResponse + x-struct: Elixir.FishjamWeb.ApiSpec.PeerDetailsResponse HlsResponse: description: Requested file title: HlsResponse type: string - x-struct: Elixir.JellyfishWeb.ApiSpec.HLS.Response + x-struct: Elixir.FishjamWeb.ApiSpec.HLS.Response ComponentRecording: description: Describes the Recording component properties: @@ -730,33 +730,33 @@ components: - tracks title: ComponentRecording type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.Recording + x-struct: Elixir.FishjamWeb.ApiSpec.Component.Recording PeerType: description: Peer type example: webrtc title: PeerType type: string - x-struct: Elixir.JellyfishWeb.ApiSpec.Peer.Type + x-struct: Elixir.FishjamWeb.ApiSpec.Peer.Type RoomCreateDetailsResponse: description: Response containing room details properties: data: properties: - jellyfish_address: - description: Jellyfish instance address where the room was created. This might be different than the address of Jellyfish where the request was sent only when running a cluster of Jellyfishes. - example: jellyfish1:5003 + fishjam_address: + description: Fishjam instance address where the room was created. This might be different than the address of Fishjam where the request was sent only when running a cluster of Fishjams. + example: fishjam1:5003 type: string room: $ref: '#/components/schemas/Room' required: - room - - jellyfish_address + - fishjam_address type: object required: - data title: RoomCreateDetailsResponse type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.RoomCreateDetailsResponse + x-struct: Elixir.FishjamWeb.ApiSpec.RoomCreateDetailsResponse ComponentOptionsFile: description: Options specific to the File component properties: @@ -773,7 +773,7 @@ components: - filePath title: ComponentOptionsFile type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Component.File.Options + x-struct: Elixir.FishjamWeb.ApiSpec.Component.File.Options Error: description: Error message properties: @@ -785,7 +785,7 @@ components: - errors title: Error type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Error + x-struct: Elixir.FishjamWeb.ApiSpec.Error RoomConfig: description: Room configuration properties: @@ -808,7 +808,7 @@ components: nullable: true type: integer roomId: - description: Custom id used for identifying room within Jellyfish. Must be unique across all rooms. If not provided, random UUID is generated. + description: Custom id used for identifying room within Fishjam. Must be unique across all rooms. If not provided, random UUID is generated. nullable: true type: string videoCodec: @@ -819,13 +819,13 @@ components: nullable: true type: string webhookUrl: - description: URL where Jellyfish notifications will be sent - example: https://backend.address.com/jellyfish-notifications-endpoint + description: URL where Fishjam notifications will be sent + example: https://backend.address.com/fishjam-notifications-endpoint nullable: true type: string title: RoomConfig type: object - x-struct: Elixir.JellyfishWeb.ApiSpec.Room.Config + x-struct: Elixir.FishjamWeb.ApiSpec.Room.Config securitySchemes: authorization: scheme: bearer @@ -834,8 +834,8 @@ info: license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0 - title: Jellyfish Media Server - version: 0.5.0 + title: Fishjam Media Server + version: 0.6.0-dev openapi: 3.0.0 paths: /health: @@ -858,7 +858,7 @@ paths: description: Unauthorized security: - authorization: [] - summary: Describes the health of Jellyfish + summary: Describes the health of Fishjam tags: - health /hls/{room_id}/{filename}: diff --git a/protos b/protos index 7da5da12..83aa1514 160000 --- a/protos +++ b/protos @@ -1 +1 @@ -Subproject commit 7da5da127c8e018ee0c845c921f598b10209271c +Subproject commit 83aa151401f9cd03fe91029d4ef2f8175fcf58f2 diff --git a/rel/env.sh.eex b/rel/env.sh.eex index 8a30c779..936e04cf 100644 --- a/rel/env.sh.eex +++ b/rel/env.sh.eex @@ -1,37 +1,37 @@ # We introduce our own env vars and use them to override # those provided by mix release. -# This is to have a unified way of configuring Jellyfish distribution +# This is to have a unified way of configuring Fishjam distribution # in both development and production environments -if [ "$JF_DIST_ENABLED" == "true" ]; then - # If Jellyfish is meant to be run in a cluster, +if [ "$FJ_DIST_ENABLED" == "true" ]; then + # If Fishjam is meant to be run in a cluster, # leave node setup to the Elixir code where # we do extra steps for DNS strategy to determine actual node name. # # We also try to read RELEASE_DISTRIBUTION env var - # to allow for calling `remote` command with JF_DIST_ENABLED set. + # to allow for calling `remote` command with FJ_DIST_ENABLED set. # In other case, RELEASE_DISTRIBUTION will always be set to none. - # This is a little hack. + # This is a little hack. # We can get rid of it once we move to the reverse DNS strategy. export RELEASE_DISTRIBUTION=${RELEASE_DISTRIBUTION:-none} # We only set min and max ports for start and daemon commands. # In other case, when someone wants to expose only one port - # (JF_DIST_MIN_PORT==JF_DIST_MAX_PORT), we won't be able to + # (FJ_DIST_MIN_PORT==FJ_DIST_MAX_PORT), we won't be able to # connect to already running node with the `remote` command. - if [ "$JF_DIST_MIN_PORT" != "" ]; then + if [ "$FJ_DIST_MIN_PORT" != "" ]; then case $RELEASE_COMMAND in start* | daemon*) - ELIXIR_ERL_OPTIONS="$ELIXIR_ERL_OPTIONS -kernel inet_dist_listen_min $JF_DIST_MIN_PORT" + ELIXIR_ERL_OPTIONS="$ELIXIR_ERL_OPTIONS -kernel inet_dist_listen_min $FJ_DIST_MIN_PORT" export ELIXIR_ERL_OPTIONS ;; *) ;; esac fi - if [ "$JF_DIST_MAX_PORT" != "" ]; then + if [ "$FJ_DIST_MAX_PORT" != "" ]; then case $RELEASE_COMMAND in start* | daemon*) - ELIXIR_ERL_OPTIONS="$ELIXIR_ERL_OPTIONS -kernel inet_dist_listen_max $JF_DIST_MAX_PORT" + ELIXIR_ERL_OPTIONS="$ELIXIR_ERL_OPTIONS -kernel inet_dist_listen_max $FJ_DIST_MAX_PORT" export ELIXIR_ERL_OPTIONS ;; *) ;; diff --git a/test/jellyfish/cluster/load_balancing_test.exs b/test/jellyfish/cluster/load_balancing_test.exs index 53d9d9fc..8d5ed654 100644 --- a/test/jellyfish/cluster/load_balancing_test.exs +++ b/test/jellyfish/cluster/load_balancing_test.exs @@ -1,11 +1,11 @@ -defmodule Jellyfish.Cluster.LoadBalancingTest do +defmodule Fishjam.Cluster.LoadBalancingTest do @moduledoc false use ExUnit.Case, async: false @node1 "localhost:4001" @node2 "localhost:4002" - @token Application.compile_env(:jellyfish, :server_api_token) + @token Application.compile_env(:fishjam, :server_api_token) @headers [Authorization: "Bearer #{@token}", Accept: "Application/json; Charset=utf-8"] @moduletag :cluster @@ -28,70 +28,70 @@ defmodule Jellyfish.Cluster.LoadBalancingTest do response_body1 = add_room(node1) - jellyfish_instance1 = get_jellyfish_address(response_body1) + fishjam_instance1 = get_fishjam_address(response_body1) - assert_rooms_number_on_jellyfish(jellyfish_instance1, 1) + assert_rooms_number_on_fishjam(fishjam_instance1, 1) response_body2 = add_room(node1) - jellyfish_instance2 = get_jellyfish_address(response_body2) + fishjam_instance2 = get_fishjam_address(response_body2) - assert_rooms_number_on_jellyfish(jellyfish_instance2, 1) + assert_rooms_number_on_fishjam(fishjam_instance2, 1) - assert_rooms_number_on_jellyfish(node1, 1) - assert_rooms_number_on_jellyfish(node2, 1) + assert_rooms_number_on_fishjam(node1, 1) + assert_rooms_number_on_fishjam(node2, 1) room_id = response_body1 |> Jason.decode!() |> get_in(["data", "room", "id"]) - delete_room(jellyfish_instance1, room_id) + delete_room(fishjam_instance1, room_id) - assert_rooms_number_on_jellyfish(jellyfish_instance1, 0) - assert_rooms_number_on_jellyfish(jellyfish_instance2, 1) + assert_rooms_number_on_fishjam(fishjam_instance1, 0) + assert_rooms_number_on_fishjam(fishjam_instance2, 1) response_body3 = add_room(node1) - jellyfish_instance3 = get_jellyfish_address(response_body3) - assert_rooms_number_on_jellyfish(jellyfish_instance3, 1) + fishjam_instance3 = get_fishjam_address(response_body3) + assert_rooms_number_on_fishjam(fishjam_instance3, 1) - assert_rooms_number_on_jellyfish(node1, 1) - assert_rooms_number_on_jellyfish(node2, 1) + assert_rooms_number_on_fishjam(node1, 1) + assert_rooms_number_on_fishjam(node2, 1) end - defp add_room(jellyfish_instance) do + defp add_room(fishjam_instance) do assert {:ok, %HTTPoison.Response{status_code: 201, body: body}} = - HTTPoison.post("http://#{jellyfish_instance}/room", [], @headers) + HTTPoison.post("http://#{fishjam_instance}/room", [], @headers) body end - defp delete_room(jellyfish_instance, room_id) do + defp delete_room(fishjam_instance, room_id) do assert {:ok, %HTTPoison.Response{status_code: 204, body: body}} = - HTTPoison.delete("http://#{jellyfish_instance}/room/#{room_id}", @headers) + HTTPoison.delete("http://#{fishjam_instance}/room/#{room_id}", @headers) body end if Mix.env() == :test do - defp map_jellyfish_address(jellyfish), do: jellyfish + defp map_fishjam_address(fishjam), do: fishjam else - defp map_jellyfish_address(jellyfish) do + defp map_fishjam_address(fishjam) do %{ @node1 => "app1:4001", @node2 => "app2:4002" } - |> Map.get(jellyfish) + |> Map.get(fishjam) end end - defp get_jellyfish_address(response_body) do + defp get_fishjam_address(response_body) do response_body |> Jason.decode!() - |> get_in(["data", "jellyfish_address"]) - |> map_jellyfish_address() + |> get_in(["data", "fishjam_address"]) + |> map_fishjam_address() end - defp assert_rooms_number_on_jellyfish(jellyfish_instance, rooms) do + defp assert_rooms_number_on_fishjam(fishjam_instance, rooms) do assert {:ok, %HTTPoison.Response{status_code: 200, body: body}} = - HTTPoison.get("http://#{jellyfish_instance}/room", @headers) + HTTPoison.get("http://#{fishjam_instance}/room", @headers) assert ^rooms = body |> Jason.decode!() |> Map.get("data") |> Enum.count() end diff --git a/test/jellyfish/component/hls/ets_helper_test.exs b/test/jellyfish/component/hls/ets_helper_test.exs index 65863584..35b72fca 100644 --- a/test/jellyfish/component/hls/ets_helper_test.exs +++ b/test/jellyfish/component/hls/ets_helper_test.exs @@ -1,9 +1,9 @@ -defmodule Jellyfish.Component.HLS.EtsHelperTest do +defmodule Fishjam.Component.HLS.EtsHelperTest do @moduledoc false use ExUnit.Case, async: false - alias Jellyfish.Component.HLS.EtsHelper + alias Fishjam.Component.HLS.EtsHelper @partial <<1, 2, 3>> @partial_name "partial_1" diff --git a/test/jellyfish/component/hls/ll_storage_test.exs b/test/jellyfish/component/hls/ll_storage_test.exs index 956e7a4e..c0a23508 100644 --- a/test/jellyfish/component/hls/ll_storage_test.exs +++ b/test/jellyfish/component/hls/ll_storage_test.exs @@ -1,9 +1,9 @@ -defmodule Jellyfish.Component.HLS.LLStorageTest do +defmodule Fishjam.Component.HLS.LLStorageTest do @moduledoc false use ExUnit.Case, async: true - alias Jellyfish.Component.HLS.{EtsHelper, LLStorage, RequestHandler} + alias Fishjam.Component.HLS.{EtsHelper, LLStorage, RequestHandler} @segment_name "segment" @segment_content <<1, 2, 3>> diff --git a/test/jellyfish/component/hls/manager_test.exs b/test/jellyfish/component/hls/manager_test.exs index bbc47f23..10ccf482 100644 --- a/test/jellyfish/component/hls/manager_test.exs +++ b/test/jellyfish/component/hls/manager_test.exs @@ -1,12 +1,12 @@ -defmodule Jellyfish.Component.HLS.ManagerTest do +defmodule Fishjam.Component.HLS.ManagerTest do @moduledoc false use ExUnit.Case import Mox - alias Jellyfish.Component.HLS - alias Jellyfish.Component.HLS.Manager + alias Fishjam.Component.HLS + alias Fishjam.Component.HLS.Manager @files ["manifest.m3u8", "header.mp4", "segment_1.m3u8", "segment_2.m3u8"] @s3_credentials %{ diff --git a/test/jellyfish/component/hls/request_handler_test.exs b/test/jellyfish/component/hls/request_handler_test.exs index 35d8d8c4..d01516e4 100644 --- a/test/jellyfish/component/hls/request_handler_test.exs +++ b/test/jellyfish/component/hls/request_handler_test.exs @@ -1,10 +1,10 @@ -defmodule Jellyfish.Component.HLS.RequestHandlerTest do +defmodule Fishjam.Component.HLS.RequestHandlerTest do @moduledoc false use ExUnit.Case, async: true - alias Jellyfish.Component.HLS - alias Jellyfish.Component.HLS.{EtsHelper, RequestHandler} + alias Fishjam.Component.HLS + alias Fishjam.Component.HLS.{EtsHelper, RequestHandler} @wrong_room_id "321" diff --git a/test/jellyfish/config_reader_test.exs b/test/jellyfish/config_reader_test.exs index 05c6eb92..4c94e254 100644 --- a/test/jellyfish/config_reader_test.exs +++ b/test/jellyfish/config_reader_test.exs @@ -1,10 +1,10 @@ -defmodule Jellyfish.ConfigReaderTest do +defmodule Fishjam.ConfigReaderTest do use ExUnit.Case # run this test synchronously as we use # official env vars in read_dist_config test - alias Jellyfish.ConfigReader + alias Fishjam.ConfigReader defmacrop with_env(env, do: body) do # get current env(s) value(s), @@ -31,7 +31,7 @@ defmodule Jellyfish.ConfigReaderTest do end test "read_ip/1" do - env_name = "JF_CONF_READER_TEST_IP" + env_name = "FJ_CONF_READER_TEST_IP" with_env env_name do System.put_env(env_name, "127.0.0.1") @@ -44,7 +44,7 @@ defmodule Jellyfish.ConfigReaderTest do end test "read_and_resolve_hostname/1" do - env_name = "JF_CONF_READER_TEST_HOSTNAME" + env_name = "FJ_CONF_READER_TEST_HOSTNAME" with_env env_name do System.put_env(env_name, "127.0.0.1") @@ -67,7 +67,7 @@ defmodule Jellyfish.ConfigReaderTest do end test "read_port/1" do - env_name = "JF_CONF_READER_TEST_PORT" + env_name = "FJ_CONF_READER_TEST_PORT" with_env env_name do System.put_env(env_name, "20000") @@ -82,7 +82,7 @@ defmodule Jellyfish.ConfigReaderTest do end test "read_boolean/1" do - env_name = "JF_CONF_READER_TEST_BOOL" + env_name = "FJ_CONF_READER_TEST_BOOL" with_env env_name do System.put_env(env_name, "false") @@ -95,19 +95,19 @@ defmodule Jellyfish.ConfigReaderTest do end test "read_check_origin/1" do - env_name = "JF_CHECK_ORIGIN" + env_name = "FJ_CHECK_ORIGIN" with_env env_name do System.put_env(env_name, "false") assert ConfigReader.read_check_origin(env_name) == false System.put_env(env_name, "true") assert ConfigReader.read_check_origin(env_name) == true - System.put_env(env_name, "jellyfish.ovh jellyfish2.ovh jellyfish3.ovh") + System.put_env(env_name, "fishjam.ovh fishjam2.ovh fishjam3.ovh") assert ConfigReader.read_check_origin(env_name) == [ - "jellyfish.ovh", - "jellyfish2.ovh", - "jellyfish3.ovh" + "fishjam.ovh", + "fishjam2.ovh", + "fishjam3.ovh" ] # Case from phoenix documentation @@ -123,7 +123,7 @@ defmodule Jellyfish.ConfigReaderTest do end test "read_port_range/1" do - env_name = "JF_CONF_READER_TEST_PORT_RANGE" + env_name = "FJ_CONF_READER_TEST_PORT_RANGE" with_env env_name do System.put_env(env_name, "50000-60000") @@ -136,72 +136,72 @@ defmodule Jellyfish.ConfigReaderTest do end test "read_ssl_config/0" do - with_env ["JF_SSL_KEY_PATH", "JF_SSL_CERT_PATH"] do + with_env ["FJ_SSL_KEY_PATH", "FJ_SSL_CERT_PATH"] do assert ConfigReader.read_ssl_config() == nil - System.put_env("JF_SSL_KEY_PATH", "/some/key/path") + System.put_env("FJ_SSL_KEY_PATH", "/some/key/path") assert_raise RuntimeError, fn -> ConfigReader.read_ssl_config() end - System.delete_env("JF_SSL_KEY_PATH") + System.delete_env("FJ_SSL_KEY_PATH") - System.put_env("JF_SSL_CERT_PATH", "/some/cert/path") + System.put_env("FJ_SSL_CERT_PATH", "/some/cert/path") assert_raise RuntimeError, fn -> ConfigReader.read_ssl_config() end - System.put_env("JF_SSL_KEY_PATH", "/some/key/path") + System.put_env("FJ_SSL_KEY_PATH", "/some/key/path") assert ConfigReader.read_ssl_config() == {"/some/key/path", "/some/cert/path"} end end test "read_components_used/0" do - with_env ["JF_COMPONENTS_USED"] do + with_env ["FJ_COMPONENTS_USED"] do assert ConfigReader.read_components_used() == [] - System.put_env("JF_COMPONENTS_USED", "hls") - assert ConfigReader.read_components_used() == [Jellyfish.Component.HLS] + System.put_env("FJ_COMPONENTS_USED", "hls") + assert ConfigReader.read_components_used() == [Fishjam.Component.HLS] - System.put_env("JF_COMPONENTS_USED", "recording rtsp sip ") + System.put_env("FJ_COMPONENTS_USED", "recording rtsp sip ") assert ConfigReader.read_components_used() |> Enum.sort() == - [Jellyfish.Component.Recording, Jellyfish.Component.RTSP, Jellyfish.Component.SIP] + [Fishjam.Component.Recording, Fishjam.Component.RTSP, Fishjam.Component.SIP] |> Enum.sort() - System.put_env("JF_COMPONENTS_USED", "file rtsp invalid_component") + System.put_env("FJ_COMPONENTS_USED", "file rtsp invalid_component") assert_raise RuntimeError, fn -> ConfigReader.read_components_used() end end end test "read_sip_config/1" do - with_env ["JF_SIP_IP"] do + with_env ["FJ_SIP_IP"] do assert ConfigReader.read_sip_config(false) == [sip_external_ip: nil] assert_raise RuntimeError, fn -> ConfigReader.read_sip_config(true) end - System.put_env("JF_SIP_IP", "abcdefg") + System.put_env("FJ_SIP_IP", "abcdefg") assert_raise RuntimeError, fn -> ConfigReader.read_sip_config(true) end - System.put_env("JF_SIP_IP", "127.0.0.1") + System.put_env("FJ_SIP_IP", "127.0.0.1") assert ConfigReader.read_sip_config(true) == [sip_external_ip: "127.0.0.1"] end end test "read_s3_config/0" do with_env [ - "JF_S3_BUCKET", - "JF_S3_ACCESS_KEY_ID", - "JF_S3_SECRET_ACCESS_KEY", - "JF_S3_REGION", - "JF_S3_PATH_PREFIX" + "FJ_S3_BUCKET", + "FJ_S3_ACCESS_KEY_ID", + "FJ_S3_SECRET_ACCESS_KEY", + "FJ_S3_REGION", + "FJ_S3_PATH_PREFIX" ] do assert ConfigReader.read_s3_config() == [path_prefix: nil, credentials: nil] - System.put_env("JF_S3_PATH_PREFIX", "path_prefix") + System.put_env("FJ_S3_PATH_PREFIX", "path_prefix") assert ConfigReader.read_s3_config() == [path_prefix: "path_prefix", credentials: nil] - System.put_env("JF_S3_BUCKET", "bucket") + System.put_env("FJ_S3_BUCKET", "bucket") assert_raise RuntimeError, fn -> ConfigReader.read_s3_config() end - System.put_env("JF_S3_ACCESS_KEY_ID", "id") - System.put_env("JF_S3_SECRET_ACCESS_KEY", "key") - System.put_env("JF_S3_REGION", "region") + System.put_env("FJ_S3_ACCESS_KEY_ID", "id") + System.put_env("FJ_S3_SECRET_ACCESS_KEY", "key") + System.put_env("FJ_S3_REGION", "region") assert ConfigReader.read_s3_config() == [ path_prefix: "path_prefix", @@ -217,12 +217,12 @@ defmodule Jellyfish.ConfigReaderTest do test "read_dist_config/0 NODES_LIST" do with_env [ - "JF_DIST_ENABLED", - "JF_DIST_MODE", - "JF_DIST_COOKIE", - "JF_DIST_NODE_NAME", - "JF_DIST_NODES", - "JF_DIST_POLLING_INTERVAL" + "FJ_DIST_ENABLED", + "FJ_DIST_MODE", + "FJ_DIST_COOKIE", + "FJ_DIST_NODE_NAME", + "FJ_DIST_NODES", + "FJ_DIST_POLLING_INTERVAL" ] do {:ok, hostname} = :inet.gethostname() @@ -235,30 +235,30 @@ defmodule Jellyfish.ConfigReaderTest do strategy_config: nil ] - System.put_env("JF_DIST_ENABLED", "true") + System.put_env("FJ_DIST_ENABLED", "true") assert ConfigReader.read_dist_config() == [ enabled: true, mode: :shortnames, strategy: Cluster.Strategy.Epmd, - node_name: :"jellyfish@#{hostname}", - cookie: :jellyfish_cookie, + node_name: :"fishjam@#{hostname}", + cookie: :fishjam_cookie, strategy_config: [hosts: []] ] - System.put_env("JF_DIST_NODE_NAME", "testnodename@abc@def") + System.put_env("FJ_DIST_NODE_NAME", "testnodename@abc@def") assert_raise RuntimeError, fn -> ConfigReader.read_dist_config() end - System.put_env("JF_DIST_NODE_NAME", "testnodename") + System.put_env("FJ_DIST_NODE_NAME", "testnodename") assert_raise RuntimeError, fn -> ConfigReader.read_dist_config() end - System.delete_env("JF_DIST_NODE_NAME") + System.delete_env("FJ_DIST_NODE_NAME") assert ConfigReader.read_dist_config() - System.put_env("JF_DIST_MODE", "invalid") + System.put_env("FJ_DIST_MODE", "invalid") assert_raise RuntimeError, fn -> ConfigReader.read_dist_config() end - System.put_env("JF_DIST_MODE", "name") - System.put_env("JF_DIST_COOKIE", "testcookie") - System.put_env("JF_DIST_NODE_NAME", "testnodename@127.0.0.1") - System.put_env("JF_DIST_NODES", "testnodename1@127.0.0.1 testnodename2@127.0.0.1") + System.put_env("FJ_DIST_MODE", "name") + System.put_env("FJ_DIST_COOKIE", "testcookie") + System.put_env("FJ_DIST_NODE_NAME", "testnodename@127.0.0.1") + System.put_env("FJ_DIST_NODES", "testnodename1@127.0.0.1 testnodename2@127.0.0.1") assert ConfigReader.read_dist_config() == [ enabled: true, @@ -273,13 +273,13 @@ defmodule Jellyfish.ConfigReaderTest do test "read_dist_config/0 DNS" do with_env [ - "JF_DIST_ENABLED", - "JF_DIST_MODE", - "JF_DIST_COOKIE", - "JF_DIST_NODE_NAME", - "JF_DIST_NODES", - "JF_DIST_STRATEGY_NAME", - "JF_DIST_POLLING_INTERVAL" + "FJ_DIST_ENABLED", + "FJ_DIST_MODE", + "FJ_DIST_COOKIE", + "FJ_DIST_NODE_NAME", + "FJ_DIST_NODES", + "FJ_DIST_STRATEGY_NAME", + "FJ_DIST_POLLING_INTERVAL" ] do assert ConfigReader.read_dist_config() == [ enabled: false, @@ -290,27 +290,27 @@ defmodule Jellyfish.ConfigReaderTest do strategy_config: nil ] - System.put_env("JF_DIST_ENABLED", "true") - System.put_env("JF_DIST_MODE", "name") - System.put_env("JF_DIST_STRATEGY_NAME", "DNS") + System.put_env("FJ_DIST_ENABLED", "true") + System.put_env("FJ_DIST_MODE", "name") + System.put_env("FJ_DIST_STRATEGY_NAME", "DNS") assert_raise RuntimeError, fn -> ConfigReader.read_dist_config() end - System.put_env("JF_DIST_QUERY", "my-app.example.com") + System.put_env("FJ_DIST_QUERY", "my-app.example.com") assert [ enabled: true, mode: :longnames, strategy: Cluster.Strategy.DNSPoll, node_name: _node_name, - cookie: :jellyfish_cookie, + cookie: :fishjam_cookie, strategy_config: [ polling_interval: 5_000, query: "my-app.example.com", - node_basename: "jellyfish" + node_basename: "fishjam" ] ] = ConfigReader.read_dist_config() - System.put_env("JF_DIST_COOKIE", "testcookie") - System.put_env("JF_DIST_NODE_NAME", "testnodename@127.0.0.1") + System.put_env("FJ_DIST_COOKIE", "testcookie") + System.put_env("FJ_DIST_NODE_NAME", "testnodename@127.0.0.1") assert ConfigReader.read_dist_config() == [ enabled: true, @@ -326,12 +326,12 @@ defmodule Jellyfish.ConfigReaderTest do ] System.put_env( - "JF_DIST_POLLING_INTERVAL", + "FJ_DIST_POLLING_INTERVAL", "10000" ) # check if hostname is resolved correctly - System.put_env("JF_DIST_NODE_NAME", "testnodename@localhost") + System.put_env("FJ_DIST_NODE_NAME", "testnodename@localhost") assert ConfigReader.read_dist_config() == [ enabled: true, @@ -346,9 +346,9 @@ defmodule Jellyfish.ConfigReaderTest do ] ] - System.put_env("JF_DIST_POLLING_INTERVAL", "abcd") + System.put_env("FJ_DIST_POLLING_INTERVAL", "abcd") assert_raise RuntimeError, fn -> ConfigReader.read_dist_config() end - System.put_env("JF_DIST_POLLING_INTERVAL", "-25") + System.put_env("FJ_DIST_POLLING_INTERVAL", "-25") assert_raise RuntimeError, fn -> ConfigReader.read_dist_config() end end end diff --git a/test/jellyfish/resource_manager_test.exs b/test/jellyfish/resource_manager_test.exs index d5f760ab..c78a53f8 100644 --- a/test/jellyfish/resource_manager_test.exs +++ b/test/jellyfish/resource_manager_test.exs @@ -1,8 +1,8 @@ -defmodule Jellyfish.ResourceManagerTest do - use JellyfishWeb.ComponentCase, async: true +defmodule Fishjam.ResourceManagerTest do + use FishjamWeb.ComponentCase, async: true - alias Jellyfish.Component.Recording - alias Jellyfish.ResourceManager + alias Fishjam.Component.Recording + alias Fishjam.ResourceManager @hour 3_600 diff --git a/test/jellyfish_web/controllers/component/file_component_test.exs b/test/jellyfish_web/controllers/component/file_component_test.exs index 6055a8e2..2639c72f 100644 --- a/test/jellyfish_web/controllers/component/file_component_test.exs +++ b/test/jellyfish_web/controllers/component/file_component_test.exs @@ -1,10 +1,10 @@ -defmodule JellyfishWeb.Component.FileComponentTest do - use JellyfishWeb.ConnCase - use JellyfishWeb.ComponentCase +defmodule FishjamWeb.Component.FileComponentTest do + use FishjamWeb.ConnCase + use FishjamWeb.ComponentCase - alias JellyfishWeb.WS + alias FishjamWeb.WS - alias Jellyfish.ServerMessage.{ + alias Fishjam.ServerMessage.{ Authenticated, Track, TrackAdded, @@ -21,10 +21,10 @@ defmodule JellyfishWeb.Component.FileComponentTest do @auth_response %Authenticated{} setup_all _tags do - Application.put_env(:jellyfish, :components_used, [Jellyfish.Component.File]) + Application.put_env(:fishjam, :components_used, [Fishjam.Component.File]) media_sources_directory = - Application.fetch_env!(:jellyfish, :media_files_path) + Application.fetch_env!(:fishjam, :media_files_path) |> Path.join(@file_component_directory) |> Path.expand() @@ -34,7 +34,7 @@ defmodule JellyfishWeb.Component.FileComponentTest do on_exit(fn -> :file.del_dir_r(media_sources_directory) - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :components_used, []) end) {:ok, %{media_sources_directory: media_sources_directory}} @@ -307,7 +307,7 @@ defmodule JellyfishWeb.Component.FileComponentTest do end defp start_notifier() do - token = Application.fetch_env!(:jellyfish, :server_api_token) + token = Application.fetch_env!(:fishjam, :server_api_token) {:ok, ws} = WS.start_link(@ws_url, :server) WS.send_auth_request(ws, token) diff --git a/test/jellyfish_web/controllers/component/hls_component_test.exs b/test/jellyfish_web/controllers/component/hls_component_test.exs index aafe0f21..58bd3628 100644 --- a/test/jellyfish_web/controllers/component/hls_component_test.exs +++ b/test/jellyfish_web/controllers/component/hls_component_test.exs @@ -1,12 +1,12 @@ -defmodule JellyfishWeb.Component.HlsComponentTest do - use JellyfishWeb.ConnCase - use JellyfishWeb.ComponentCase +defmodule FishjamWeb.Component.HlsComponentTest do + use FishjamWeb.ConnCase + use FishjamWeb.ComponentCase import Mox - alias Jellyfish.RoomService + alias Fishjam.RoomService - alias Jellyfish.Component.HLS + alias Fishjam.Component.HLS @files ["manifest.m3u8", "header.mp4", "segment_1.m3u8", "segment_2.m3u8"] @body <<1, 2, 3, 4>> @@ -22,10 +22,10 @@ defmodule JellyfishWeb.Component.HlsComponentTest do |> map_keys_to_string() setup_all do - Application.put_env(:jellyfish, :components_used, [HLS]) + Application.put_env(:fishjam, :components_used, [HLS]) on_exit(fn -> - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :components_used, []) end) end @@ -154,7 +154,7 @@ defmodule JellyfishWeb.Component.HlsComponentTest do end test "renders component with ll-hls enabled", %{conn: conn, room_id: room_id} do - assert Registry.lookup(Jellyfish.RequestHandlerRegistry, room_id) |> Enum.empty?() + assert Registry.lookup(Fishjam.RequestHandlerRegistry, room_id) |> Enum.empty?() conn = post(conn, ~p"/room/#{room_id}/component", type: "hls", options: %{lowLatency: true}) @@ -165,7 +165,7 @@ defmodule JellyfishWeb.Component.HlsComponentTest do assert_component_created(conn, room_id, id, "hls") - [{request_handler, _value}] = Registry.lookup(Jellyfish.RequestHandlerRegistry, room_id) + [{request_handler, _value}] = Registry.lookup(Fishjam.RequestHandlerRegistry, room_id) assert Process.alive?(request_handler) Process.monitor(request_handler) @@ -183,7 +183,7 @@ defmodule JellyfishWeb.Component.HlsComponentTest do assert_receive {:DOWN, _ref, :process, ^engine_pid, :normal}, 10_000 assert_receive {:DOWN, _ref, :process, ^request_handler, :normal} - assert Registry.lookup(Jellyfish.RequestHandlerRegistry, room_id) |> Enum.empty?() + assert Registry.lookup(Fishjam.RequestHandlerRegistry, room_id) |> Enum.empty?() end test "renders errors when video codec is different than h264 - vp8", %{conn: conn} do diff --git a/test/jellyfish_web/controllers/component/recording_component_test.exs b/test/jellyfish_web/controllers/component/recording_component_test.exs index 1dfaa3b0..590229ff 100644 --- a/test/jellyfish_web/controllers/component/recording_component_test.exs +++ b/test/jellyfish_web/controllers/component/recording_component_test.exs @@ -1,10 +1,10 @@ -defmodule JellyfishWeb.Component.RecordingComponentTest do - use JellyfishWeb.ConnCase - use JellyfishWeb.ComponentCase +defmodule FishjamWeb.Component.RecordingComponentTest do + use FishjamWeb.ConnCase + use FishjamWeb.ComponentCase import Mox - alias Jellyfish.RoomService + alias Fishjam.RoomService @s3_credentials %{ accessKeyId: "access_key_id", @@ -16,10 +16,10 @@ defmodule JellyfishWeb.Component.RecordingComponentTest do @path_prefix "path_prefix" setup_all do - Application.put_env(:jellyfish, :components_used, [Jellyfish.Component.Recording]) + Application.put_env(:fishjam, :components_used, [Fishjam.Component.Recording]) on_exit(fn -> - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :components_used, []) end) end @@ -265,14 +265,14 @@ defmodule JellyfishWeb.Component.RecordingComponentTest do end defp put_s3_envs(path_prefix: path_prefix, credentials: credentials) do - Application.put_env(:jellyfish, :s3_config, + Application.put_env(:fishjam, :s3_config, path_prefix: path_prefix, credentials: credentials ) end defp clean_s3_envs() do - Application.put_env(:jellyfish, :s3_config, path_prefix: nil, credentials: nil) + Application.put_env(:fishjam, :s3_config, path_prefix: nil, credentials: nil) end defp get_recording_path_prefix(room_id, component_id) do diff --git a/test/jellyfish_web/controllers/component/rtsp_component_test.exs b/test/jellyfish_web/controllers/component/rtsp_component_test.exs index 9372db6b..24dc5e79 100644 --- a/test/jellyfish_web/controllers/component/rtsp_component_test.exs +++ b/test/jellyfish_web/controllers/component/rtsp_component_test.exs @@ -1,6 +1,6 @@ -defmodule JellyfishWeb.Component.RTSPComponentTest do - use JellyfishWeb.ConnCase - use JellyfishWeb.ComponentCase +defmodule FishjamWeb.Component.RTSPComponentTest do + use FishjamWeb.ConnCase + use FishjamWeb.ComponentCase @source_uri "rtsp://placeholder-19inrifjbsjb.it:12345/afwefae" @@ -23,10 +23,10 @@ defmodule JellyfishWeb.Component.RTSPComponentTest do @rtsp_custom_properties @rtsp_custom_options |> map_keys_to_string() setup_all do - Application.put_env(:jellyfish, :components_used, [Jellyfish.Component.RTSP]) + Application.put_env(:fishjam, :components_used, [Fishjam.Component.RTSP]) on_exit(fn -> - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :components_used, []) end) end diff --git a/test/jellyfish_web/controllers/component/sip_component_test.exs b/test/jellyfish_web/controllers/component/sip_component_test.exs index 9a3a4826..43ba4e68 100644 --- a/test/jellyfish_web/controllers/component/sip_component_test.exs +++ b/test/jellyfish_web/controllers/component/sip_component_test.exs @@ -1,6 +1,6 @@ -defmodule JellyfishWeb.Component.SIPComponentTest do - use JellyfishWeb.ConnCase - use JellyfishWeb.ComponentCase +defmodule FishjamWeb.Component.SIPComponentTest do + use FishjamWeb.ConnCase + use FishjamWeb.ComponentCase @sip_credentials %{ address: "my-sip-registrar.net", @@ -14,12 +14,12 @@ defmodule JellyfishWeb.Component.SIPComponentTest do |> map_keys_to_string() setup_all do - Application.put_env(:jellyfish, :sip_config, sip_external_ip: "127.0.0.1") - Application.put_env(:jellyfish, :components_used, [Jellyfish.Component.SIP]) + Application.put_env(:fishjam, :sip_config, sip_external_ip: "127.0.0.1") + Application.put_env(:fishjam, :components_used, [Fishjam.Component.SIP]) on_exit(fn -> - Application.put_env(:jellyfish, :sip_config, sip_external_ip: nil) - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :sip_config, sip_external_ip: nil) + Application.put_env(:fishjam, :components_used, []) end) end diff --git a/test/jellyfish_web/controllers/component_controller_test.exs b/test/jellyfish_web/controllers/component_controller_test.exs index cb73719a..5f1a3bc2 100644 --- a/test/jellyfish_web/controllers/component_controller_test.exs +++ b/test/jellyfish_web/controllers/component_controller_test.exs @@ -1,17 +1,17 @@ -defmodule JellyfishWeb.ComponentControllerTest do - use JellyfishWeb.ConnCase - use JellyfishWeb.ComponentCase +defmodule FishjamWeb.ComponentControllerTest do + use FishjamWeb.ConnCase + use FishjamWeb.ComponentCase @source_uri "rtsp://placeholder-19inrifjbsjb.it:12345/afwefae" setup_all do - Application.put_env(:jellyfish, :components_used, [ - Jellyfish.Component.RTSP, - Jellyfish.Component.HLS + Application.put_env(:fishjam, :components_used, [ + Fishjam.Component.RTSP, + Fishjam.Component.HLS ]) on_exit(fn -> - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :components_used, []) end) end @@ -32,19 +32,19 @@ defmodule JellyfishWeb.ComponentControllerTest do end test "renders errors when component isn't allowed globally", %{conn: conn, room_id: room_id} do - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :components_used, []) on_exit(fn -> - Application.put_env(:jellyfish, :components_used, [ - Jellyfish.Component.RTSP, - Jellyfish.Component.HLS + Application.put_env(:fishjam, :components_used, [ + Fishjam.Component.RTSP, + Fishjam.Component.HLS ]) end) conn = post(conn, ~p"/room/#{room_id}/component", type: "hls") response = model_response(conn, :bad_request, "Error") - assert response["errors"] == "Components of type hls are disabled on this Jellyfish" + assert response["errors"] == "Components of type hls are disabled on this Fishjam" end end diff --git a/test/jellyfish_web/controllers/dial_controller_test.exs b/test/jellyfish_web/controllers/dial_controller_test.exs index 17c4c09f..03c3f62f 100644 --- a/test/jellyfish_web/controllers/dial_controller_test.exs +++ b/test/jellyfish_web/controllers/dial_controller_test.exs @@ -1,5 +1,5 @@ -defmodule JellyfishWeb.DialControllerTest do - use JellyfishWeb.ConnCase +defmodule FishjamWeb.DialControllerTest do + use FishjamWeb.ConnCase @source_uri "rtsp://placeholder-19inrifjbsjb.it:12345/afwefae" @@ -10,21 +10,21 @@ defmodule JellyfishWeb.DialControllerTest do } setup_all do - Application.put_env(:jellyfish, :sip_config, sip_external_ip: "127.0.0.1") + Application.put_env(:fishjam, :sip_config, sip_external_ip: "127.0.0.1") - Application.put_env(:jellyfish, :components_used, [ - Jellyfish.Component.SIP, - Jellyfish.Component.RTSP + Application.put_env(:fishjam, :components_used, [ + Fishjam.Component.SIP, + Fishjam.Component.RTSP ]) on_exit(fn -> - Application.put_env(:jellyfish, :sip_config, sip_external_ip: nil) - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :sip_config, sip_external_ip: nil) + Application.put_env(:fishjam, :components_used, []) end) end setup %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> server_api_token) conn = put_req_header(conn, "accept", "application/json") diff --git a/test/jellyfish_web/controllers/error_json_test.exs b/test/jellyfish_web/controllers/error_json_test.exs index e25f28e6..ae9640a6 100644 --- a/test/jellyfish_web/controllers/error_json_test.exs +++ b/test/jellyfish_web/controllers/error_json_test.exs @@ -1,12 +1,12 @@ -defmodule JellyfishWeb.ErrorJSONTest do - use JellyfishWeb.ConnCase, async: true +defmodule FishjamWeb.ErrorJSONTest do + use FishjamWeb.ConnCase, async: true test "renders 404" do - assert JellyfishWeb.ErrorJSON.render("404.json", %{}) == %{errors: %{detail: "Not Found"}} + assert FishjamWeb.ErrorJSON.render("404.json", %{}) == %{errors: %{detail: "Not Found"}} end test "renders 500" do - assert JellyfishWeb.ErrorJSON.render("500.json", %{}) == + assert FishjamWeb.ErrorJSON.render("500.json", %{}) == %{errors: %{detail: "Internal Server Error"}} end end diff --git a/test/jellyfish_web/controllers/healthcheck_controller_test.exs b/test/jellyfish_web/controllers/healthcheck_controller_test.exs index 8ab06b8f..46dae84a 100644 --- a/test/jellyfish_web/controllers/healthcheck_controller_test.exs +++ b/test/jellyfish_web/controllers/healthcheck_controller_test.exs @@ -1,14 +1,14 @@ -defmodule JellyfishWeb.HealthcheckControllerTest do - use JellyfishWeb.ConnCase, async: true +defmodule FishjamWeb.HealthcheckControllerTest do + use FishjamWeb.ConnCase, async: true import OpenApiSpex.TestAssertions - @schema JellyfishWeb.ApiSpec.spec() + @schema FishjamWeb.ApiSpec.spec() @commit_hash_length 7 setup %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> server_api_token) [conn: conn] @@ -19,7 +19,7 @@ defmodule JellyfishWeb.HealthcheckControllerTest do response = json_response(conn, :ok) assert_response_schema(response, "HealthcheckResponse", @schema) - version = Jellyfish.version() + version = Fishjam.version() assert %{ "status" => "UP", diff --git a/test/jellyfish_web/controllers/hls_controller_test.exs b/test/jellyfish_web/controllers/hls_controller_test.exs index 7a0a820b..bab35ecd 100644 --- a/test/jellyfish_web/controllers/hls_controller_test.exs +++ b/test/jellyfish_web/controllers/hls_controller_test.exs @@ -1,10 +1,10 @@ -defmodule JellyfishWeb.HLSControllerTest do - use JellyfishWeb.ConnCase, async: true +defmodule FishjamWeb.HLSControllerTest do + use FishjamWeb.ConnCase, async: true import OpenApiSpex.TestAssertions - alias Jellyfish.Component.HLS - alias Jellyfish.Component.HLS.{EtsHelper, RequestHandler} + alias Fishjam.Component.HLS + alias Fishjam.Component.HLS.{EtsHelper, RequestHandler} @room_id "hls_controller_test" @wrong_room_id "wrong_id" @@ -28,7 +28,7 @@ defmodule JellyfishWeb.HLSControllerTest do @outside_manifest "../outside_manifest.m3u8" - @schema JellyfishWeb.ApiSpec.spec() + @schema FishjamWeb.ApiSpec.spec() setup_all do output_path = HLS.output_dir(@room_id, persistent: false) diff --git a/test/jellyfish_web/controllers/peer_controller_test.exs b/test/jellyfish_web/controllers/peer_controller_test.exs index 646397c5..9ef1878c 100644 --- a/test/jellyfish_web/controllers/peer_controller_test.exs +++ b/test/jellyfish_web/controllers/peer_controller_test.exs @@ -1,13 +1,13 @@ -defmodule JellyfishWeb.PeerControllerTest do - use JellyfishWeb.ConnCase +defmodule FishjamWeb.PeerControllerTest do + use FishjamWeb.ConnCase import OpenApiSpex.TestAssertions - @schema JellyfishWeb.ApiSpec.spec() + @schema FishjamWeb.ApiSpec.spec() @peer_type "webrtc" setup %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = conn @@ -22,7 +22,7 @@ defmodule JellyfishWeb.PeerControllerTest do assert response(conn, :no_content) end) - peer_ws_url = Jellyfish.peer_websocket_address() + peer_ws_url = Fishjam.peer_websocket_address() {:ok, %{conn: conn, room_id: id, peer_ws_url: peer_ws_url}} end @@ -58,8 +58,8 @@ defmodule JellyfishWeb.PeerControllerTest do assert {:ok, %{peer_id: ^peer_id, room_id: ^room_id}} = Phoenix.Token.verify( - JellyfishWeb.Endpoint, - Application.fetch_env!(:jellyfish, JellyfishWeb.Endpoint)[:secret_key_base], + FishjamWeb.Endpoint, + Application.fetch_env!(:fishjam, FishjamWeb.Endpoint)[:secret_key_base], token ) end @@ -91,16 +91,16 @@ defmodule JellyfishWeb.PeerControllerTest do end test "renders errors when peer isn't allowed globally", %{conn: conn, room_id: room_id} do - Application.put_env(:jellyfish, :webrtc_config, webrtc_used?: false) + Application.put_env(:fishjam, :webrtc_config, webrtc_used?: false) on_exit(fn -> - Application.put_env(:jellyfish, :webrtc_config, webrtc_used?: true) + Application.put_env(:fishjam, :webrtc_config, webrtc_used?: true) end) conn = post(conn, ~p"/room/#{room_id}/peer", type: @peer_type) assert json_response(conn, :bad_request)["errors"] == - "Peers of type webrtc are disabled on this Jellyfish" + "Peers of type webrtc are disabled on this Fishjam" end end diff --git a/test/jellyfish_web/controllers/recording_controller_test.exs b/test/jellyfish_web/controllers/recording_controller_test.exs index 835779c1..a76f8b85 100644 --- a/test/jellyfish_web/controllers/recording_controller_test.exs +++ b/test/jellyfish_web/controllers/recording_controller_test.exs @@ -1,12 +1,12 @@ -defmodule JellyfishWeb.RecordingControllerTest do - use JellyfishWeb.ConnCase, async: true +defmodule FishjamWeb.RecordingControllerTest do + use FishjamWeb.ConnCase, async: true import OpenApiSpex.TestAssertions - doctest Jellyfish.Utils.PathValidation + doctest Fishjam.Utils.PathValidation - alias Jellyfish.Component.HLS - alias Jellyfish.Component.HLS.{EtsHelper, Recording} + alias Fishjam.Component.HLS + alias Fishjam.Component.HLS.{EtsHelper, Recording} @recording_id "recording_id" @live_stream_id "live_stream_id" @@ -21,7 +21,7 @@ defmodule JellyfishWeb.RecordingControllerTest do @wrong_manifest_name "wrong_manifest_name.m3u8" @manifest_content <<3>> - @schema JellyfishWeb.ApiSpec.spec() + @schema FishjamWeb.ApiSpec.spec() setup_all do recording_path = Recording.directory(@recording_id) @@ -127,7 +127,7 @@ defmodule JellyfishWeb.RecordingControllerTest do end defp inject_auth_headers(conn) do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn |> put_req_header("authorization", "Bearer " <> server_api_token) diff --git a/test/jellyfish_web/controllers/room_controller_test.exs b/test/jellyfish_web/controllers/room_controller_test.exs index 55bc2503..99132e3f 100644 --- a/test/jellyfish_web/controllers/room_controller_test.exs +++ b/test/jellyfish_web/controllers/room_controller_test.exs @@ -1,15 +1,15 @@ -defmodule JellyfishWeb.RoomControllerTest do - use JellyfishWeb.ConnCase, async: false +defmodule FishjamWeb.RoomControllerTest do + use FishjamWeb.ConnCase, async: false import OpenApiSpex.TestAssertions alias __MODULE__.Endpoint - alias Jellyfish.PeerMessage.Authenticated - alias Jellyfish.RoomService - alias JellyfishWeb.{PeerSocket, WS} + alias Fishjam.PeerMessage.Authenticated + alias Fishjam.RoomService + alias FishjamWeb.{PeerSocket, WS} - @schema JellyfishWeb.ApiSpec.spec() + @schema FishjamWeb.ApiSpec.spec() @purge_timeout_s 3 @purge_timeout_ms @purge_timeout_s * 1000 @@ -19,7 +19,7 @@ defmodule JellyfishWeb.RoomControllerTest do @auth_response %Authenticated{} Application.put_env( - :jellyfish, + :fishjam, Endpoint, https: false, http: [port: @port], @@ -27,9 +27,9 @@ defmodule JellyfishWeb.RoomControllerTest do ) defmodule Endpoint do - use Phoenix.Endpoint, otp_app: :jellyfish + use Phoenix.Endpoint, otp_app: :fishjam - alias JellyfishWeb.PeerSocket + alias FishjamWeb.PeerSocket socket "/socket/peer", PeerSocket, websocket: true, @@ -43,7 +43,7 @@ defmodule JellyfishWeb.RoomControllerTest do end setup %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> server_api_token) Klotho.Mock.reset() @@ -62,7 +62,7 @@ defmodule JellyfishWeb.RoomControllerTest do test "invalid token", %{conn: conn} do invalid_server_api_token = - "invalid" <> Application.fetch_env!(:jellyfish, :server_api_token) + "invalid" <> Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> invalid_server_api_token) @@ -82,7 +82,7 @@ defmodule JellyfishWeb.RoomControllerTest do end test "correct token", %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> server_api_token) conn = post(conn, ~p"/room", maxPeers: 10) @@ -506,7 +506,7 @@ defmodule JellyfishWeb.RoomControllerTest do end defp delete_all_rooms() do - token = Application.fetch_env!(:jellyfish, :server_api_token) + token = Application.fetch_env!(:fishjam, :server_api_token) headers = [Authorization: "Bearer #{token}", Accept: "Application/json; Charset=utf-8"] assert {:ok, %HTTPoison.Response{status_code: 200, body: body}} = diff --git a/test/jellyfish_web/controllers/subscription_controller_test.exs b/test/jellyfish_web/controllers/subscription_controller_test.exs index 6fe03d3d..799263ef 100644 --- a/test/jellyfish_web/controllers/subscription_controller_test.exs +++ b/test/jellyfish_web/controllers/subscription_controller_test.exs @@ -1,5 +1,5 @@ -defmodule JellyfishWeb.SubscriptionControllerTest do - use JellyfishWeb.ConnCase +defmodule FishjamWeb.SubscriptionControllerTest do + use FishjamWeb.ConnCase @s3_credentials %{ accessKeyId: "access_key_id", @@ -15,22 +15,22 @@ defmodule JellyfishWeb.SubscriptionControllerTest do } setup_all do - Application.put_env(:jellyfish, :sip_config, sip_external_ip: "127.0.0.1") + Application.put_env(:fishjam, :sip_config, sip_external_ip: "127.0.0.1") - Application.put_env(:jellyfish, :components_used, [ - Jellyfish.Component.SIP, - Jellyfish.Component.HLS, - Jellyfish.Component.Recording + Application.put_env(:fishjam, :components_used, [ + Fishjam.Component.SIP, + Fishjam.Component.HLS, + Fishjam.Component.Recording ]) on_exit(fn -> - Application.put_env(:jellyfish, :sip_config, sip_external_ip: nil) - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :sip_config, sip_external_ip: nil) + Application.put_env(:fishjam, :components_used, []) end) end setup %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> server_api_token) conn = put_req_header(conn, "accept", "application/json") diff --git a/test/jellyfish_web/integration/peer_socket_test.exs b/test/jellyfish_web/integration/peer_socket_test.exs index 4fe2038d..684c1546 100644 --- a/test/jellyfish_web/integration/peer_socket_test.exs +++ b/test/jellyfish_web/integration/peer_socket_test.exs @@ -1,18 +1,18 @@ -defmodule JellyfishWeb.Integration.PeerSocketTest do - use JellyfishWeb.ConnCase +defmodule FishjamWeb.Integration.PeerSocketTest do + use FishjamWeb.ConnCase alias __MODULE__.Endpoint - alias Jellyfish.PeerMessage - alias Jellyfish.PeerMessage.{Authenticated, MediaEvent} - alias Jellyfish.RoomService - alias JellyfishWeb.{PeerSocket, WS} + alias Fishjam.PeerMessage + alias Fishjam.PeerMessage.{Authenticated, MediaEvent} + alias Fishjam.RoomService + alias FishjamWeb.{PeerSocket, WS} @port 5908 @path "ws://127.0.0.1:#{@port}/socket/peer/websocket" @auth_response %Authenticated{} Application.put_env( - :jellyfish, + :fishjam, Endpoint, https: false, http: [port: @port], @@ -20,9 +20,9 @@ defmodule JellyfishWeb.Integration.PeerSocketTest do ) defmodule Endpoint do - use Phoenix.Endpoint, otp_app: :jellyfish + use Phoenix.Endpoint, otp_app: :fishjam - alias JellyfishWeb.PeerSocket + alias FishjamWeb.PeerSocket socket "/socket/peer", PeerSocket, websocket: true, @@ -35,7 +35,7 @@ defmodule JellyfishWeb.Integration.PeerSocketTest do end setup %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> server_api_token) conn = post(conn, ~p"/room", maxPeers: 1) @@ -74,7 +74,7 @@ defmodule JellyfishWeb.Integration.PeerSocketTest do test "valid token but peer doesn't exist", %{room_id: room_id} do {:ok, ws} = WS.start_link(@path, :peer) - unadded_peer_token = JellyfishWeb.PeerToken.generate(%{peer_id: "peer_id", room_id: room_id}) + unadded_peer_token = FishjamWeb.PeerToken.generate(%{peer_id: "peer_id", room_id: room_id}) WS.send_auth_request(ws, unadded_peer_token) assert_receive {:disconnected, {:remote, 1000, "peer not found"}}, 1000 @@ -169,13 +169,13 @@ defmodule JellyfishWeb.Integration.PeerSocketTest do assert %{} = get_peers_room_metrics() create_and_authenticate(token) - peers_in_room_key = "jellyfish_room_peers{room_id=\"#{room_id}\"}" - peers_in_room_time_key = "jellyfish_room_peer_time_total_seconds{room_id=\"#{room_id}\"}" + peers_in_room_key = "fishjam_room_peers{room_id=\"#{room_id}\"}" + peers_in_room_time_key = "fishjam_room_peer_time_total_seconds{room_id=\"#{room_id}\"}" metrics_after_one_tick = %{ peers_in_room_key => "1", peers_in_room_time_key => "1", - "jellyfish_rooms" => "1" + "fishjam_rooms" => "1" } Process.sleep(1_000) @@ -194,7 +194,7 @@ defmodule JellyfishWeb.Integration.PeerSocketTest do metrics_after_removal = %{ peers_in_room_key => "0", peers_in_room_time_key => "1", - "jellyfish_rooms" => "0" + "fishjam_rooms" => "0" } metrics_to_compare = get_peers_room_metrics() @@ -227,7 +227,7 @@ defmodule JellyfishWeb.Integration.PeerSocketTest do end end) |> Enum.filter(fn {key, _value} -> - String.starts_with?(key, "jellyfish_room") + String.starts_with?(key, "fishjam_room") end) |> Map.new() end diff --git a/test/jellyfish_web/integration/server_notification_test.exs b/test/jellyfish_web/integration/server_notification_test.exs index efdae952..6308b5e5 100644 --- a/test/jellyfish_web/integration/server_notification_test.exs +++ b/test/jellyfish_web/integration/server_notification_test.exs @@ -1,20 +1,20 @@ -defmodule JellyfishWeb.Integration.ServerNotificationTest do - use JellyfishWeb.ConnCase +defmodule FishjamWeb.Integration.ServerNotificationTest do + use FishjamWeb.ConnCase import Mox - import JellyfishWeb.WS, only: [subscribe: 2] + import FishjamWeb.WS, only: [subscribe: 2] alias __MODULE__.Endpoint alias Membrane.RTC.Engine - alias Jellyfish.Component - alias Jellyfish.Component.HLS - alias Jellyfish.Component.HLS.Manager - alias Jellyfish.{PeerMessage, Room, RoomService, ServerMessage} + alias Fishjam.Component + alias Fishjam.Component.HLS + alias Fishjam.Component.HLS.Manager + alias Fishjam.{PeerMessage, Room, RoomService, ServerMessage} - alias Jellyfish.ServerMessage.{ + alias Fishjam.ServerMessage.{ Authenticated, ComponentCrashed, HlsPlayable, @@ -34,7 +34,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do TrackRemoved } - alias JellyfishWeb.{PeerSocket, ServerSocket, WS} + alias FishjamWeb.{PeerSocket, ServerSocket, WS} alias Phoenix.PubSub @port 5907 @@ -42,7 +42,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do @webhook_url "http://127.0.0.1:#{@webhook_port}/" @path "ws://127.0.0.1:#{@port}/socket/server/websocket" @auth_response %Authenticated{} - @pubsub Jellyfish.PubSub + @pubsub Fishjam.PubSub @file_component_directory "file_component_sources" @fixtures_directory "test/fixtures" @@ -70,7 +70,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do @purge_timeout_ms @purge_timeout_s * 1000 Application.put_env( - :jellyfish, + :fishjam, Endpoint, https: false, http: [port: @port], @@ -78,9 +78,9 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do ) defmodule Endpoint do - use Phoenix.Endpoint, otp_app: :jellyfish + use Phoenix.Endpoint, otp_app: :fishjam - alias JellyfishWeb.ServerSocket + alias FishjamWeb.ServerSocket socket("/socket/server", ServerSocket, websocket: true, @@ -94,9 +94,9 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do end setup_all do - Application.put_env(:jellyfish, :sip_config, sip_external_ip: "127.0.0.1") + Application.put_env(:fishjam, :sip_config, sip_external_ip: "127.0.0.1") - Application.put_env(:jellyfish, :components_used, [ + Application.put_env(:fishjam, :components_used, [ Component.SIP, Component.HLS, Component.RTSP, @@ -104,8 +104,8 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do ]) on_exit(fn -> - Application.put_env(:jellyfish, :sip_config, sip_external_ip: nil) - Application.put_env(:jellyfish, :components_used, []) + Application.put_env(:fishjam, :sip_config, sip_external_ip: nil) + Application.put_env(:fishjam, :components_used, []) end) assert {:ok, _pid} = Endpoint.start_link() @@ -120,7 +120,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do setup(%{conn: conn}) do :ok = PubSub.subscribe(@pubsub, "webhook") - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> server_api_token) Klotho.Mock.reset() @@ -145,7 +145,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do describe "establishing connection" do test "invalid token" do {:ok, ws} = WS.start_link(@path, :server) - server_api_token = "invalid" <> Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = "invalid" <> Application.fetch_env!(:fishjam, :server_api_token) WS.send_auth_request(ws, server_api_token) assert_receive {:disconnected, {:remote, 1000, "invalid token"}}, 1000 @@ -190,7 +190,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do end test "sends a message when room gets created and deleted", %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) ws = create_and_authenticate() subscribe(ws, :server_notification) @@ -211,7 +211,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do end test "sends a message when room gets created and deleted by peerless purge", %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) ws = create_and_authenticate() subscribe(ws, :server_notification) @@ -287,7 +287,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do test "sends a message when peer connects and room crashes", %{conn: conn} do {room_id, peer_id, _conn, _ws} = subscribe_on_notifications_and_connect_peer(conn) - {:ok, room_pid} = Jellyfish.RoomService.find_room(room_id) + {:ok, room_pid} = Fishjam.RoomService.find_room(room_id) Process.exit(room_pid, :kill) @@ -305,7 +305,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do test "sends a message when peer connects and it crashes", %{conn: conn} do {room_id, peer_id, conn, _ws} = subscribe_on_notifications_and_connect_peer(conn) - {:ok, room_pid} = Jellyfish.RoomService.find_room(room_id) + {:ok, room_pid} = Fishjam.RoomService.find_room(room_id) state = :sys.get_state(room_pid) @@ -328,7 +328,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do test "sends message when peer metadata is updated", %{conn: conn} do {room_id, peer_id, _conn, peer_ws} = subscribe_on_notifications_and_connect_peer(conn) - metadata = %{name: "Jellyuser"} + metadata = %{name: "FishjamUser"} metadata_encoded = Jason.encode!(metadata) media_event = %PeerMessage.MediaEvent{ @@ -357,7 +357,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do {:ok, config} = Room.Config.from_params(%{"webhookUrl" => @webhook_url}) {:ok, room_pid, room_id} = Room.start(config) - Jellyfish.WebhookNotifier.add_webhook(room_id, config.webhook_url) + Fishjam.WebhookNotifier.add_webhook(room_id, config.webhook_url) {peer_id, token, _conn} = add_peer(conn, room_id) {:ok, peer_ws} = WS.start("ws://127.0.0.1:#{@port}/socket/peer/websocket", :peer) @@ -418,7 +418,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do end test "sends a message when peer gets created and deleted by disconnected purge", %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) ws = create_and_authenticate() subscribe(ws, :server_notification) @@ -469,7 +469,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do test "sends message when File adds or removes tracks", %{conn: conn} do media_sources_directory = - Application.fetch_env!(:jellyfish, :media_files_path) + Application.fetch_env!(:fishjam, :media_files_path) |> Path.join(@file_component_directory) |> Path.expand() @@ -607,7 +607,7 @@ defmodule JellyfishWeb.Integration.ServerNotificationTest do end def create_and_authenticate() do - token = Application.fetch_env!(:jellyfish, :server_api_token) + token = Application.fetch_env!(:fishjam, :server_api_token) {:ok, ws} = WS.start_link(@path, :server) WS.send_auth_request(ws, token) diff --git a/test/support/component_case.ex b/test/support/component_case.ex index bbf72e6f..66dbfa04 100644 --- a/test/support/component_case.ex +++ b/test/support/component_case.ex @@ -1,22 +1,22 @@ -defmodule JellyfishWeb.ComponentCase do +defmodule FishjamWeb.ComponentCase do @moduledoc """ This module defines the test case to be used by - Jellyfish Component tests. + Fishjam Component tests. """ use ExUnit.CaseTemplate - use JellyfishWeb.ConnCase + use FishjamWeb.ConnCase - alias Jellyfish.RoomService + alias Fishjam.RoomService using do quote do - import JellyfishWeb.ComponentCase + import FishjamWeb.ComponentCase end end setup %{conn: conn} do - server_api_token = Application.fetch_env!(:jellyfish, :server_api_token) + server_api_token = Application.fetch_env!(:fishjam, :server_api_token) conn = put_req_header(conn, "authorization", "Bearer " <> server_api_token) conn = put_req_header(conn, "accept", "application/json") @@ -44,8 +44,8 @@ defmodule JellyfishWeb.ComponentCase do @spec assert_component_created( Plug.Conn.t(), - Jellyfish.Room.id(), - Jellyfish.Component.id(), + Fishjam.Room.id(), + Fishjam.Component.id(), String.t() ) :: map() def assert_component_created(conn, room_id, component_id, component_type) do @@ -70,7 +70,7 @@ defmodule JellyfishWeb.ComponentCase do OpenApiSpex.TestAssertions.assert_response_schema( response, model, - JellyfishWeb.ApiSpec.spec() + FishjamWeb.ApiSpec.spec() ) end diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index cf524cf7..85b270c7 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -1,4 +1,4 @@ -defmodule JellyfishWeb.ConnCase do +defmodule FishjamWeb.ConnCase do @moduledoc """ This module defines the test case to be used by tests that require setting up a connection. @@ -11,7 +11,7 @@ defmodule JellyfishWeb.ConnCase do we enable the SQL sandbox, so changes done to the database are reverted at the end of every test. If you are using PostgreSQL, you can even run database tests asynchronously - by setting `use JellyfishWeb.ConnCase, async: true`, although + by setting `use FishjamWeb.ConnCase, async: true`, although this option is not recommended for other databases. """ @@ -19,17 +19,17 @@ defmodule JellyfishWeb.ConnCase do using do quote do - use JellyfishWeb, :verified_routes + use FishjamWeb, :verified_routes # Import conveniences for testing with connections import Plug.Conn import Phoenix.ConnTest - import JellyfishWeb.ConnCase + import FishjamWeb.ConnCase - alias JellyfishWeb.Router.Helpers, as: Routes + alias FishjamWeb.Router.Helpers, as: Routes # The default endpoint for testing - @endpoint JellyfishWeb.Endpoint + @endpoint FishjamWeb.Endpoint end end diff --git a/test/support/webhook_plug.ex b/test/support/webhook_plug.ex index 497c72da..79d55c5b 100644 --- a/test/support/webhook_plug.ex +++ b/test/support/webhook_plug.ex @@ -1,10 +1,10 @@ defmodule WebHookPlug do @moduledoc false import Plug.Conn - alias Jellyfish.ServerMessage + alias Fishjam.ServerMessage alias Phoenix.PubSub - @pubsub Jellyfish.PubSub + @pubsub Fishjam.PubSub def init(opts) do # initialize options diff --git a/test/support/ws.ex b/test/support/ws.ex index cd004922..42d46876 100644 --- a/test/support/ws.ex +++ b/test/support/ws.ex @@ -1,10 +1,10 @@ -defmodule JellyfishWeb.WS do +defmodule FishjamWeb.WS do @moduledoc false use WebSockex - alias Jellyfish.PeerMessage - alias Jellyfish.ServerMessage + alias Fishjam.PeerMessage + alias Fishjam.ServerMessage @spec start(String.t(), :server | :peer) :: {:ok, pid()} | {:error, term()} def start(url, type) do diff --git a/test/test_helper.exs b/test/test_helper.exs index 4818be81..9325c4b9 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,4 +1,4 @@ -Application.put_env(:jellyfish, :media_files_path, "tmp/jellyfish_resources/") +Application.put_env(:fishjam, :media_files_path, "tmp/fishjam_resources/") Mox.defmock(ExAws.Request.HttpMock, for: ExAws.Request.HttpClient)