Skip to content

Commit b90d2b1

Browse files
authored
Merge pull request #1123 from linuxserver/swag-auto-proxy-no-dep
auto-proxy: remove dependency on universal-docker mod, install docker-cli from alpine repo
2 parents ac2910a + 7251940 commit b90d2b1

File tree

9 files changed

+18
-4
lines changed

9 files changed

+18
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
This mod gives SWAG the ability to auto-detect running containers via labels and automatically enable reverse proxy for them.
44

55
## Requirements:
6-
- 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`.
6+
- This mod needs either mapping `docker.sock` or setting the environment variable `DOCKER_HOST=remoteaddress` (see section below for [security consideration](#security-consideration)).
77
- 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.
88
- Containers to be auto-detected and reverse proxied must have a label `swag=enable` at a minimum.
9-
- 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`).
9+
- 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.
1010

1111
## Labels:
1212
- `swag=enable` - required for auto-detection
@@ -21,7 +21,7 @@ This mod gives SWAG the ability to auto-detect running containers via labels and
2121
- `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.
2222

2323

24-
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`.
24+
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`.
2525

2626
## Security Consideration:
2727
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.

root/etc/s6-overlay/s6-rc.d/init-mod-swag-auto-proxy-setup/dependencies.d/init-mod-universal-docker-setup renamed to root/etc/s6-overlay/s6-rc.d/init-mod-swag-auto-proxy-add-package/dependencies.d/init-mods

File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
if grep -q "linuxserver/mods:universal-docker" /run/s6/container_environment/DOCKER_MODS; then
4+
until [ -f /usr/local/bin/docker ]; do
5+
sleep 3
6+
done
7+
echo "**** Using docker binary from the universal-docker mod ****"
8+
else
9+
echo "**** Adding docker-cli to package install list ****"
10+
echo "\
11+
docker-cli" >> /mod-repo-packages-to-install.list
12+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/init-mod-swag-auto-proxy-add-package/run

root/etc/s6-overlay/s6-rc.d/init-mod-swag-auto-proxy-setup/dependencies.d/init-mods-package-install

Whitespace-only changes.

root/etc/s6-overlay/s6-rc.d/init-mod-swag-auto-proxy-setup/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/with-contenv bash
22

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

root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-swag-auto-proxy-add-package

Whitespace-only changes.

root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mod-swag-auto-proxy-add-package

Whitespace-only changes.

0 commit comments

Comments
 (0)