-
-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple docker hosts #916
base: swag-auto-proxy
Are you sure you want to change the base?
Conversation
* generate configs using both docker.sock and DOCKER_HOST data * parse multiple hosts from DOCKER_HOST * enable generating swag_url with host friendly name inserted * maintain backwards compatibility with current functionality
PR build pushed to |
* Keep existing behavior if no upstream host * When using upstream host look for 80, 8080, or first exposed container port and use HostPort for upstream
PR build pushed to |
PR build pushed to |
1 similar comment
PR build pushed to |
Prefix insert/tld ENVs with AUTO_PROXY to make it clear they are related to this mod
PR build pushed to |
This pull request has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
Other than needing to fast-forward with the current tree there is no other feedback I have received. The changes are feature complete as far as I'm concerned. I've been using this on my own servers for weeks. I guess I'll mention some previous contributors since no one is looking at this? @aptalca @nemchik ? |
This pull request has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
The PR is still ready other than needing to be synced with the upstream. Can someone please take a look? |
Thanks for the PR, but unfortunately this is not something I (the maintainer) can take on in terms of support and future maintenance. The changes are very extensive, and it even adds a wrapper while the benefit is not that great. I do see the benefit, but very few people would actually need this, which makes this a niche feature. I'm afraid the cost to benefit ratio is way too high for me. I'll leave it open in case another team member is interested in taking over maintenance and is ok with merging this in. |
I would actually love to have this feature. I have been most of the day looking for a way to autodiscover from my two hosts. Most people may start with running on a single Raspberry, but once you start to self-host there's no stop. It's worse than Pringles. I understand the whole project is about a single host, but it has already grown to even configuring Uptime. Why not reaching out to another host on the network? TCP communication instead of only socket is already available. I just arrived and don't know much about the internals, but this would be a nic(h)e feature. I haven't found any other project that allows this without getting into container orchestration swarms and so on. It would really make SWAG shine. Thanks FoxxMD for the huge work, I may give your version a try. |
Time saver for anyone with more than a single device. |
Just FYI my fork can be used even though this isn't merged. I've pushed an image to docker (or the LSIO pr image could be used): services:
swag:
#...
environment:
DOCKER_MODS: "linuxserver/mods:universal-docker|foxxmd/auto-proxy-multi" |
This pull request has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
Replicated from the updated readme:
Multiple Hosts:
If both
DOCKER_HOST
anddocker.sock
volumes are provided this mod will detect containers using both connections. As noted in the requirements, containers detected viadocker.sock
must be in the same user defined network or haveswag_address
label set.Multiple remote hosts can be used via
DOCKER_HOST
by separating hosts with a comma. Additional per-host settings can be assigned by separating with a pipe|
. The syntax for per-host configuration:192.168.0.100:2375
-- Friendly Name:serverA
-- TLD:*
192.168.0.110:2375
-- Friendly Name:serverB
-- TLD:local.test
192.168.0.130:2375
-- Friendly Name:host3
-- TLD:*
Upstream IP and Port
When using a remote docker host from
DOCKER_HOST
auto-proxy assumes the detected containers are not on the same network as SWAG:swag_address
label set then the Host IP will be used.swag_port
label set then auto-proxy looks for exposed container ports and uses the corresponding host port as the upstream port. Container ports are checked in this order:Subdomains and TLD
If a detected container does not have the
swag_url
label set then the subdomain and TLD can be programmatically generated.The default TLD used in nginx
server_name
directive can be set usingAUTO_PROXY_HOST_TLD
. This can also be set per-host using the syntax described inDOCKER_HOST
fordefault_tld
.The subdomain used for a container can optionally be modified to include the Host's
friendly_name
described in theDOCKER_HOST
syntax by settingAUTO_PROXY_HOST_INSERT
to eitherprefix
orsuffix
Examples using a container named
overseer
:DOCKER_HOST=192.168.0.100:2375|serverA
AUTO_PROXY_HOST_TLD
(not set, defaults to*
)AUTO_PROXY_HOST_INSERT
server_name overseer.*
prefix
=> nginxserver_name serverA-overseer.*
suffix
=> nginxserver_name overseer-serverA.*
DOCKER_HOST=192.168.0.100:2375|serverA
AUTO_PROXY_HOST_TLD=test.home
AUTO_PROXY_HOST_INSERT=prefix
server_name serverA-overseer.test.home
DOCKER_HOST=192.168.0.100:2375|serverA|myserver.home
AUTO_PROXY_HOST_INSERT=prefix
server_name serverA-overseer.myserver.home
DOCKER_HOST=192.168.0.100:2375
AUTO_PROXY_HOST_TLD=myserver.home
server_name overseer.myserver.home