From 26b996c8ed3a0ea5ae4e56489953129e32be3286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Tue, 30 Aug 2022 15:46:07 +0200 Subject: [PATCH] docker-compose --> docker compose --- Troubleshooting.md | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Troubleshooting.md b/Troubleshooting.md index 679b642..a6c960d 100644 --- a/Troubleshooting.md +++ b/Troubleshooting.md @@ -8,25 +8,25 @@ 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 ``` -See just the Netbox logs: +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: @@ -34,7 +34,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 ```` @@ -43,7 +43,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: @@ -56,20 +56,20 @@ 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' @@ -80,7 +80,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: @@ -88,7 +88,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 @@ -96,7 +96,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) @@ -104,7 +104,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 @@ -149,9 +149,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 @@ -168,7 +168,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 -------------------------------------------------------------------------------------------------------- @@ -178,7 +178,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 ``` @@ -188,16 +188,16 @@ 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 ``` -If you don't see anything happening after you triggered a webhook, double-check the configuration of the `netbox` and the `netbox-worker` containers and also check the configuration of your webhook in the admin interface of Netbox. \ No newline at end of file +If you don't see anything happening after you triggered a webhook, double-check the configuration of the `netbox` and the `netbox-worker` containers, and also check the configuration of your webhook in the admin interface of NetBox. \ No newline at end of file