From d7a0111aa64a5a7db3a67409e056fd6691f43824 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sat, 4 Apr 2026 22:13:54 +0200 Subject: [PATCH] docs: add architecture page (#5638) --- docs/1-kickoff/5-architecture.md | 20 ++++ docs/1-kickoff/architecture.svg | 189 +++++++++++++++++++++++++++++++ docs/4-other/01-configuration.md | 10 +- scripts/format.mk | 15 ++- scripts/lint.mk | 8 +- 5 files changed, 229 insertions(+), 13 deletions(-) create mode 100644 docs/1-kickoff/5-architecture.md create mode 100644 docs/1-kickoff/architecture.svg diff --git a/docs/1-kickoff/5-architecture.md b/docs/1-kickoff/5-architecture.md new file mode 100644 index 00000000..f09b942a --- /dev/null +++ b/docs/1-kickoff/5-architecture.md @@ -0,0 +1,20 @@ +# Architecture + +![architecture](architecture.svg) + +In order to provide its features, _MediaMTX_ performs the following network interactions: + +- It interacts with any external source defined in the configuration, as a client, pulling streams. +- It exposes a series of servers that allow clients to publish and read streams with several protocols. +- It exposes a playback server that allows to read streams stored on disk. +- It exposes a series of administrative services. + +Internally, the service revolves around these components: + +- A path manager, is in charge of managing paths, performing authentication and linking clients to paths. +- Paths. Each path contains a stream, which is provided by a single publisher or by a single external source, and is then broadcasted to any reader. +- A recorder, in charge of storing streams to disks. + +Everything is controlled through configuration parameters, defined in the configuration file or in environment variables. + +Furthermore, the server can be configured to interact with an identity server in order to perform authentication. diff --git a/docs/1-kickoff/architecture.svg b/docs/1-kickoff/architecture.svg new file mode 100644 index 00000000..0a985eca --- /dev/null +++ b/docs/1-kickoff/architecture.svg @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + RTSP + server + + + RTMP + server + + + WebRTC + server + + + SRT + server + + + HLS + server + +External sources +(cameras, servers) + + + + + + + + + + + + + recorder + + + playback + server + + + control + API + + + metrics + server + + + pprof + server + +path +manager + + + + + + + + + +MediaMTX +HLS +readers +SRT +publishers +SRT +readers +WebRTC +publishers +WebRTC +readers +RTMP +publishers +RTMP +readers +RTSP +publishers +RTSP +readers + + + + paths + + + +playback +users + + +administrators + + + + + disk + + + + + + + + + + + + + + identity server + (HTTP / JWT) + + + + + + + configuration + (file or environment) + + + + + + + + + + + + + + + + + + + + diff --git a/docs/4-other/01-configuration.md b/docs/4-other/01-configuration.md index 9e0e04c5..019eccfa 100644 --- a/docs/4-other/01-configuration.md +++ b/docs/4-other/01-configuration.md @@ -1,12 +1,12 @@ # Configuration -All the configuration parameters are listed and commented in the [configuration file](../5-references/1-configuration-file.md) (`mediamtx.yml`). +_MediaMTX_ can be configured through parameters that are listed and commented in the [configuration file](../5-references/1-configuration-file.md) (`mediamtx.yml`). ## Change the configuration -There are several ways to change the configuration: +There are several ways to change configuration parameters: -1. By editing the configuration file, that is +1. Edit the configuration file, that is - included into the release bundle - available in the root folder of the Docker image (`/mediamtx.yml`); it can be overridden in this way: @@ -16,7 +16,7 @@ There are several ways to change the configuration: The configuration can be changed dynamically when the server is running (hot reloading) by writing to the configuration file. Changes are detected and applied without disconnecting existing clients, whenever it's possible. -2. By overriding configuration parameters with environment variables, in the format `MTX_PARAMNAME`, where `PARAMNAME` is the uppercase name of a parameter. For instance, the `rtspAddress` parameter can be overridden in the following way: +2. Use environment variables, in the format `MTX_PARAMNAME`, where `PARAMNAME` is the uppercase name of a parameter. For instance, the `rtspAddress` parameter can be overridden in the following way: ```sh MTX_RTSPADDRESS="127.0.0.1:8554" ./mediamtx @@ -47,7 +47,7 @@ There are several ways to change the configuration: docker run --rm -it --network=host -e MTX_PATHS_TEST_SOURCE=rtsp://myurl bluenviron/mediamtx:1 ``` -3. By using the [Control API](17-control-api.md). +3. Use the [Control API](17-control-api.md). ## Encrypt the configuration diff --git a/scripts/format.mk b/scripts/format.mk index dae932b2..e27f77a0 100644 --- a/scripts/format.mk +++ b/scripts/format.mk @@ -4,7 +4,20 @@ RUN go install mvdan.cc/gofumpt@v0.5.0 endef export DOCKERFILE_FORMAT -format: +define DOCKERFILE_PRETTIER +FROM $(NODE_IMAGE) +RUN yarn global add prettier@3.6.2 +endef +export DOCKERFILE_PRETTIER + +format-go: echo "$$DOCKERFILE_FORMAT" | docker build -q . -f - -t temp docker run --rm -it -v "$(shell pwd):/s" -w /s temp \ sh -c "gofumpt -l -w ." + +format-docs: + echo "$$DOCKERFILE_PRETTIER" | docker build . -f - -t temp + docker run --rm -v "$(shell pwd)/docs:/s" -w /s temp \ + sh -c "prettier --write ." + +format: format-go format-docs diff --git a/scripts/lint.mk b/scripts/lint.mk index c50d9524..0dad5bcf 100644 --- a/scripts/lint.mk +++ b/scripts/lint.mk @@ -1,9 +1,3 @@ -define DOCKERFILE_DOCS_LINT -FROM $(NODE_IMAGE) -RUN yarn global add prettier@3.6.2 -endef -export DOCKERFILE_DOCS_LINT - define DOCKERFILE_API_DOCS_LINT FROM $(NODE_IMAGE) RUN yarn global add @redocly/cli@1.0.0-beta.123 @@ -31,7 +25,7 @@ lint-docsorder: go test -v -tags enable_linters ./internal/linters/docsorder lint-docs: - echo "$$DOCKERFILE_DOCS_LINT" | docker build . -f - -t temp + echo "$$DOCKERFILE_PRETTIER" | docker build . -f - -t temp docker run --rm -v "$(shell pwd)/docs:/s" -w /s temp \ sh -c "prettier --check ."