2
0

upgrade.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  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. cd "$(dirname "$0")"
  8. PYTHON="python3"
  9. PIP="pip3"
  10. # Uninstall any Python packages which are no longer needed
  11. COMMAND="${PIP} uninstall -r old_requirements.txt -y"
  12. echo "Removing old Python packages ($COMMAND)..."
  13. eval $COMMAND
  14. # Install any new Python packages
  15. COMMAND="${PIP} install -r requirements.txt --upgrade"
  16. echo "Updating required Python packages ($COMMAND)..."
  17. eval $COMMAND
  18. # Apply any database migrations
  19. COMMAND="${PYTHON} netbox/manage.py migrate"
  20. echo "Applying database migrations ($COMMAND)..."
  21. eval $COMMAND
  22. # Delete any stale content types
  23. COMMAND="${PYTHON} netbox/manage.py remove_stale_contenttypes --no-input"
  24. echo "Removing stale content types ($COMMAND)..."
  25. eval $COMMAND
  26. # Collect static files
  27. COMMAND="${PYTHON} netbox/manage.py collectstatic --no-input"
  28. echo "Collecting static files ($COMMAND)..."
  29. eval $COMMAND