User Tools

Site Tools


infra:services:netbox

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
infra:services:netbox [2025/03/23 16:20] – created kfhinfra:services:netbox [2026/09/05 15:46] (current) – Document NetBox 502 troubleshooting atluxity_idp.hackeriet.no
Line 3: Line 3:
 ===== Deployment ===== ===== Deployment =====
  
-Deployed in Docker +  * Deployed in Docker 
-Lives on app-01 (/root/services/netbox-docker) +  Lives on [[infra:hosts:app-01|app-01]] (''/root/services/netbox-docker''in the klynge001 cluster 
-Is deployed with plugins (custom Docker image setup) +  Is deployed with plugins (custom Docker image setup) 
-  [[https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins|More info]] at Netbox Github+    [[https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins|More info]] at Netbox Github 
 +  * Exposed through [[infra:hosts:ingress|ingress.hackeriet.no]] 
 +    * Docker compose -> nginx on app-01 -ssl-> nginx on ingress -ssl-> Internet
  
 ==== Update ==== ==== Update ====
Line 14: Line 16:
 docker compose up -d docker compose up -d
 </code> </code>
 +
 +===== Troubleshooting =====
 +
 +==== 502 Bad Gateway from ip.hackeriet.no ====
 +
 +A 502 from ''https://ip.hackeriet.no/'' means nginx is reachable, but the NetBox upstream is not answering correctly.
 +
 +On ''app-01'':
 +
 +<code>
 +cd /root/services/netbox-docker
 +docker compose ps
 +docker compose logs --tail=120 netbox postgres redis redis-cache netbox-worker
 +df -h /storage /var/lib/docker
 +</code>
 +
 +If the containers are confused after a restart, a full compose stop/start has worked better than restarting selected containers:
 +
 +<code>
 +cd /root/services/netbox-docker
 +docker compose down
 +docker compose up -d
 +</code>
 +
 +NetBox can take a little while to become healthy after ''docker compose up -d'', especially while Postgres and the NetBox container settle. Do not treat the 502 as final immediately after starting the stack; watch the compose status and retry the service after a short wait.
 +
 +Useful checks:
 +
 +<code>
 +docker compose ps
 +curl -v http://127.0.0.1:8000/
 +curl -v http://127.0.0.1:8000/api/status/
 +sudo tail -n 100 /var/log/nginx/error.log
 +</code>
 +
 +Interpretation:
 +
 +  * If ''http://127.0.0.1:8000/'' fails locally on app-01, focus on the NetBox Docker stack.
 +  * If the local app-01 check works but ''https://ip.hackeriet.no/'' still returns 502, focus on nginx or the path through [[infra:hosts:ingress|ingress]].
 +  * If Postgres logs mention ''No space left on device'', free space before restarting the stack.
  
/srv/hackeriet-wiki/dokuwiki/data/attic/infra/services/netbox.1742746805.txt.gz · Last modified: by kfh