mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-02-16 18:20:53 +01: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:
|
||||
|
||||
```bash
|
||||
docker-compose ps
|
||||
docker compose ps
|
||||
```
|
||||
|
||||
See all logs:
|
||||
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
docker compose logs -f
|
||||
```
|
||||
> (Press Ctrl+C to return to the shell prompt.)
|
||||
|
||||
See just the NetBox logs:
|
||||
|
||||
```bash
|
||||
docker-compose logs -f netbox
|
||||
docker compose logs -f netbox
|
||||
```
|
||||
|
||||
Stop it all:
|
||||
|
||||
```bash
|
||||
docker-compose stop
|
||||
docker compose stop
|
||||
```
|
||||
|
||||
Reset the project:
|
||||
@ -35,7 +35,7 @@ Reset the project:
|
||||
> ⚠️ **This will remove any Netbox-related data.**
|
||||
|
||||
```bash
|
||||
docker-compose down -v --remove-orphans
|
||||
docker compose down -v --remove-orphans
|
||||
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:
|
||||
|
||||
```
|
||||
docker-compose exec netbox /bin/bash
|
||||
docker compose exec netbox /bin/bash
|
||||
```
|
||||
|
||||
To load the Python environment for Netbox run:
|
||||
@ -57,23 +57,23 @@ source /opt/netbox/venv/bin/activate
|
||||
Access the database:
|
||||
|
||||
```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
|
||||
|
||||
```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:
|
||||
|
||||
```bash
|
||||
# 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
|
||||
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
|
||||
@ -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.
|
||||
|
||||
```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:
|
||||
@ -89,7 +89,7 @@ Restore of the _media_ directory:
|
||||
> ⚠️ This may overwrite files in the media directory!
|
||||
|
||||
```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
|
||||
@ -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:
|
||||
|
||||
```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)
|
||||
@ -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.
|
||||
|
||||
```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
|
||||
@ -150,9 +150,9 @@ Update your local installation:
|
||||
git pull origin release
|
||||
|
||||
# Fetch the newest containers
|
||||
docker-compose rm -fs netbox netbox-worker
|
||||
docker-compose pull
|
||||
docker-compose up -d netbox netbox-worker
|
||||
docker compose rm -fs netbox netbox-worker
|
||||
docker compose pull
|
||||
docker compose up -d netbox netbox-worker
|
||||
```
|
||||
|
||||
### Webhooks don't work
|
||||
@ -169,7 +169,7 @@ Then make sure that the `redis` container and at least one `netbox-worker` are r
|
||||
|
||||
```bash
|
||||
# check the container status
|
||||
$ docker-compose ps
|
||||
$ docker compose ps
|
||||
|
||||
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
|
||||
|
||||
# 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.
|
||||
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`:
|
||||
|
||||
```bash
|
||||
docker-compose logs -f netbox-worker
|
||||
docker-compose logs -f redis
|
||||
docker compose logs -f netbox-worker
|
||||
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:
|
||||
|
||||
```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
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user