Skip to content
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

Make nginx-unit listen on IPv4 and IPv6 #889

Merged
merged 1 commit into from
Dec 6, 2022
Merged

Make nginx-unit listen on IPv4 and IPv6 #889

merged 1 commit into from
Dec 6, 2022

Conversation

cimnine
Copy link
Collaborator

@cimnine cimnine commented Nov 23, 2022

Related Issue: #887

New Behavior

Nginx Unit listens on IPv4 and IPv6.

Contrast to Current Behavior

It seems that *:8080 only binds to 0.0.0.0:8080, unfortunately.

Discussion: Benefits and Drawbacks

I don't see any drawbacks.

Changes to the Wiki

n/a

Proposed Release Note Entry

The container will now also listen on IPv6.

Double Check

  • I have read the comments and followed the PR template.
  • I have explained my PR according to the information in the comments.
  • My PR targets the develop branch.

@cimnine cimnine added the enhancement The issue describes an enhancement that we would like to implement in the future. label Nov 23, 2022
@cimnine cimnine self-assigned this Nov 23, 2022
@cimnine cimnine marked this pull request as ready for review December 6, 2022 09:08
@cimnine cimnine requested a review from tobiasge December 6, 2022 09:08
@cimnine cimnine merged commit 751a131 into develop Dec 6, 2022
@cimnine cimnine deleted the listenOnIPv6 branch December 6, 2022 20:09
@cimnine cimnine linked an issue Dec 6, 2022 that may be closed by this pull request
@tobiasge tobiasge mentioned this pull request Dec 15, 2022
3 tasks
@bsv9
Copy link

bsv9 commented Dec 15, 2022

This configurations doesn't work if on system with ipv6 disabled

⚙️ Applying configuration from /etc/unit/nginx-unit.json
2022/12/15 16:56:44 [alert] 7#7 socket(\"[::]:8080\") failed (97: Address family not supported by protocol)
2022/12/15 16:56:44 [alert] 23#23 failed to apply new conf

How to repeat:
Add "ipv6.disable=1" to the kernel args

@mlazzarotto
Copy link

mlazzarotto commented Dec 30, 2022

This configurations doesn't work if on system with ipv6 disabled

⚙️ Applying configuration from /etc/unit/nginx-unit.json
2022/12/15 16:56:44 [alert] 7#7 socket(\"[::]:8080\") failed (97: Address family not supported by protocol)
2022/12/15 16:56:44 [alert] 23#23 failed to apply new conf

How to repeat: Add "ipv6.disable=1" to the kernel args

I confirm this behaviour. Not everyone has IPv6 enabled

@chrisho95
Copy link

Hi,

I have the same problem. I don't use IPv6 adresses.

2023/01/10 13:50:17 [notice] 7#7 process 14 exited with code 0
2023/01/10 13:50:17 [info] 16#16 router started
2023/01/10 13:50:17 [info] 16#16 OpenSSL 3.0.2 15 Mar 2022, 30000020
âï¸ Applying configuration from /etc/unit/nginx-unit.json
2023/01/10 13:50:18 [alert] 7#7 socket("[::]:8080") failed (97: Address family not supported by protocol)
2023/01/10 13:50:18 [alert] 16#16 failed to apply new conf
â ï¸ Could no load Unit configuration
2023/01/10 13:50:18 [notice] 7#7 process 12 exited with code 1
2023/01/10 13:50:18 [notice] 7#7 process 15 exited with code 0
2023/01/10 13:50:18 [notice] 7#7 process 16 exited with code 0

To work around this problem, I have to overwrite the nginx-unit.json file by removing the ipv6 part. All done in my docker-compose file.

@CupcakePWR
Copy link

I have to overwrite the nginx-unit.json file by removing the ipv6 part. All done in my docker-compose file.

Mind sharing how you did that? I'm having the same problem, and I'm not that familiar with docker

@chrisho95
Copy link

Hi,

You need to put your "nginx-unit.json" file in a directory on your server and remove the ipv6 part. Then in your docker-compose file, you must create a volume between your corrected file and the file that is placed in the docker (foler /etc/unit/).

Finally you have to launch the commande "docker-compose up -d" to rebuild the docker.

version: '3.4'
services:
netbox-rms: &netbox-rms
image: netbox-docker:v3.4.1
container_name: netbox-rms
restart: unless-stopped
depends_on:
- redis-rms
- redis-cache-rms
- netbox-worker-rms
env_file: /opt/netbox/env/netbox.env
user: 'unit:root'
volumes:
- netbox-media-files:/opt/netbox/netbox/media:z
- /opt/netbox/configuration:/etc/netbox/config:z,ro
- /opt/netbox/scripts:/etc/netbox/scripts:z,ro
- /opt/netbox/configuration/nginx-unit.json:/etc/unit/nginx-unit.json:ro

Br,

Chris.

@CupcakePWR
Copy link

My biggest headache was how to get the nginx-unit.json file out from my container when it wouldn't boot..
But I copied the nginx-unit.json from here to ./configuration/nginx-unit.json and removed this;
"[::]:8080": {
"pass": "routes"
}

Then changed my docker-compose.override.yml file as you suggested and ran docker-compose up -d
It works again now! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue describes an enhancement that we would like to implement in the future.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

daemon doesn't listen on IPv6
6 participants