-
Notifications
You must be signed in to change notification settings - Fork 4
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
Using activated not Main branch cause server error #203
Comments
I have update on issue. I found the reason. Described error occurs in case of using haproxy between django application and postgresql database, and with non zero values for
settings in haproxy config. The error can be reproduced on fresh netbox-docker setup with netbox branching plugin. Steps to reproduce:
Dockerfile.netbox
haproxy.cfg
.env file
docker-compose.yaml (change keydb image architecture if you use x86 host) services:
netbox: &netbox
build:
context: .
dockerfile: ./Dockerfile.netbox
networks:
- nbsnet
ports:
- "127.0.0.1:8040:8080"
environment:
ALLOWED_HOSTS: '*'
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_HOST: haproxy
DB_PORT: 5433
REDIS_HOST: keydb
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD}
REDIS_DATABASE: 1
REDIS_CACHE_HOST: keydb
REDIS_CACHE_PORT: 6379
REDIS_CACHE_PASSWORD: ${REDIS_PASSWORD}
REDIS_CACHE_DATABASE: 2
SECRET_KEY: ${NETBOX_SECRET_KEY}
DEBUG: 'True'
user: 'unit'
healthcheck:
start_period: 600s
timeout: 30s
interval: 30s
test: "curl -f http://localhost:8080/login/ || exit 1"
netbox-worker:
<<: *netbox
depends_on:
- netbox
command:
- /opt/netbox/venv/bin/python
- /opt/netbox/netbox/manage.py
- rqworker
ports:
- 8080
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
order: start-first
delay: 20s
healthcheck:
start_period: 90s
timeout: 3s
interval: 15s
test: "ps -aux | grep -v grep | grep -q rqworker || exit 1"
netbox-housekeeping:
<<: *netbox
depends_on:
- netbox
command:
- /opt/netbox/housekeeping.sh
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
order: start-first
delay: 20s
ports:
- 8080
healthcheck:
start_period: 90s
timeout: 3s
interval: 15s
test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1"
haproxy:
image: docker.io/haproxy:2.9.8
networks:
- nbsnet
expose:
- 5433
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
postgres:
image: docker.io/postgres:16.3
networks:
- nbsnet
expose:
- 5432
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USER}
POSTGRES_DB: ${DB_NAME}
healthcheck:
test:
- CMD-SHELL
- pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER
timeout: 30s
interval: 10s
retries: 5
start_period: 20s
keydb:
image: docker.io/eqalpha/keydb:arm64_v6.3.3
networks:
- nbsnet
expose:
- 6379
volumes:
- keydb-data:/data
command:
- sh
- -c
- keydb-server --appendonly yes --requirepass $$KEYDB_PASSWORD
environment:
KEYDB_PASSWORD: ${REDIS_PASSWORD}
healthcheck:
test:
- CMD-SHELL
- '[ $$(keydb-cli --pass "$${KEYDB_PASSWORD}" ping) = ''PONG'' ]'
timeout: 3s
interval: 1s
retries: 5
start_period: 5s
networks:
nbsnet:
volumes:
postgres-data:
keydb-data:
docker compose build && docker compose up -d Wait until image will be build, pulled and all containers started and become healthy.
# login into container shell
docker compose exec netbox bash
# run command ad fill requested data
python3 manage.py createsuperuser
If you change haproxy settings to
and redeploy haproxy and netbox containers, it fixes the problem and error doesn't occur. It can be like workaround, but haproxy doesn't recommend to use non zero values for timeouts and print warnings
What I have tried (while keeping non zero client and server timeouts in haproxy):
So, in conclusion - disabling haproxy client and server timeouts can be like workaround. |
Plugin Version
0.5.2
NetBox Version
4.2.2
Python Version
3.12.3
Steps to Reproduce
Hi.
We have strange behaviour using netbox branching plugin, and I would appreciate any advice and help.
Our environment
We use netbox-docker setup. Our setup is deployed in docker swarm cluster with 2 replicas for netbox UI container, connection to postgresql v16.3 database and keydb v6.3.3 (redis alternative for cache) is proxied through 2 separate haproxy services deployed in docker swarm too. This setup works stable for a long time.
Expected Behavior
I expect that working on new branch created in netbox branching plugin will not return server error as described in my case. Willing to provide more information and do tests if needed. I hope for help from the community.
Observed Behavior
Problem description
We have installed netbox branching module according instructions. After creating new branch, activating it and adding test changes in new branch, after several minutes netbox UI returns server error. Recreating docker container fixes it but after several minutes UI returns server error again. Refreshing the page several times can help avoid server error, but it comes back after few minutes. Deactivating new branch (I mean removing to main branch) seems fix error, because on main branch I can't reproduce error.
I have enabled debug mode and can provide some information from debug output.
The error looks like on screenshot, the exception type, value and location is the same on any URI of netbox UI.
Here is traceback log (copy-paste variant)
traceback.log
Also I want to leave here a screenshot of a traceback with local vars that caught my eye (I highlighted what exactly )
![Image](https://private-user-images.githubusercontent.com/196781961/407704710-5e684e75-255c-422f-9449-820e48f86bb7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMjA3NjksIm5iZiI6MTczOTAyMDQ2OSwicGF0aCI6Ii8xOTY3ODE5NjEvNDA3NzA0NzEwLTVlNjg0ZTc1LTI1NWMtNDIyZi05NDQ5LTgyMGU0OGY4NmJiNy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQxMzE0MjlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xY2RlNzViZGViMmIxMTE4YTU0MDBlYmM2NzRhNGJhZjY1YmZiNzM4YzJlYTk4M2ZkZjRjZDE1YmZmNjJlNWY4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.d9POcE2BJE6alwsLBY1llRatHOkRkWb6gY9r20AyE4Y)
Could it relates to described problem and if yes, how to fix it?
Here is netbox.settings.txt
netbox.settings.txt
I have tried to play with those django settings, changing default values to those
but it didn't helped.
The text was updated successfully, but these errors were encountered: