diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 81492e05..d4467d65 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -64,6 +64,7 @@ export default defineConfig({ text: "Advanced Configuration", items: [ { text: "Authentication", link: "/guide/authentication" }, + { text: "Swarm Mode", link: "/guide/swarm-mode" }, { text: "Changing Base", link: "/guide/changing-base" }, { text: "Healthcheck", link: "/guide/healthcheck" }, { text: "Hostname", link: "/guide/hostname" }, diff --git a/docs/guide/remote-hosts.md b/docs/guide/remote-hosts.md index 97d033d3..b58ad1e0 100644 --- a/docs/guide/remote-hosts.md +++ b/docs/guide/remote-hosts.md @@ -10,7 +10,7 @@ Dozzle supports connecting to multiple remote hosts via `tcp://` using TLS and n Remote hosts can be configured with `--remote-host` or `DOZZLE_REMOTE_HOST`. All certs must be mounted to `/certs` directory. The `/certs` directory expects to have `/certs/{ca,cert,key}.pem` or `/certs/{host}/{ca,cert,key}.pem` in case of multiple hosts. -Note the `{host}` value referred to here is the IP or FQDN configured and not the [optional label](#adding-labels-to-hosts). +Note the `{host}` value referred to here is the IP or FQDN configured and not the [optional label](#adding-labels-to-hosts). Multiple `--remote-host` flags can be used to specify multiple hosts. However, using `DOZZLE_REMOTE_HOST` the value should be comma separated. @@ -52,9 +52,8 @@ Running Dozzle without any certs should work. Here is an example: docker run --volume=/var/run/docker.sock:/var/run/docker.sock -p 8080:8080 amir20/dozzle --remote-host tcp://123.1.1.1:2375 ``` -::: warning -Exposing `docker.sock` publicly is not safe. Only use a proxy for an internal network where all clients are trusted. -::: +> [!WARNING] +> Docker Socket Proxy is not recommended for production use. It is only for private networks. ## Adding labels to hosts diff --git a/docs/guide/swarm-mode.md b/docs/guide/swarm-mode.md new file mode 100644 index 00000000..a653f57e --- /dev/null +++ b/docs/guide/swarm-mode.md @@ -0,0 +1,46 @@ +--- +title: Swarm Mode +--- + +# Introducing Swarm Mode + +Dozzle added "Swarm Mode" in version 7 which supports Docker [stacks](https://docs.docker.com/reference/cli/docker/stack/deploy/), [services](https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/) and custom groups for joining logs together. Dozzle does not use Swarm API internally as it is limited. Dozzle implements its own grouping using swarm labels. Additionally, Dozzle merges stats for containers in a group. This means that you can see logs and stats for all containers in a group in one view. But it does mean that each host needs to be setup with Dozzle. + +Dozzle swarm mode is automatically enabled when services or customer groups are found. If you are not using services, you can still take advantage of Dozzle's grouping feature by adding a label to your containers. + +> [!IMPORTANT] +> Version 7 is not released yet but you can try it by using the `master` tag with `amir20/dozzle:master`. + +## Custom Groups + +Custom groups are created by adding a label to your container. The label is `dev.dozzle.group` and the value is the name of the group. All containers with the same group name will be joined together in the UI. For example, if you have a group named `myapp`, all containers with the label `dozzle.group=myapp` will be joined together. + +Here is an example using Docker Compose or Docker CLI: + +::: code-group + +```sh +docker run --label dev.dozzle.group=myapp hello-world +``` + +```yaml [docker-compose.yml] +version: "3" +services: + dozzle: + image: hello-world + labels: + - dev.dozzle.group=myapp +``` + +::: + +## Merging Logs and Stats + +Dozzle merges logs and stats for containers in a group. This means that you can see logs and stats for all containers in a group in one view. This is useful for applications that have multiple containers that work together. Dozzle will automatically find new containers in a group and add them to the view as they are started. + +> [!INFO] +> Automatic discovery of new containers is only available for services and custom groups. If you using merging logs in host mode, only specific containers will be shown. You can still use custom groups to merge logs for containers in swarm mode. + +## Service Discovery + +Dozzle uses Docker API to discover services and custom groups. This means that Dozzle will automatically find new containers in a group and add them to the view as they are started. This is useful for applications that have multiple containers that work together. Labels that are used are `com.docker.stack.namespace` and `com.docker.compose.project` for grouping containers. For services, Dozzle uses the service name as the group name which is `com.docker.swarm.service.name`.