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

Netbox exists after a couple of requests #854

Open
telmich opened this issue Sep 28, 2022 · 4 comments
Open

Netbox exists after a couple of requests #854

telmich opened this issue Sep 28, 2022 · 4 comments

Comments

@telmich
Copy link

telmich commented Sep 28, 2022

Current Behavior

Netbox exits after a few requests, causing nginx-ingress to return a 404 on failure.
Note though, that the container keeps running, it's merely the python/django process exiting.

This restart happens sometimes after 8 requests, sometimes after 20ish requests, but rather frequent. As exit code 0 is a success code, I wonder what the motivation for netbox is to exit.

Expected Behavior

Netbox does not exit on its own. By exiting the nginx-ingress will return a 404 to clients, every time netbox is unreachable.

Docker Compose Version

kubernetes 1.24

Docker Version

crio / unrelated

The git Revision

docker-hub versions: v3.3.2-2.2.0, v3.3.4-2.2.0

The git Status

No git

Startup Command

The image directly, no commands

NetBox Logs

2a0a:e5c0:10:2:6c4c:27bd:c596:4da4 - - [28/Sep/2022:14:11:55 +0000] "GET /ipam/prefixes/39/prefixes/ HTTP/1.1" 200 108611 "https://netbox.xxx/ipam/prefixes/39/" "Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0"
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
2022/09/28 14:13:54 [notice] 20#20 app process (isolated 222) exited with code 0


### Content of docker-compose.override.yml

```yaml
- name: netbox
          image: netboxcommunity/netbox:{{ .Chart.AppVersion }}
          ports:
            - containerPort: 8080
          envFrom:
          - secretRef:
              name: {{ .Release.Name }}-netbox-secret
          env:
            - name: DB_HOST
              value: "{{ .Release.Name }}-postgres"
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: {{ .Release.Name }}-postgres-config
                  key: POSTGRES_PASSWORD
            - name: DB_USER
              valueFrom:
                secretKeyRef:
                  name: {{ .Release.Name }}-postgres-config
                  key: POSTGRES_USER
            - name: DB_NAME
              valueFrom:
                secretKeyRef:
                  name: {{ .Release.Name }}-postgres-config
                  key: POSTGRES_DB
@telmich
Copy link
Author

telmich commented Sep 28, 2022

Original issue for completeness: netbox-community/netbox#10499

@Kartograf
Copy link

I found a workaround for this problem by specifying a static number of processes in nginx-units.json https://github.com/netbox-community/netbox-docker/blob/release/docker/nginx-unit.json#L34

      "applications": {
        "netbox": {
          "type": "python 3",
          "path": "/opt/netbox/netbox/",
          "module": "netbox.wsgi",
          "home": "/opt/netbox/venv",
          "processes": 4
        }
      }

@js94x
Copy link

js94x commented Apr 19, 2023

I am observing the same behavior, although i have already implemented the workaround suggested by @Kartograf .

There are five working requests (with "processes": 4 in nginx-unit.json) in total to netbox / wsgi application but afterwards, no request is answered correctly.

2023/04/19 13:44:34 [info] 33#33 "netbox" prototype started
2023/04/19 13:44:34 [info] 34#34 "netbox" application started
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
2023/04/19 13:44:35 [info] 35#35 "netbox" application started
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
2023/04/19 13:44:37 [info] 36#36 "netbox" application started
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
2023/04/19 13:44:38 [info] 37#37 "netbox" application started
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
✅ Unit configuration loaded successfully
2023/04/19 13:44:39 [notice] 18#18 process 25 exited with code 0
2a05:..... - - [19/Apr/2023:13:44:39 +0000] "GET / HTTP/1.1" 302 0 "-" "kube-probe/1.24+"
2a05:..... - - [19/Apr/2023:13:44:42 +0000] "GET / HTTP/1.1" 302 0 "-" "kube-probe/1.24+"
2a05:..... - - [19/Apr/2023:13:44:47 +0000] "GET / HTTP/1.1" 302 0 "-" "kube-probe/1.24+"
2a05:..... - - [19/Apr/2023:13:44:52 +0000] "GET / HTTP/1.1" 302 0 "-" "kube-probe/1.24+"
2a05:..... - - [19/Apr/2023:13:44:53 +0000] "GET / HTTP/1.1" 302 0 "-" "kube-probe/1.24+"

A request with cURL also times out:

curl localhost:8080/ -v
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.81.0
> Accept: */*
>

Apart from that static assets are working properly:

root@netbox-7b9f7d64cd-22fws:/opt/netbox/netbox# date >> static/date.txt
root@netbox-7b9f7d64cd-22fws:/opt/netbox/netbox# curl localhost:8080/static/date.txt
Wed Apr 19 13:50:34 UTC 2023

jonathon2nd added a commit to fpm-git/netbox-docker that referenced this issue Jun 21, 2023
@jonathon2nd
Copy link

What it wound up being for us was CPU "throttling"
image
After increasing the limits a bunch, it is not using the new cpu provided, but it is happy that it is there.
image

wastrachan added a commit to wastrachan/ansible-role-netbox-docker that referenced this issue Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants