Skip to content

Commit fc5495e

Browse files
committed
Introduced a script to assist with upgrading NetBox
1 parent 004f5c4 commit fc5495e

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
configuration.py
33
.idea
44
/*.sh
5+
!upgrade.sh
56
fabfile.py
6-

docs/getting-started.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -356,19 +356,17 @@ Please keep in mind that the configurations provided here are bare minimums requ
356356

357357
# Upgrading
358358

359-
As with the initial installation, you can upgrade NetBox by either downloading the lastest release package or by cloning the `master` branch of the git repository. Several important steps are required before running the new code.
360-
361-
First, apply any database migrations that were included with the release. Not all releases include database migrations (in fact, most don't), so don't worry if this command returns "No migrations to apply."
359+
As with the initial installation, you can upgrade NetBox by either downloading the latest release package or by cloning the `master` branch of the git repository. Once the new code is in place, run the upgrade script (which may need to be run as root depending on how your environment is configured).
362360

363361
```
364-
# ./manage.py migrate
362+
# ./upgrade.sh
365363
```
366364

367-
Second, collect any static file that have changed into the root static path. As with database migrations, not all releases will include changes to static files.
365+
This script:
368366

369-
```
370-
# ./manage.py collectstatic
371-
```
367+
* Installs or upgrades any new required Python packages
368+
* Applies any database migrations that were included in the release
369+
* Collects all static files to be served by the HTTP service
372370

373371
Finally, restart the WSGI service to run the new code. If you followed this guide for the initial installation, this is done using `supervisorctl`:
374372

upgrade.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
# This script will prepare NetBox to run after the code has been upgraded to
3+
# its most recent release.
4+
#
5+
# Once the script completes, remember to restart the WSGI service (e.g.
6+
# gunicorn or uWSGI).
7+
8+
# Install any new Python packages
9+
pip install -r requirements.txt --upgrade
10+
11+
# Apply any database migrations
12+
./netbox/manage.py migrate
13+
14+
# Collect static files
15+
./netbox/manage.py collectstatic --noinput

0 commit comments

Comments
 (0)