mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-07-12 20:35:07 +02:00
Created Updating (markdown)
83
Updating.md
Normal file
83
Updating.md
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
# Updating
|
||||||
|
|
||||||
|
First of all, before you update, always read [the release notes of the NetBox Docker project](https://github.com/netbox-community/netbox-docker/releases).
|
||||||
|
If a new version of NetBox is rolled our, be sure to also [check the release notes of NetBox itself](https://github.com/netbox-community/netbox/releases).
|
||||||
|
|
||||||
|
When you followed [our Getting Started instructions](Getting-Started) instruction to get NetBox Docker running, then you should be able to follow this guide just fine.
|
||||||
|
Otherwise you will have to figure out the analogous steps yourself.
|
||||||
|
|
||||||
|
**IMPORTANT: Please make a backup of your data before updating!** [Our Troubleshooting page](Troubleshooting) has some information regarding this.
|
||||||
|
|
||||||
|
## Update steps
|
||||||
|
|
||||||
|
First, open a terminal and `cd` to your project folder.
|
||||||
|
This is the folder where the `docker-compose.yml` file is.
|
||||||
|
|
||||||
|
Now, stop all the containers that are running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, to update to the latest release, fetch all updates to the project files from the release channel:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git checkout release &&
|
||||||
|
git pull -p origin release
|
||||||
|
```
|
||||||
|
|
||||||
|
_NOTE: If you instead want to update to a specific version, [see the respective guide](Version)._
|
||||||
|
|
||||||
|
Now you need to tell Docker to fetch the latest NetBox Docker Container and also to fetch new version of the dependencies, such as a new Redis or PostgreSQL:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose pull
|
||||||
|
```
|
||||||
|
|
||||||
|
Now it's time to start all the containers again.
|
||||||
|
This will also migrate the NetBox database schema automatically.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
Once NetBox has started, you should be ready to go.
|
||||||
|
|
||||||
|
## Common Issues
|
||||||
|
|
||||||
|
### Updating from below 1.x.x to 1.x.x
|
||||||
|
|
||||||
|
Don't forget to update the `docker-compose.override.yml` file, [as described in the release notes](https://github.com/netbox-community/netbox-docker/releases/tag/1.0.0).
|
||||||
|
|
||||||
|
### PostgreSQL Update
|
||||||
|
|
||||||
|
Updates between major versions of PostgreSQL (e.g. version 11 to 12) require special attention.
|
||||||
|
The easiest way to perform such an update is to backup the database on the old version and restore the data on the new version:
|
||||||
|
|
||||||
|
**⚠️ IMPORTANT: Make sure to test this procedure first before applying it to valuable data ⚠️***
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd <path_to>/netbox-docker
|
||||||
|
|
||||||
|
# Stop all containers
|
||||||
|
docker-compose down
|
||||||
|
|
||||||
|
# Only start the DB
|
||||||
|
docker-compose up -d postgres
|
||||||
|
docker-compose exec -T postgres sh -c 'pg_dump -cU $POSTGRES_USER $POSTGRES_DB' | gzip > db_dump.sql.gz
|
||||||
|
|
||||||
|
# Stop the database and remove it's volme
|
||||||
|
# THIS STEP WILL WIPE YOUR DATABASE!
|
||||||
|
docker-compose rm -sfv postgres
|
||||||
|
|
||||||
|
# Update NetBox Docker files and containers
|
||||||
|
git checkout release && git pull -p origin release
|
||||||
|
docker-compose pull
|
||||||
|
|
||||||
|
# Restore the database
|
||||||
|
docker-compose up -d postgres
|
||||||
|
gunzip -c db_dump.sql.gz | docker-compose exec -T postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'
|
||||||
|
|
||||||
|
# Start all other containers
|
||||||
|
docker-compose up
|
||||||
|
```
|
Reference in New Issue
Block a user