Configure gunicorn to bind to the IPv6 interface #241
Merged
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.
By default when the
PORTenv var is set, gunicorn binds to the IPv4 interface0.0.0.0:$PORT:https://docs.gunicorn.org/en/stable/settings.html#bind
Now, we configure it to bind to the IPv6 interface
[::]:$PORTinstead, allowing the app to work in IPv6-only environments.We don't have it bind to both the IPv4 and IPv6 interfaces, since otherwise on Linux by default gunicorn would fail to boot with:
...and when binding to the IPv6 interface IPv4 connections will still work (so long as
IPV6_V6ONLYhasn't been enabled).If this strategy causes issues, we could always start using the
reuse_portoption, however, that makes the DX worse for the local development use-case (it's then possible to leave a stale gunicorn process running, which will serve requests and give the impression code changes aren't taking effect).I've added a
gunicorn.conf.pyconfig file rather than passing CLI args to thegunicorncommand, since it allows for more flexibility with the configuration (and there are other settings we'll be adding soon). See:https://docs.gunicorn.org/en/stable/configure.html
GUS-W-17280180.