Commit 962e798
authored
Configure gunicorn to bind to the IPv6 interface (#241)
By default when the `PORT` env var is set, gunicorn binds to the IPv4
interface `0.0.0.0:$PORT`:
https://docs.gunicorn.org/en/stable/settings.html#bind
Now, we configure it to bind to the IPv6 interface `[::]:$PORT` instead,
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:
```
[ERROR] connection to ('::', 5006) failed: [Errno 98] Address already in use
```
...and when binding to the IPv6 interface IPv4 connections will still
work (so long as `IPV6_V6ONLY` hasn't been enabled).
If this strategy causes issues, we could always start using the
`reuse_port` option, 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.py` config file rather than passing CLI args
to the `gunicorn` command, 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.1 parent 0c83b7c commit 962e798
3 files changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
0 commit comments