-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Open
FoxxMD
wants to merge
6
commits into
linuxserver:swag-auto-proxy
Choose a base branch
from
FoxxMD:swag-auto-proxy-multi
base: swag-auto-proxy
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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