Updated Troubleshooting (markdown)

Christian Mäder
2020-03-15 14:59:10 +01:00
parent bb11b6e148
commit 352c1f4ce6

@ -5,15 +5,63 @@ If your issue is not here, look through [the existing issues][issues] and eventu
### Docker Compose basics ### Docker Compose basics
* You can see all running containers belonging to this project using `docker-compose ps`. See all running containers:
* You can see the logs by running `docker-compose logs -f`.
Running `docker-compose logs -f netbox` will just show the logs for netbox. ```bash
* You can stop everything using `docker-compose stop`. docker-compose ps
* You can clean up everything using `docker-compose down -v --remove-orphans`. **This will also remove any related data.** ```
* You can enter the shell of the running Netbox container using `docker-compose exec netbox /bin/bash`. Now you have access to `./manage.py`, e.g. to reset a password.
* To access the database run `docker-compose exec postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'` See all logs:
* To create a database backup run `docker-compose exec postgres sh -c 'pg_dump -cU $POSTGRES_USER $POSTGRES_DB' | gzip > db_dump.sql.gz`
* To restore that database backup run `gunzip -c db_dump.sql.gz | docker exec -i $(docker-compose ps -q postgres) sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'`. ```bash
docker-compose logs -f
```
See just the Netbox logs:
```bash
docker-compose logs -f netbox
```
Stop it all:
```bash
docker-compose stop
```
Reset the project:
> ⚠️ **This will also remove any related data.**
```bash
docker-compose down -v --remove-orphans
````
Enter the Netbox shell, e.g. to get access to `./manage.py`:
```
docker-compose exec netbox /bin/bash
```
### Database operations
Access the database:
```bash
docker-compose exec postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
```
Take a database backup
```bash
docker-compose exec postgres sh -c 'pg_dump -cU $POSTGRES_USER $POSTGRES_DB' | gzip > db_dump.sql.gz`
```
Restore that database:
```bash
gunzip -c db_dump.sql.gz | docker exec -i $(docker-compose ps -q postgres) sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
```
### Nginx doesn't start ### Nginx doesn't start