1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Introduced a script to assist with upgrading NetBox

This commit is contained in:
Jeremy Stretch
2016-06-29 15:43:42 -04:00
parent 004f5c448e
commit fc5495eb3b
3 changed files with 22 additions and 9 deletions

2
.gitignore vendored
View File

@ -2,5 +2,5 @@
configuration.py
.idea
/*.sh
!upgrade.sh
fabfile.py

View File

@ -356,19 +356,17 @@ Please keep in mind that the configurations provided here are bare minimums requ
# Upgrading
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.
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."
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).
```
# ./manage.py migrate
# ./upgrade.sh
```
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.
This script:
```
# ./manage.py collectstatic
```
* Installs or upgrades any new required Python packages
* Applies any database migrations that were included in the release
* Collects all static files to be served by the HTTP service
Finally, restart the WSGI service to run the new code. If you followed this guide for the initial installation, this is done using `supervisorctl`:

15
upgrade.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# This script will prepare NetBox to run after the code has been upgraded to
# its most recent release.
#
# Once the script completes, remember to restart the WSGI service (e.g.
# gunicorn or uWSGI).
# Install any new Python packages
pip install -r requirements.txt --upgrade
# Apply any database migrations
./netbox/manage.py migrate
# Collect static files
./netbox/manage.py collectstatic --noinput