Repository: paperless-ngx/paperless-ngx

Issue:
[BUG] Error starting gunicorn when IPv6 is disabled on host
### Description

Paperless fails to launch in at least certain scenarios when IPv6 is disabled on the host. This was working before a change from listening on `0.0.0.0` to listening on `::`.

### Steps to reproduce

Add the following to `/etc/sysctl.conf`:

```
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
```

Set `GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"` in `/etc/default/grub`, and `update-grub`.

Reboot and run paperless-ngx

### Webserver logs

```bash
Paperless-ngx docker container starting...
Mapping UID and GID for paperless:paperless to 1000:65538
usermod: no changes
Creating directory /tmp/paperless
Adjusting permissions of paperless files. This may take a while.
Waiting for PostgreSQL to start...
Waiting for Redis: redis://paperless-redis.paperless.svc:6379
Connected to Redis broker: redis://paperless-redis.paperless.svc:6379
Apply database migrations...
Operations to perform:
  Apply all migrations: admin, auth, authtoken, contenttypes, django_q, documents, paperless_mail, sessions
Running migrations:
  No migrations to apply.
Executing /usr/local/bin/paperless_cmd.sh
2022-08-04 14:20:24,984 INFO Set uid to user 0 succeeded
2022-08-04 14:20:24,985 INFO supervisord started with pid 49
2022-08-04 14:20:25,988 INFO spawned: 'consumer' with pid 50
2022-08-04 14:20:25,990 INFO spawned: 'gunicorn' with pid 51
2022-08-04 14:20:25,992 INFO spawned: 'scheduler' with pid 52
[2022-08-04 10:20:26 -0400] [51] [INFO] Starting gunicorn 20.1.0
[2022-08-04 10:20:35 -0400] [72] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:36 -0400] [72] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:37 -0400] [72] [ERROR] Can't connect to ('::', 8000)
2022-08-04 14:20:37,727 INFO exited: gunicorn (exit status 1; not expected)
2022-08-04 14:20:38,730 INFO spawned: 'gunicorn' with pid 74
[2022-08-04 10:20:39 -0400] [74] [INFO] Starting gunicorn 20.1.0
[2022-08-04 10:20:39 -0400] [74] [ERROR] Retrying in 1 second.
2022-08-04 14:20:40,017 INFO success: gunicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[2022-08-04 10:20:40 -0400] [74] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:41 -0400] [74] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:42 -0400] [74] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:43 -0400] [74] [ERROR] Retrying in 1 second.
[2022-08-04 10:20:44 -0400] [74] [ERROR] Can't connect to ('::', 8000)
2022-08-04 14:20:44,069 INFO exited: gunicorn (exit status 1; not expected)
```


### Paperless-ngx version

1.8.0

### Host OS

Ubuntu 22.04 x64, Microk8s 1.22

### Installation method

Docker - official image

### Browser

_No response_

### Configuration changes

_No response_

### Other

This seems to be a regression from https://github.com/paperless-ngx/paperless-ngx/pull/924. Changing the listen IP back to 0.0.0.0 in gunicorn.conf.py causing it to bind correctly again


Discussion:

Resolving patch:
diff --git a/gunicorn.conf.py b/gunicorn.conf.py
--- a/gunicorn.conf.py
+++ b/gunicorn.conf.py
@@ -1,6 +1,6 @@
 import os
 
-bind = f'[::]:{os.getenv("PAPERLESS_PORT", 8000)}'
+bind = f'{os.getenv("PAPERLESS_BIND_ADDR", "[::]")}:{os.getenv("PAPERLESS_PORT", 8000)}'
 workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 1))
 worker_class = "paperless.workers.ConfigurableWorker"
 timeout = 120


Test patch: