Updating or Patching NearBeach¶
NearBeach and it’s framework Django will need frequent updating/patching. (talk about security)
Updating Django (Web Framework)¶
It is recommended to install NearBeach on a Long Term Support (LTS) version of Django. Security fixes/patches are applied for a longer period of time, helping keep your server secure.
NearBeach currently supports the following Django versions;
- Django Version 3.1+
More information about upgrading Django can be found found in the Django Documentation
Updating NearBeach¶
NearBeach will be using the Semantic Versioning system. Version numbers will be laid out as follows; major.minor.patch
- MAJOR version changes means a new NearBeach. The changes are extensive that a new number for NearBeach is required.
- MINOR version changes means new functionality in NearBeach. This could require
- Database migrations
- Static file migrations
- PATCH versions mean very small changes. Usually this is to fix a bug or include a static file that was missing.
Method¶
- Use ssh to connect with your web server
ssh <<webserver IP or address>>
- Use cd to navigate to your project directory
cd <<project location>>
- Activate your virtual environment for your web server
source <<virtualenv_location>>/bin/activate
- Update NearBeach using PIP
pip install --upgrade NearBeachIf you require a certain version of NearBeach, use the following code as an example
pip install NearBeach==0.26.0
- Once NearBeach has been updated, you will still need to;
- Apply any database Migrations
- Collect any static files
- Use the following code to apply any migrations
python3 ./manage.py migrate
- Use the following code to collect any static files
python3 ./manage.py collectstatic
- Refresh gunicorn to enforce the new version
sudo service gunicorn refresh
Your new version of NearBeach should be ready.
Caching Issues¶
NearBeach does not use a mixer to notify the browser or the cache that the static files (JavaScript, CSS, and Images) have been updated. This can cause issues when applying a patch for users. We recommend people clean their cache to stop any issues.
Note
Please note - if you are using services like CloudFlare - it might cache an old version of the static files. You will need to purge the cache on these services.