Skip to content

Commit

Permalink
Fix docker instructions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zba committed Nov 7, 2024
1 parent 3d8bf08 commit 69d4e0c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 69d4e0c

Please sign in to comment.