-
Notifications
You must be signed in to change notification settings - Fork 3k
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
New backward compatible multiport syntax for VIRTUAL_PORT variable #2130
Conversation
5e6d117
to
58cb570
Compare
Hi @buchdag, I thin this PR is ready for review now. Thanks in advance. |
I'm having trouble parsing the proposed syntax. Can you express it in ABNF? Also, see my comment in #1504. |
This is EBNF but for the leaf items Here is how I would put it in ABNF:
|
Apologies, I somehow misread the colon separator as a comma which confused me greatly. I understand now. |
62f51f5
to
b3f13b5
Compare
Rebased on 'main'. |
@pini-gh I like this. I'll try to review it this week-end. Do you remember (of the top of your head, I'll search myself later) issues that would be solved by this PR or other PR that implements the same feature ? |
@buchdag Thanks Browsing the issues I've found these ones : #560, #911, #939, #1042, #1066, #1112, #1382, #1463, #1504, #2050. Some of them ask explicitly for accessing the same container through different vhosts / vports. I think this PR is relevant for them as well because it brings a different solution for the very same problem: one container exposing several ports. EDIT: I forgot to answer about other PRs. Here they are: #259, #1405. And I know @rhansen is working on something similar. See his comments in #1504. |
b1a92ec
to
05e923e
Compare
65c9374
to
316f1f6
Compare
316f1f6
to
3893a41
Compare
What is the status for this? Any help needed? |
@VincentSC See the discussion in #1504. Two things need to happen: the dust needs to settle on the desired syntax, and the code needs infrastructure changes to support whatever syntax we end up with. I've been slowly chipping away at the prerequisite code changes in separate pull requests. |
3893a41
to
ebff6f6
Compare
ebff6f6
to
e890343
Compare
d47010f
to
307c466
Compare
307c466
to
efbe976
Compare
efbe976
to
0547482
Compare
0547482
to
96310af
Compare
96310af
to
fa13747
Compare
fa13747
to
fe7e709
Compare
fe7e709
to
0baaa23
Compare
0baaa23
to
803bef4
Compare
Is there hope that this will be resumed in the near future? I need it a lot |
You can use image |
75cc452
to
ed248c6
Compare
3a36672
to
4c647ab
Compare
4c647ab
to
22ec1b9
Compare
22ec1b9
to
78d1b48
Compare
104863a
to
aa22257
Compare
Syntax: VIRTUAL_PORT = [ <virtual_port> | <multiport> ]; multiport = port, { ",", port }; port = <virtual_port> [ ":", <virtual_path> [ ":", <virtual_dest> ]]; Example with multiport syntax: VIRTUAL_HOST: "multiport.example.com" VIRTUAL_PORT: "9220:~ ^/(admin|fonts?|images|webmin)/,10901,20901:/ws2p,30901:/gva/playground" Produces: # multiport.example.com:10901 upstream multiport.example.com-10901 { # Exposed ports: [{ 10901 tcp } { 20901 tcp } { 30901 tcp } { 9220 tcp }] # Default virtual port: 80 # VIRTUAL_PORT: 10901 ## Can be connected with "docker-gen-bridge" network # blah server 172.29.0.5:10901; } # multiport.example.com:20901/ws2p upstream multiport.example.com-5c7ebef820fe004e45e3af1d0c47971594d028b2-20901 { # Exposed ports: [{ 10901 tcp } { 20901 tcp } { 30901 tcp } { 9220 tcp }] # Default virtual port: 80 # VIRTUAL_PORT: 20901 ## Can be connected with "docker-gen-bridge" network # blah server 172.29.0.5:20901; } # multiport.example.com:30901/gva/playground upstream multiport.example.com-1f02ce2421b17d828edaabfc3014360891bb0be3-30901 { # Exposed ports: [{ 10901 tcp } { 20901 tcp } { 30901 tcp } { 9220 tcp }] # Default virtual port: 80 # VIRTUAL_PORT: 30901 ## Can be connected with "docker-gen-bridge" network # blah server 172.29.0.5:30901; } # multiport.example.com:9220~ ^/(admin|fonts?|images|webmin)/ upstream multiport.example.com-cae8bfc2ea1fe6bb6fda08727ab065e8fed98aa2-9220 { # Exposed ports: [{ 10901 tcp } { 20901 tcp } { 30901 tcp } { 9220 tcp }] # Default virtual port: 80 # VIRTUAL_PORT: 9220 ## Can be connected with "docker-gen-bridge" network # blah server 172.29.0.5:9220; } server { server_name multiport.example.com; access_log /var/log/nginx/access.log vhost; listen 80 ; location / { proxy_pass http://multiport.example.com-10901; } location /ws2p { proxy_pass http://multiport.example.com-5c7ebef820fe004e45e3af1d0c47971594d028b2-20901/; } location /gva/playground { proxy_pass http://multiport.example.com-1f02ce2421b17d828edaabfc3014360891bb0be3-30901; } location ~ ^/(admin|fonts?|images|webmin)/ { proxy_pass http://multiport.example.com-cae8bfc2ea1fe6bb6fda08727ab065e8fed98aa2-9220; } } This feature is discussed in that upstream issue: nginx-proxy#1504
aa22257
to
bd1aeda
Compare
Superseded by #2434 |
Closing this PR now that #2434 is merged. |
This pull request is intended to support containers exposing more than one entrypoint through different ports. I've discussed this topic in issue #1504.
New
VIRTUAL_PORT
syntaxAs many nginx
upstream
definitions are created as specified ports. The same goes forlocation
blocks. Routing is performed based on the virtual path specified for each port.Example
would produce one nginx
upstream
definition per port, and as manylocation
blocs:Backward compatible
Legacy
VIRTUAL_PORT
syntax with only one port still works the very same way. I've ran the full test suite with only 3 unrelated errors (which I reproduce with version 1.0.4 as well):Added related documentation
See section 'Multiport Syntax' of the README.
Specific test case
I've added a test case in folder
test/test_multiport_syntax
. It features a web server exposing 4 ports. All these ports are reachable through different paths. This test case runs successfully on my box.