diff --git a/.gitignore b/.gitignore index 7628f9af7..e769694ea 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ configuration.py .idea /*.sh +!upgrade.sh fabfile.py - diff --git a/docs/getting-started.md b/docs/getting-started.md index 788c3a88f..592f658c6 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -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`: diff --git a/upgrade.sh b/upgrade.sh new file mode 100755 index 000000000..f2f1a5f28 --- /dev/null +++ b/upgrade.sh @@ -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