From 69d4e0ca09294f28a5bb975b86ed2869e3df8fd8 Mon Sep 17 00:00:00 2001 From: Alexey Date: Fri, 8 Nov 2024 02:42:49 +0700 Subject: [PATCH] Fix docker instructions fixed: docker-compose is very old depricated , misslead to update database from netbox container , why it shall not be postgres ? improve: easer way to deploy sql , just from stdin instead of trics with docker exec --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 424fa85..b8c1f92 100644 --- a/README.md +++ b/README.md @@ -25,15 +25,18 @@ sudo -u postgres psql netbox < netbox-demo-data/sql/netbox-demo-$VERSION.sql ``` ### Docker Commands - ``` +# stop netbox +docker compose stop netbox + # Drop & recreate the database -docker-compose exec postgres sh -c 'psql -U $POSTGRES_USER postgres -c "DROP DATABASE netbox;"' -docker-compose exec postgres sh -c 'psql -U $POSTGRES_USER postgres -c "CREATE DATABASE netbox;"' +docker compose exec postgres sh -c 'psql -U $POSTGRES_USER postgres -c "DROP DATABASE netbox;"' +docker compose exec postgres sh -c 'psql -U $POSTGRES_USER postgres -c "CREATE DATABASE netbox;"' -# Load the demo data -docker cp netbox-demo-$VERSION.sql "$(docker-compose ps -q netbox)":/opt/netbox/netbox/netbox-demo.sql -docker-compose exec netbox bash -c "psql -U $POSTGRES_USER netbox < /opt/netbox/netbox/netbox-demo.sql" +# Load the demo data, change VERSION if need +(VERSION=v4.1; curl https://raw.githubusercontent.com/netbox-community/netbox-demo-data/refs/heads/master/sql/netbox-demo-$VERSION.sql | docker compose exec -T postgres psql -U $POSTGRES_USER netbox) +# run netbox, wait migrations done +docker compose up netbox ``` ## Exporting the Data