upgrade.sh 887 B

12345678910111213141516171819202122232425262728293031
  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. # Collect static files
  23. COMMAND="${PYTHON} netbox/manage.py collectstatic --no-input"
  24. echo "Collecting static files ($COMMAND)..."
  25. eval $COMMAND