mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-06-08 19:16:47 +02:00
Updated Troubleshooting (markdown)
parent
1018ae95fe
commit
6debf791e2
@ -8,26 +8,26 @@ If your issue is not here, look through [the existing issues][issues] and eventu
|
|||||||
See all running containers:
|
See all running containers:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose ps
|
docker compose ps
|
||||||
```
|
```
|
||||||
|
|
||||||
See all logs:
|
See all logs:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose logs -f
|
docker compose logs -f
|
||||||
```
|
```
|
||||||
> (Press Ctrl+C to return to the shell prompt.)
|
> (Press Ctrl+C to return to the shell prompt.)
|
||||||
|
|
||||||
See just the NetBox logs:
|
See just the NetBox logs:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose logs -f netbox
|
docker compose logs -f netbox
|
||||||
```
|
```
|
||||||
|
|
||||||
Stop it all:
|
Stop it all:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose stop
|
docker compose stop
|
||||||
```
|
```
|
||||||
|
|
||||||
Reset the project:
|
Reset the project:
|
||||||
@ -35,7 +35,7 @@ Reset the project:
|
|||||||
> ⚠️ **This will remove any Netbox-related data.**
|
> ⚠️ **This will remove any Netbox-related data.**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose down -v --remove-orphans
|
docker compose down -v --remove-orphans
|
||||||
git reset --hard origin/release
|
git reset --hard origin/release
|
||||||
````
|
````
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ git reset --hard origin/release
|
|||||||
Start the Netbox Container shell, e.g. to get access to `./manage.py` or look for files:
|
Start the Netbox Container shell, e.g. to get access to `./manage.py` or look for files:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose exec netbox /bin/bash
|
docker compose exec netbox /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
To load the Python environment for Netbox run:
|
To load the Python environment for Netbox run:
|
||||||
@ -57,23 +57,23 @@ source /opt/netbox/venv/bin/activate
|
|||||||
Access the database:
|
Access the database:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose exec postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
|
docker compose exec postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
|
||||||
```
|
```
|
||||||
|
|
||||||
Take a database backup
|
Take a database backup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose exec -T postgres sh -c 'pg_dump -cU $POSTGRES_USER $POSTGRES_DB' | gzip > db_dump.sql.gz
|
docker compose exec -T postgres sh -c 'pg_dump -cU $POSTGRES_USER $POSTGRES_DB' | gzip > db_dump.sql.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
Restore that database:
|
Restore that database:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Stop all NetBox instances that access the db
|
# Stop all NetBox instances that access the db
|
||||||
docker-compose stop netbox netbox-worker netbox-housekeeping
|
docker compose stop netbox netbox-worker netbox-housekeeping
|
||||||
|
|
||||||
# Restore the DB dump
|
# Restore the DB dump
|
||||||
gunzip -c db_dump.sql.gz | docker-compose exec -T postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
|
gunzip -c db_dump.sql.gz | docker compose exec -T postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
|
||||||
```
|
```
|
||||||
|
|
||||||
### File Operations
|
### File Operations
|
||||||
@ -81,7 +81,7 @@ gunzip -c db_dump.sql.gz | docker-compose exec -T postgres sh -c 'psql -U $POSTG
|
|||||||
Backup of the _media_ directory, which contains uploaded images.
|
Backup of the _media_ directory, which contains uploaded images.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose exec -T netbox tar c -jf - -C /opt/netbox/netbox/media ./ > media-backup.tar.bz2
|
docker compose exec -T netbox tar c -jf - -C /opt/netbox/netbox/media ./ > media-backup.tar.bz2
|
||||||
```
|
```
|
||||||
|
|
||||||
Restore of the _media_ directory:
|
Restore of the _media_ directory:
|
||||||
@ -89,7 +89,7 @@ Restore of the _media_ directory:
|
|||||||
> ⚠️ This may overwrite files in the media directory!
|
> ⚠️ This may overwrite files in the media directory!
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose exec -T netbox tar x -jvf - -C /opt/netbox/netbox/media < media-backup.tar.bz2
|
docker compose exec -T netbox tar x -jvf - -C /opt/netbox/netbox/media < media-backup.tar.bz2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Netbox Worker Operations
|
### Netbox Worker Operations
|
||||||
@ -97,7 +97,7 @@ docker-compose exec -T netbox tar x -jvf - -C /opt/netbox/netbox/media < media-b
|
|||||||
See the status of the worker queue:
|
See the status of the worker queue:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose run --rm netbox-worker /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py rqstats
|
docker compose run --rm netbox-worker /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py rqstats
|
||||||
```
|
```
|
||||||
|
|
||||||
### Netbox Shell (nbshell)
|
### Netbox Shell (nbshell)
|
||||||
@ -105,7 +105,7 @@ docker-compose run --rm netbox-worker /opt/netbox/venv/bin/python /opt/netbox/ne
|
|||||||
The _nbshell_ is a way to quickly get programmatic access to Netbox. It offers about the same interface as the Netbox REST API.
|
The _nbshell_ is a way to quickly get programmatic access to Netbox. It offers about the same interface as the Netbox REST API.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py nbshell
|
docker compose run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py nbshell
|
||||||
```
|
```
|
||||||
|
|
||||||
## Frequently Asked Questions (FAQ) and Common Problems
|
## Frequently Asked Questions (FAQ) and Common Problems
|
||||||
@ -150,9 +150,9 @@ Update your local installation:
|
|||||||
git pull origin release
|
git pull origin release
|
||||||
|
|
||||||
# Fetch the newest containers
|
# Fetch the newest containers
|
||||||
docker-compose rm -fs netbox netbox-worker
|
docker compose rm -fs netbox netbox-worker
|
||||||
docker-compose pull
|
docker compose pull
|
||||||
docker-compose up -d netbox netbox-worker
|
docker compose up -d netbox netbox-worker
|
||||||
```
|
```
|
||||||
|
|
||||||
### Webhooks don't work
|
### Webhooks don't work
|
||||||
@ -169,7 +169,7 @@ Then make sure that the `redis` container and at least one `netbox-worker` are r
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# check the container status
|
# check the container status
|
||||||
$ docker-compose ps
|
$ docker compose ps
|
||||||
|
|
||||||
Name Command State Ports
|
Name Command State Ports
|
||||||
--------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------
|
||||||
@ -179,7 +179,7 @@ netbox-docker_postgres_1 docker-entrypoint.sh postgres Up 5432/tc
|
|||||||
netbox-docker_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp
|
netbox-docker_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp
|
||||||
|
|
||||||
# connect to redis and send PING command:
|
# connect to redis and send PING command:
|
||||||
$ docker-compose run --rm -T redis sh -c 'redis-cli -h redis -a $REDIS_PASSWORD ping'
|
$ docker compose run --rm -T redis sh -c 'redis-cli -h redis -a $REDIS_PASSWORD ping'
|
||||||
Warning: Using a password with '-a' option on the command line interface may not be safe.
|
Warning: Using a password with '-a' option on the command line interface may not be safe.
|
||||||
PONG
|
PONG
|
||||||
```
|
```
|
||||||
@ -189,14 +189,14 @@ If `redis` and the `netbox-worker` are not available, make sure you have updated
|
|||||||
Everything's up and running? Then check the log of `netbox-worker` and/or `redis`:
|
Everything's up and running? Then check the log of `netbox-worker` and/or `redis`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose logs -f netbox-worker
|
docker compose logs -f netbox-worker
|
||||||
docker-compose logs -f redis
|
docker compose logs -f redis
|
||||||
```
|
```
|
||||||
|
|
||||||
Still no clue? You can connect to the `redis` container and have it report any command that is currently executed on the server:
|
Still no clue? You can connect to the `redis` container and have it report any command that is currently executed on the server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose run --rm -T redis sh -c 'redis-cli -h redis -a $REDIS_PASSWORD monitor'
|
docker compose run --rm -T redis sh -c 'redis-cli -h redis -a $REDIS_PASSWORD monitor'
|
||||||
|
|
||||||
# Hit CTRL-C a few times to leave
|
# Hit CTRL-C a few times to leave
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user