From 352c1f4ce6b66ee25366aa64f93a88de38f160cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Sun, 15 Mar 2020 14:59:10 +0100 Subject: [PATCH] Updated Troubleshooting (markdown) --- Troubleshooting.md | 66 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/Troubleshooting.md b/Troubleshooting.md index 2485f28..bfd52ad 100644 --- a/Troubleshooting.md +++ b/Troubleshooting.md @@ -5,15 +5,63 @@ If your issue is not here, look through [the existing issues][issues] and eventu ### Docker Compose basics -* You can see all running containers belonging to this project using `docker-compose ps`. -* You can see the logs by running `docker-compose logs -f`. - Running `docker-compose logs -f netbox` will just show the logs for netbox. -* You can stop everything using `docker-compose stop`. -* 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'` -* 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'`. +See all running containers: + +```bash +docker-compose ps +``` + +See all logs: + +```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