Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
This mod gives SWAG the ability to auto-detect running containers via labels and automatically enable reverse proxy for them.

## Requirements:
- This mod needs the [universal-docker mod](https://github.com/linuxserver/docker-mods/tree/universal-docker) installed and set up with either mapping `docker.sock` or setting the environment variable `DOCKER_HOST=remoteaddress`.
- This mod needs either mapping `docker.sock` or setting the environment variable `DOCKER_HOST=remoteaddress` (see section below for [security consideration](#security-consideration)).
- Other containers to be auto-detected and reverse proxied should be in the same [user defined bridge network](https://docs.linuxserver.io/general/swag#docker-networking) as SWAG.
- Containers to be auto-detected and reverse proxied must have a label `swag=enable` at a minimum.
- To benefit from curated preset proxy confs we provide, the container name must match the container names that are suggested in our readme examples (ie. `radarr` and not `Radarr-4K`).
- To benefit from curated preset proxy confs we provide, either the container name must match the container names that are suggested in our readme examples (ie. `radarr` and not `Radarr-4K`), or the `swag_preset_conf` label must be set.

## Labels:
- `swag=enable` - required for auto-detection
Expand All @@ -21,7 +21,7 @@ This mod gives SWAG the ability to auto-detect running containers via labels and
- `swag_preset_conf=confname` - *optional* - allows defining a preset conf to use if the container name does not match one (if the conf name is `radarr.subdomain.conf.sample`, set this value to `radarr`). If the container name matches an existing conf, this var will be ignored.


In SWAG docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:universal-docker|linuxserver/mods:swag-auto-proxy` and either add a volume mapping for `/var/run/docker.sock:/var/run/docker.sock:ro`, or set an environment var `DOCKER_HOST=remoteaddress`.
In SWAG docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:swag-auto-proxy` and either add a volume mapping for `/var/run/docker.sock:/var/run/docker.sock:ro`, or set an environment var `DOCKER_HOST=remoteaddress`.

## Security Consideration:
Mapping the `docker.sock`, especially in a publicly accessible container is a security liability. Since this mod only needs read-only access to the docker api, the recommended method is to proxy the `docker.sock` via a solution like [our docker socket proxy](https://github.com/linuxserver/docker-socket-proxy), limit the access, and set `DOCKER_HOST=` to point to the proxy address.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/with-contenv bash

if grep -q "linuxserver/mods:universal-docker" /run/s6/container_environment/DOCKER_MODS; then
until [ -f /usr/local/bin/docker ]; do
sleep 3
done
echo "**** Using docker binary from the universal-docker mod ****"
else
echo "**** Adding docker-cli to package install list ****"
echo "\
docker-cli" >> /mod-repo-packages-to-install.list
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-mod-swag-auto-proxy-add-package/run
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/with-contenv bash

if [ ! -S /var/run/docker.sock ] && [ -z "$DOCKER_HOST" ]; then
echo "**** Docker mod not set up properly, skipping SWAG auto-proxy ****"
echo "**** Docker service access not set up properly, skipping SWAG auto-proxy, please map either the docker socket or set the DOCKER_HOST var. ****"
exit 0
fi

Expand Down