Skip to content

Commit

Permalink
Rename Jellyfish references in the code (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickel8 authored May 16, 2024
1 parent d3fb68f commit 7316dd0
Show file tree
Hide file tree
Showing 127 changed files with 1,036 additions and 1,036 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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
34 changes: 17 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion compile_proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/ci.exs
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
42 changes: 21 additions & 21 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,58 +10,58 @@ 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,
sip_config: ConfigReader.read_sip_config(sip_used?),
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.
"""

nil ->
: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,
Expand All @@ -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,
Expand All @@ -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
4 changes: 2 additions & 2 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
32 changes: 16 additions & 16 deletions docker-compose-dns.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
Loading

0 comments on commit 7316dd0

Please sign in to comment.