Skip to content

Upgrading

Dave Lawrence edited this page Feb 21, 2023 · 3 revisions

Process

  • Email affected users (2 days in advance)
  • Add a site message with countdown
  • Inform users of fixes and new features via changelog.html
  • Server should be upgraded out of hours (and check that nobody is using system during upgrade)
  • Post upgrade - use site messages to inform users of any information they need to know

Site messages for User Notification

Before upgrading a live site, it's best to warn the users. You can do this via admin (prob easiest to set date) or command line:

python3 manage.py site_messages --shutdown=1440  # 24 hours notice

This will add a message like "The system will soon be shut down soon (4 minutes and 59 seconds from now)" to the top of logged in screens.

After the upgrade, you can then run:

python3 manage.py site_messages --clear-old

Which will remove any messages with dates in the past.

Libraries

New libraries should have been added to the requirements file, so if needed, run:

sudo python3 -m pip install -r requirements.txt

Upgrade Tool

We have an upgrade utility script in ./scripts/upgrade.sh

Running this tool will provide the user with 3 built in options:

  • git pull
  • collectstatic
  • migrate

In addition, if there are manual migration steps required they will be listed. As of the time of this writing manual steps are either "manage" (as in python manage.py managementcommand) or "other" (prompt the user with text to perform a step).

To create these manual steps, in a migration script

operations = [
    ManualOperation.operation_manage("dummy_command")
]

If you want to call it directly in a RunPython

if dummy_command_required:
    ManualOperation.operation_manage("dummy_command").run(apps)

Note: The upgrade tool does not restart services (which requires root access) - see below

Services

# Start services
sudo ./scripts/start_services.sh

# Stop Services
sudo ./scripts/stop_services.sh
# maybe check with ps aux | grep variant # nothing should show other than grep command

# Restart services
sudo ./scripts/restart_services.sh

  • Go to the Annotation page (top menu) and look for anything red (annotation that needs upgrading)
  • Go to the Server Status page (Settings->Server Status) to make sure celery workers are running.
Clone this wiki locally